From 3954492c3fbf5604c1142c32a78ef52a13bc42d4 Mon Sep 17 00:00:00 2001 From: Pallab Pain Date: Wed, 10 Jul 2024 22:03:56 +0530 Subject: [PATCH] refactor!: remove unsupported APIs --- rapyuta_io/rio_client.py | 656 +-------------------------------------- 1 file changed, 2 insertions(+), 654 deletions(-) diff --git a/rapyuta_io/rio_client.py b/rapyuta_io/rio_client.py index 7c70d0ff..2d3b1242 100644 --- a/rapyuta_io/rio_client.py +++ b/rapyuta_io/rio_client.py @@ -2,38 +2,28 @@ from __future__ import absolute_import import json -import jsonschema import os import six from rapyuta_io.clients import DeviceManagerClient, _ParamserverClient -from rapyuta_io.clients.build import Build, BuildStatus from rapyuta_io.clients.catalog_client import CatalogClient from rapyuta_io.clients.core_api_client import CoreAPIClient -from rapyuta_io.clients.deployment import Deployment from rapyuta_io.clients.device import Device from rapyuta_io.clients.metrics import QueryMetricsRequest, MetricOperation, \ MetricFunction, QueryMetricsResponse, \ ListMetricsRequest, ListTagKeysRequest, \ Metric, Tags, ListTagValuesRequest -from rapyuta_io.clients.native_network import NativeNetwork -from rapyuta_io.clients.package import Package -from rapyuta_io.clients.package import Runtime, ROSDistro, RestartPolicy -from rapyuta_io.clients.persistent_volumes import VolumeInstance from rapyuta_io.clients.project import Project from rapyuta_io.clients.rip_client import RIPClient, AuthTokenLevel from rapyuta_io.clients.rosbag import ROSBagJob, ROSBagJobStatus, ROSBagBlob, \ ROSBagBlobStatus -from rapyuta_io.clients.routed_network import RoutedNetwork, Parameters from rapyuta_io.clients.secret import Secret from rapyuta_io.clients.user_group import UserGroup from rapyuta_io.utils import InvalidAuthTokenException, \ InvalidParameterException -from rapyuta_io.utils import to_objdict -from rapyuta_io.utils.settings import VOLUME_PACKAGE_ID, default_host_config -from rapyuta_io.utils.utils import get_api_response_data, valid_list_elements -from rapyuta_io.clients.validation_schema import UPDATE_DEPLOYMENT_SCHEMA +from rapyuta_io.utils.settings import default_host_config +from rapyuta_io.utils.utils import valid_list_elements class Client(object): @@ -119,7 +109,6 @@ def set_project(self, project_guid): >>> client = Client(auth_token='auth_token', project='project_guid') >>> project = client.create_project(Project('secret-guid')) >>> client.set_project(project.guid) - >>> persistent_volume = client.get_persistent_volume() """ self._catalog_client.set_project(project_guid) @@ -127,238 +116,6 @@ def set_project(self, project_guid): self._dmClient.set_project(project_guid) self._paramserver_client.set_project(project_guid) - def get_persistent_volume(self, retry_limit=0): - """ - Get persistent volume class - - :param retry_limit: Number of retry attempts to be carried out if any failures occurs during the API call. - :type retry_limit: int - :return: :py:class:`PersistentVolumes` class. - :raises: :py:class:`APIError`: If the API returns an error, a status code - of anything other than 200/201 is returned. - - Following example demonstrates how to get a persistent volume - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> persistent_volume = client.get_persistent_volume() - - """ - volume = self._catalog_client.get_package(VOLUME_PACKAGE_ID, retry_limit) - self._add_auth_token(volume) - return volume - - def get_package(self, package_id, retry_limit=0): - - """ - Get package class - - :param package_id: Package ID - :type package_id: string - :param retry_limit: Number of retry attempts to be carried out if any failures occurs \ - during the API call. - :type retry_limit: int - :return: an instance of :py:class:`~clients.catalog.Package` class. - :raises: :py:class:`PackageNotFound`: If the given package id is not found. - :raises: :py:class:`ComponentNotFoundException`: If the plan inside the package does - not have components. - :raises: :py:class:`APIError`: If the API returns an error, a status code - of anything other than 200/201 is returned. - - - Following example demonstrates how to get the packages - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> package = client.get_package('test_package_id') - - """ - - pkg = self._catalog_client.get_package(package_id, retry_limit) - self._add_auth_token(pkg) - return pkg - - def get_all_packages(self, retry_limit=0, name=None, version=None): - - """ - Get list of all packages created by the user. - - :param retry_limit: Number of retry attempts to be carried out if any failures occurs \ - during the API call. - :type retry_limit: int - :param name: Optional parameter to filter the packages based on substring of the package name. - :type name: str - :param version: Optional parameter to filter the packages based on the version of the package. - :type version: str - :return: List of all packages. Each package is an instance of - :py:class:`~clients.catalog.Package` class. - :raises: :py:class:`APIError`: If the API returns an error, a status code - of anything other than 200/201 is returned. - - - Following example demonstrates how to get the packages - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> package_list = client.get_all_packages() - >>> pacakge_list_filter_by_name = client.get_all_packages(name='test-name') - >>> pacakge_list_filter_by_version = client.get_all_packages(version='v0.0.0') - - """ - - if name and not isinstance(name, six.string_types): - raise InvalidParameterException('name must be a string') - if version and not isinstance(version, six.string_types): - raise InvalidParameterException('version must be a string') - package_list = self._catalog_client.get_all_packages(retry_limit) - packages = list() - for package in package_list['services']: - if package['id'] == VOLUME_PACKAGE_ID: - continue - package = Package(to_objdict(package)) - self._add_auth_token(package) - packages.append(package) - if name: - packages = [p for p in packages if p.packageName.find(name) != -1] - if version: - packages = [p for p in packages if p.packageVersion == version] - return packages - - def delete_package(self, package_id): - - """ - Delete a package. - - :param package_id: ID of the package to be deleted. - :type package_id: str - - Following example demonstrates how to delete a package. - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> client.delete_package('package_id') - - """ - - if not (isinstance(package_id, str) or isinstance(package_id, six.string_types)) or package_id == '': - raise InvalidParameterException("package_id must be a non-empty string") - response = self._catalog_client.delete_package(package_id) - get_api_response_data(response, parse_full=True) - - def get_deployment(self, deployment_id, retry_limit=0): - """ - Get a deployment - - :param deployment_id: Deployment ID - :type deployment_id: string - :param retry_limit: Optional parameter to specify the number of retry attempts to be - carried out if any failures occurs during the API call. - :type retry_limit: int - :return: instance of class :py:class:`Deployment`: - :raises: :py:class:`APIError`: If the API returns an error, a status code of - anything other than 200/201 is returned. - - - - Following example demonstrates how to get all the deployments. - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> deployment = client.get_deployment('deployment_id') - - """ - deployment = self._catalog_client.get_deployment(deployment_id, retry_limit) - deployment = Deployment(to_objdict(deployment)) - self._add_auth_token(deployment) - deployment.is_partial = False - return deployment - - def get_volume_instance(self, instance_id, retry_limit=0): - """ - Get a volume instance - - :param instance_id: Volume instance Id - :type instance_id: string - :param retry_limit: Optional parameter to specify the number of retry attempts to be - carried out if any failures occurs during the API call. - :type retry_limit: int - :return: instance of class :py:class:`VolumeInstance`: - :raises: :py:class:`APIError`: If the API returns an error, a status code - of anything other than 200/201 is returned. - - Following example demonstrates how to get a volume instance. - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> deployments = client.get_volume_instance('instance_id') - - """ - volume_instance = self._catalog_client.get_deployment(instance_id, retry_limit) - volume_instance = VolumeInstance(to_objdict(volume_instance)) - self._add_auth_token(volume_instance) - volume_instance.is_partial = False - return volume_instance - - def get_all_deployments(self, phases=None, device_id='', retry_limit=0): - """ - Get all deployments created by the user. - - :param phases: optional parameter to filter out the deployments based on current deployment - :type phases: list(DeploymentPhaseConstants) - :param device_id: optional parameter to filter out the deployments based on uid of the corresponding device - :type device_id: str - :param retry_limit: Optional parameter to specify the number of retry attempts to be - carried out if any failures occurs during the API call. - :type retry_limit: int - :return: list of instances of class :py:class:`Deployment`: - :raises: :py:class:`APIError`: If the API returns an error, a status code - of anything other than 200/201 is returned. - - Following example demonstrates how to get all the deployments. - - >>> from rapyuta_io import Client, DeploymentPhaseConstants - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> deployments = client.get_all_deployments() - >>> deployments_list_filtered_by_phase = client.get_all_deployments(phases= - >>> [DeploymentPhaseConstants.SUCCEEDED, DeploymentPhaseConstants.PROVISIONING]) - >>> deployments_list_filtered_by_device_id = client.get_all_deployments( - >>> device_id='') - - """ - if not isinstance(device_id, six.string_types): - raise InvalidParameterException('invalid deviceID') - - deployment_list = self._catalog_client.deployment_list(phases, device_id, retry_limit) - deployments = list() - for deployment in deployment_list: - if deployment['packageId'] == VOLUME_PACKAGE_ID: - continue - deployment_object = Deployment(to_objdict(deployment)) - # todo: remove volume instances - self._add_auth_token(deployment_object) - deployments.append(deployment_object) - return deployments - - def update_deployment(self, payload, retry_limit=0): - """ - Update a deployment - - :type payload: json - :type retry_limit: int - :return: list of instances of class :py:class:`Deployment`: - :raises: :py:class:`APIError`: If the API returns an error, a status code - of anything other than 200/201 is returned. - - The following example demonstrates how to update a deployment - - >>> from rapyuta_io import Client, DeploymentPhaseConstants - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> status = client.update_deployment(payload) - - """ - jsonschema.validate(instance=payload, schema=UPDATE_DEPLOYMENT_SCHEMA) - return self._catalog_client.update_deployment(payload, retry_limit) - def get_authenticated_user(self): """ Get details for authenticated User. @@ -767,329 +524,6 @@ def delete_static_route(self, route_guid): """ return self._core_api_client.delete_static_route(route_guid) - def get_routed_network(self, network_guid): - """ - Get routed network for the guid - - :param network_guid: guid of routed network - :type network_guid: str - :return: Instance of :py:class:`~rapyuta_io.clients.routed_network.RoutedNetwork` class. - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> routed_network = client.get_routed_network(network_guid) - - """ - routed_network = self._catalog_client.get_routed_network(network_guid) - routed_network = RoutedNetwork(to_objdict(routed_network)) - routed_network.phase = routed_network.internalDeploymentStatus.phase - routed_network.status = routed_network.internalDeploymentStatus.status - routed_network.error_code = routed_network.get_error_code() - self._add_auth_token(routed_network) - routed_network.is_partial = False - return routed_network - - def get_all_routed_networks(self): - """ - List routed network - - :return: List instance of :py:class:`~rapyuta_io.clients.routed_network.RoutedNetwork` class. - """ - - routed_networks = [] - networks = self._catalog_client.list_routed_network() - for routed_network in networks: - routed_network = RoutedNetwork(to_objdict(routed_network)) - internal_deployment_status = routed_network.internalDeploymentStatus - routed_network.phase = internal_deployment_status.phase - routed_network.error_code = routed_network.get_error_code() - self._add_auth_token(routed_network) - routed_networks.append(routed_network) - return routed_networks - - def delete_routed_network(self, network_guid): - - """ - Delete a routed network using its network_guid - - :param network_guid: Routed Network GUID - :type network_guid: str - - Following example demonstrates how to delete a routed network under a project - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> client.delete_routed_network('network_guid') - - """ - if not network_guid or not isinstance(network_guid, six.string_types): - raise InvalidParameterException('guid needs to be a non empty string') - self._catalog_client.delete_routed_network(network_guid) - - def create_cloud_routed_network(self, name, ros_distro, shared, parameters=None): - - """ - Create a routed network - - :param name: Name of the routed network. - :type name: str - :param ros_distro: ros ditro of the runtime. - :type ros_distro: enum :py:class:`~rapyuta_io.clients.package.ROSDistro` - :param shared: Whether the network should be shared. - :type shared: bool - :param parameters: parameters of the routed network - :type parameters: :py:class:`~rapyuta_io.clients.routed_network.Parameters` - :return: Instance of :py:class:`~rapyuta_io.clients.routed_network.RoutedNetwork` class. - - Following example demonstrates how to create a routed network. - - >>> from rapyuta_io import Client - >>> from rapyuta_io.clients.package import ROSDistro - >>> from rapyuta_io.clients.routed_network import Parameters, RoutedNetworkLimits - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> parameters = Parameters(RoutedNetworkLimits.SMALL) - >>> routed_network = client.create_cloud_routed_network('network_name', ROSDistro.KINETIC, True, - ... parameters=parameters) - """ - if ros_distro not in list(ROSDistro.__members__.values()): - raise InvalidParameterException('ROSDistro must be one of rapyuta_io.clients.package.ROSDistro') - - if parameters and not isinstance(parameters, Parameters): - raise InvalidParameterException('parameters must be of type rapyuta_io.clients.routed_network.Parameters') - - parameters = parameters.to_dict() if parameters else {} - - routed_network = self._catalog_client.create_routed_network(name=name, runtime=Runtime.CLOUD, - rosDistro=ros_distro, - shared=shared, parameters=parameters) - routed_network = RoutedNetwork(to_objdict(routed_network)) - return self.get_routed_network(routed_network.guid) - - def create_device_routed_network(self, name, ros_distro, shared, - device, network_interface, restart_policy=RestartPolicy.Always): - - """ - Create a routed network - - :param name: Name of the routed network. - :type name: str - :param ros_distro: ros ditro of the runtime. - :type ros_distro: enum :py:class:`~rapyuta_io.clients.package.ROSDistro` - :param shared: Whether the network should be shared. - :type shared: bool - :param device: device on which the routed network is deployed. - :type device: Instance of :py:class:`~Device` class. - :param network_interface: network interface to which routed network is binded. - :type network_interface: str - :param restart_policy: restart policy of routed network. - :type restart_policy: enum :py:class:`~rapyuta_io.clients.package.RestartPolicy` - :return: Instance of :py:class:`~rapyuta_io.clients.routed_network.RoutedNetwork` class. - - Following example demonstrates how to create a routed network. - - >>> from rapyuta_io import Client - >>> from rapyuta_io.clients.package import ROSDistro - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> routed_network = client.create_device_routed_network('network_name', - >>> ROSDistro.KINETIC, True) - """ - - parameters = {} - if ros_distro not in list(ROSDistro.__members__.values()): - raise InvalidParameterException('ROSDistro must be one of rapyuta_io.clients.package.ROSDistro') - - if not isinstance(device, Device): - raise InvalidParameterException('device must be of type rapyuta_io.clients.device.Device') - - ip_interfaces = device.ip_interfaces or {} - if network_interface not in list(ip_interfaces.keys()): - raise InvalidParameterException('NETWORK_INTERFACE should be in {}'.format(list(ip_interfaces.keys()))) - - if restart_policy not in list(RestartPolicy.__members__.values()): - raise InvalidParameterException('RestartPolicy must be one of rapyuta_io.clients.package.RestartPolicy') - - parameters['device_id'] = device.uuid - parameters['NETWORK_INTERFACE'] = network_interface - parameters['restart_policy'] = restart_policy - - routed_network = self._catalog_client.create_routed_network(name=name, runtime=Runtime.DEVICE, - rosDistro=ros_distro, - shared=shared, parameters=parameters) - routed_network = RoutedNetwork(to_objdict(routed_network)) - return self.get_routed_network(routed_network.guid) - - def create_build(self, build, refresh=True): - - """ - Create a new build - - :param build: Info about the build to be created - :type build: :py:class:`~rapyuta_io.clients.build.Build` - :param refresh: Whether the build needs to be refreshed - :type refresh: bool - :return: Instance of :py:class:`~rapyuta_io.clients.build.Build` class. - - Following example demonstrates how to create a build. - - >>> from rapyuta_io import Client, ROSDistro, Build, SimulationOptions, BuildOptions, CatkinOption, GithubWebhook - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> simulationOptions = SimulationOptions(False) - >>> buildOptions = BuildOptions(catkinOptions=[CatkinOption(rosPkgs='talker')]) - >>> webhooks = [GithubWebhook(workflowName='test.yaml', accessToken='github_access_token')] - >>> build = Build(buildName='test-build', - ... strategyType='Source', - ... repository='https://github.com/rapyuta-robotics/io_tutorials.git', - ... architecture='amd64', - ... rosDistro='melodic', - ... isRos=True, - ... contextDir='talk/talker', - ... simulationOptions=simulationOptions, - ... buildOptions=buildOptions, - ... buildWebhooks=webhooks) - >>> build = client.create_build(build) - >>> build.poll_build_till_ready() - - """ - if not isinstance(build, Build): - raise InvalidParameterException("build must be non-empty and of type " - "rapyuta_io.clients.build.Build") - response = self._catalog_client.create_build(build) - build['guid'] = response.get('guid') - self._add_auth_token(build) - if refresh: - build.refresh() - return build - - def get_build(self, guid, include_build_requests=False): - - """ - Get a build based on the guid. - - :param guid: GUID of the build - :type guid: str - :param include_build_requests: Whether to include build request in the response - :type include_build_requests: bool - :return: Instance of :py:class:`~rapyuta_io.clients.build.Build` class. - - Following example demonstrates how to get a build. - - 1. Get build without including build requests. - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> build = client.get_build('build-guid') - - 2. Get build including the build requests. - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> build = client.get_build('build-guid', include_build_requests=True) - - """ - if not isinstance(include_build_requests, bool): - raise InvalidParameterException('include_build_requests must be of bool type') - build = self._catalog_client.get_build(guid, include_build_requests) - build = Build._deserialize(build) - self._add_auth_token(build) - build.is_partial = False - return build - - def list_builds(self, statuses=None): - - """ - List builds based on the passed query params - - :param statuses: statuses based on which the list build response will be filtered. - :type statuses: list(:py:class:`~rapyuta_io.clients.build.BuildStatus`) - :return: list(:py:class:`~rapyuta_io.clients.build.Build`) - - Following example demonstrates how to list builds. - - 1. List all builds present in the project. - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> build = client.list_builds() - - 2. List builds based on their statuses. - - >>> from rapyuta_io import Client, BuildStatus - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> builds = client.list_builds(statuses=[BuildStatus.COMPLETE, BuildStatus.BUILD_FAILED, - ... BuildStatus.BUILD_IN_PROGRESS]) - """ - if statuses is not None: - BuildStatus.validate(statuses) - builds = self._catalog_client.list_builds(statuses) - build_list = [] - for build in builds: - build = Build._deserialize(build) - self._add_auth_token(build) - build_list.append(build) - return build_list - - def delete_build(self, guid): - - """ - Delete a build. - - :param guid: GUID of the build to be deleted - :type guid: str - - Following example demonstrates how to delete a build. - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> client.delete_build('build-guid') - """ - response = self._catalog_client.delete_build(guid=guid) - get_api_response_data(response, parse_full=True) - - def trigger_build(self, buildOperation): - - """ - Trigger a new build request for a particular build - - :param buildOperation: Info of the operation to be performed on the build. - :type buildOperation: :py:class:`~rapyuta_io.clients.buildoperation.BuildOperation` - - Following example demonstrates how to trigger a new build request for a build: - - >>> from rapyuta_io import Client, BuildOperationInfo, BuildOperation - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> request = BuildOperation([BuildOperationInfo('build-guid', triggerName='trigger-name')]) - >>> response = client.trigger_build(request) - >>> for resp in response['buildOperationResponse']: - ... if not resp['success']: - ... print resp['buildGUID'], resp['error'] - ... else: - ... print resp['buildGUID'], resp['buildGenerationNumber'] - - """ - return self._catalog_client.trigger_build(buildOperation=buildOperation) - - def rollback_build(self, buildOperation): - - """ - Rollback the build to a previously created build request - - :param buildOperation: Info of the operation to be performed on the build. - :type buildOperation: :py:class:`~rapyuta_io.clients.buildoperation.BuildOperation` - - Following example demonstrates how to rollback a build: - - >>> from rapyuta_io import Client, BuildOperationInfo, BuildOperation - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> request = BuildOperation([BuildOperationInfo('build-guid', 1)]) - >>> response = client.rollback_build(request) - >>> for resp in response['buildOperationResponse']: - ... if not resp['success']: - ... print resp['buildGUID'], resp['error'] - ... else: - ... print resp['buildGUID'], resp['buildGenerationNumber'] - - """ - return self._catalog_client.rollback_build(buildOperation=buildOperation) - def get_rosbag_job(self, guid): """ Get ROSBag Job @@ -1600,92 +1034,6 @@ def delete_secret(self, guid): """ return self._core_api_client.delete_secret(guid) - def get_native_network(self, network_guid): - """ - Get a native network using its network_guid - - :param network_guid: native network GUID - :type network_guid: str - :rtype: :py:class:`~rapyuta_io.clients.native_network.NativeNetwork` - - Following example demonstrates how a native network can be fetched using this method - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> native_network = client.get_native_network('network_guid') - """ - if not network_guid or not isinstance(network_guid, six.string_types): - raise InvalidParameterException('guid needs to be a non empty string') - - native_network = self._catalog_client.get_native_network(network_guid) - native_network = NativeNetwork.deserialize(native_network) - self._add_auth_token(native_network) - native_network.is_partial = False - return native_network - - def list_native_networks(self): - """ - Lists all the native networks under a project - - :return: A list of all available native networks under the Project. - :rtype: List(:py:class:`~rapyuta_io.clients.native_network.NativeNetwork`) - - Following example demonstartes how to list all the native networks under a project - - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> native_networks = client.list_native_networks() - """ - native_networks = [] - networks = self._catalog_client.list_native_network() - for native_network in networks: - native_network = NativeNetwork.deserialize(native_network) - self._add_auth_token(native_network) - native_networks.append(native_network) - return native_networks - - def create_native_network(self, native_network): - """ - Creates a new native network - - :param native_network: Native Network object - :type native_network: :py:class:`~rapyuta_io.clients.native_network.NativeNetwork` - :rtype: :py:class:`~rapyuta_io.clients.native_network.NativeNetwork` - - Following example demonstrates how to create a native network under a project - >>> from rapyuta_io import Client - >>> from rapyuta_io.clients.native_network import NativeNetwork,Parameters,NativeNetworkLimits - >>> from rapyuta_io.clients.package import Runtime, ROSDistro - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> parameters = Parameters(NativeNetworkLimits.SMALL) - >>> native_network = NativeNetwork('native_network_name', Runtime.CLOUD, ROSDistro.KINETIC, - ... parameters=parameters) - >>> native_network = client.create_native_network(native_network) - """ - if not isinstance(native_network, NativeNetwork): - raise InvalidParameterException("native_network must be non-empty and of type " - "rapyuta_io.clients.native_network.NativeNetwork") - native_network_response = self._catalog_client.create_native_network(native_network) - return self.get_native_network(native_network_response['guid']) - - def delete_native_network(self, network_guid): - - """ - Delete a native network using its network_guid - - :param network_guid: Native Network GUID - :type network_guid: str - - Following example demonstrates how to delete a native network under a project - >>> from rapyuta_io import Client - >>> client = Client(auth_token='auth_token', project='project_guid') - >>> client.delete_native_network('network_guid') - - """ - if not network_guid or not isinstance(network_guid, six.string_types): - raise InvalidParameterException('guid needs to be a non empty string') - self._catalog_client.delete_native_network(network_guid) - def query_metrics(self, query_metrics_request): """ Query and fetch metrics