From fc5910e4ca4a8b7d7a0f00f2ed07cdaf73d7ca5d Mon Sep 17 00:00:00 2001 From: Komal Thareja Date: Fri, 21 Jul 2023 11:32:30 -0400 Subject: [PATCH] add comment for keys --- .swagger-codegen/VERSION | 2 +- docs/PoaPostData.md | 1 + docs/PoaPostDataKeys.md | 10 ++ docs/PoaPostDataVcpuCpuMap.md | 4 +- fabric_cf/__init__.py | 2 +- fabric_cf/orchestrator/orchestrator_proxy.py | 6 +- .../orchestrator/swagger_client/__init__.py | 1 + .../swagger_client/api/poas_api.py | 4 +- .../swagger_client/models/poa_post.py | 2 +- .../swagger_client/models/poa_post_data.py | 32 +++- .../models/poa_post_data_keys.py | 138 ++++++++++++++++++ .../models/poa_post_data_vcpu_cpu_map.py | 10 +- 12 files changed, 196 insertions(+), 16 deletions(-) create mode 100644 docs/PoaPostDataKeys.md create mode 100644 fabric_cf/orchestrator/swagger_client/models/poa_post_data_keys.py diff --git a/.swagger-codegen/VERSION b/.swagger-codegen/VERSION index 8236a9b..d99c5ed 100644 --- a/.swagger-codegen/VERSION +++ b/.swagger-codegen/VERSION @@ -1 +1 @@ -3.0.44 +3.0.46 diff --git a/docs/PoaPostData.md b/docs/PoaPostData.md index e8648ac..f8663ca 100644 --- a/docs/PoaPostData.md +++ b/docs/PoaPostData.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **vcpu_cpu_map** | [**list[PoaPostDataVcpuCpuMap]**](PoaPostDataVcpuCpuMap.md) | | [optional] **node_set** | **list[str]** | | [optional] +**keys** | [**list[PoaPostDataKeys]**](PoaPostDataKeys.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/PoaPostDataKeys.md b/docs/PoaPostDataKeys.md new file mode 100644 index 0000000..3ef1794 --- /dev/null +++ b/docs/PoaPostDataKeys.md @@ -0,0 +1,10 @@ +# PoaPostDataKeys + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **str** | | +**comment** | **str** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/docs/PoaPostDataVcpuCpuMap.md b/docs/PoaPostDataVcpuCpuMap.md index b0b6ed8..66c56fa 100644 --- a/docs/PoaPostDataVcpuCpuMap.md +++ b/docs/PoaPostDataVcpuCpuMap.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**vcpu** | **str** | | [optional] -**cpu** | **str** | | [optional] +**vcpu** | **str** | | +**cpu** | **str** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/fabric_cf/__init__.py b/fabric_cf/__init__.py index 5197c5f..5db4ee1 100644 --- a/fabric_cf/__init__.py +++ b/fabric_cf/__init__.py @@ -1 +1 @@ -__version__ = "1.5.2" +__version__ = "1.6.0b3" diff --git a/fabric_cf/orchestrator/orchestrator_proxy.py b/fabric_cf/orchestrator/orchestrator_proxy.py index c9717b7..f479796 100644 --- a/fabric_cf/orchestrator/orchestrator_proxy.py +++ b/fabric_cf/orchestrator/orchestrator_proxy.py @@ -467,7 +467,7 @@ def renew(self, *, token: str, slice_id: str, return Status.FAILURE, e def poa(self, *, token: str, sliver_id: str, operation: str, vcpu_cpu_map: List[Dict[str, str]] = None, - node_set: List[str] = None) -> Tuple[Status, Union[Exception, List[PoaData]]]: + node_set: List[str] = None, keys: List[Dict[str, str]]) -> Tuple[Status, Union[Exception, List[PoaData]]]: """ Modify a slice @param token fabric token @@ -475,6 +475,7 @@ def poa(self, *, token: str, sliver_id: str, operation: str, vcpu_cpu_map: List[ @param operation POA operation @param vcpu_cpu_map vCPU to physical CPU Map @param node_set List of Numa nodes + @param keys list of keys to add/remove @return Tuple containing Status and Exception/Json containing poa info created """ if token is None: @@ -489,10 +490,11 @@ def poa(self, *, token: str, sliver_id: str, operation: str, vcpu_cpu_map: List[ self.__set_tokens(token=token) body = PoaPost(operation=operation) - if vcpu_cpu_map is not None or node_set is not None: + if vcpu_cpu_map is not None or node_set is not None or keys is not None: post_data = PoaPostData() post_data.vcpu_cpu_map = vcpu_cpu_map post_data.node_set = node_set + post_data.keys = keys body.data = post_data poa_data = self.poas_api.poas_create_sliver_id_post(sliver_id=sliver_id, body=body) diff --git a/fabric_cf/orchestrator/swagger_client/__init__.py b/fabric_cf/orchestrator/swagger_client/__init__.py index 9e93aa4..0894b55 100644 --- a/fabric_cf/orchestrator/swagger_client/__init__.py +++ b/fabric_cf/orchestrator/swagger_client/__init__.py @@ -28,6 +28,7 @@ from fabric_cf.orchestrator.swagger_client.models.poa_data import PoaData from fabric_cf.orchestrator.swagger_client.models.poa_post import PoaPost from fabric_cf.orchestrator.swagger_client.models.poa_post_data import PoaPostData +from fabric_cf.orchestrator.swagger_client.models.poa_post_data_keys import PoaPostDataKeys from fabric_cf.orchestrator.swagger_client.models.poa_post_data_vcpu_cpu_map import PoaPostDataVcpuCpuMap from fabric_cf.orchestrator.swagger_client.models.resource import Resource from fabric_cf.orchestrator.swagger_client.models.resources import Resources diff --git a/fabric_cf/orchestrator/swagger_client/api/poas_api.py b/fabric_cf/orchestrator/swagger_client/api/poas_api.py index c286837..f5b0a21 100644 --- a/fabric_cf/orchestrator/swagger_client/api/poas_api.py +++ b/fabric_cf/orchestrator/swagger_client/api/poas_api.py @@ -35,7 +35,7 @@ def __init__(self, api_client=None): def poas_create_sliver_id_post(self, body, sliver_id, **kwargs): # noqa: E501 """Perform an operational action on a sliver. # noqa: E501 - Request to perform an operation action on a sliver. Supported actions include - reboot a VM sliver, get cpu info, get numa info, pin vCPUs, pin memory to a numa node etc. # noqa: E501 + Request to perform an operation action on a sliver. Supported actions include - reboot a VM sliver, get cpu info, get numa info, pin vCPUs, pin memory to a numa node etc, add/remove ssh keys. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.poas_create_sliver_id_post(body, sliver_id, async_req=True) @@ -58,7 +58,7 @@ def poas_create_sliver_id_post(self, body, sliver_id, **kwargs): # noqa: E501 def poas_create_sliver_id_post_with_http_info(self, body, sliver_id, **kwargs): # noqa: E501 """Perform an operational action on a sliver. # noqa: E501 - Request to perform an operation action on a sliver. Supported actions include - reboot a VM sliver, get cpu info, get numa info, pin vCPUs, pin memory to a numa node etc. # noqa: E501 + Request to perform an operation action on a sliver. Supported actions include - reboot a VM sliver, get cpu info, get numa info, pin vCPUs, pin memory to a numa node etc, add/remove ssh keys. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.poas_create_sliver_id_post_with_http_info(body, sliver_id, async_req=True) diff --git a/fabric_cf/orchestrator/swagger_client/models/poa_post.py b/fabric_cf/orchestrator/swagger_client/models/poa_post.py index 564e906..2eb771a 100644 --- a/fabric_cf/orchestrator/swagger_client/models/poa_post.py +++ b/fabric_cf/orchestrator/swagger_client/models/poa_post.py @@ -66,7 +66,7 @@ def operation(self, operation): """ if operation is None: raise ValueError("Invalid value for `operation`, must not be `None`") # noqa: E501 - allowed_values = ["cpuinfo", "numainfo", "cpupin", "numatune", "reboot"] # noqa: E501 + allowed_values = ["cpuinfo", "numainfo", "cpupin", "numatune", "reboot", "addkey", "removekey"] # noqa: E501 if operation not in allowed_values: raise ValueError( "Invalid value for `operation` ({0}), must be one of {1}" # noqa: E501 diff --git a/fabric_cf/orchestrator/swagger_client/models/poa_post_data.py b/fabric_cf/orchestrator/swagger_client/models/poa_post_data.py index 8a120bb..b6c7099 100644 --- a/fabric_cf/orchestrator/swagger_client/models/poa_post_data.py +++ b/fabric_cf/orchestrator/swagger_client/models/poa_post_data.py @@ -29,23 +29,28 @@ class PoaPostData(object): """ swagger_types = { 'vcpu_cpu_map': 'list[PoaPostDataVcpuCpuMap]', - 'node_set': 'list[str]' + 'node_set': 'list[str]', + 'keys': 'list[PoaPostDataKeys]' } attribute_map = { 'vcpu_cpu_map': 'vcpu_cpu_map', - 'node_set': 'node_set' + 'node_set': 'node_set', + 'keys': 'keys' } - def __init__(self, vcpu_cpu_map=None, node_set=None): # noqa: E501 + def __init__(self, vcpu_cpu_map=None, node_set=None, keys=None): # noqa: E501 """PoaPostData - a model defined in Swagger""" # noqa: E501 self._vcpu_cpu_map = None self._node_set = None + self._keys = None self.discriminator = None if vcpu_cpu_map is not None: self.vcpu_cpu_map = vcpu_cpu_map if node_set is not None: self.node_set = node_set + if keys is not None: + self.keys = keys @property def vcpu_cpu_map(self): @@ -89,6 +94,27 @@ def node_set(self, node_set): self._node_set = node_set + @property + def keys(self): + """Gets the keys of this PoaPostData. # noqa: E501 + + + :return: The keys of this PoaPostData. # noqa: E501 + :rtype: list[PoaPostDataKeys] + """ + return self._keys + + @keys.setter + def keys(self, keys): + """Sets the keys of this PoaPostData. + + + :param keys: The keys of this PoaPostData. # noqa: E501 + :type: list[PoaPostDataKeys] + """ + + self._keys = keys + def to_dict(self): """Returns the model properties as a dict""" result = {} diff --git a/fabric_cf/orchestrator/swagger_client/models/poa_post_data_keys.py b/fabric_cf/orchestrator/swagger_client/models/poa_post_data_keys.py new file mode 100644 index 0000000..e9ca198 --- /dev/null +++ b/fabric_cf/orchestrator/swagger_client/models/poa_post_data_keys.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Fabric Orchestrator API + + This is Fabric Orchestrator API # noqa: E501 + + OpenAPI spec version: 1.0.1 + Contact: kthare10@unc.edu + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + +import pprint +import re # noqa: F401 + +import six + +class PoaPostDataKeys(object): + """NOTE: This class is auto generated by the swagger code generator program. + + Do not edit the class manually. + """ + """ + Attributes: + swagger_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + swagger_types = { + 'key': 'str', + 'comment': 'str' + } + + attribute_map = { + 'key': 'key', + 'comment': 'comment' + } + + def __init__(self, key=None, comment=None): # noqa: E501 + """PoaPostDataKeys - a model defined in Swagger""" # noqa: E501 + self._key = None + self._comment = None + self.discriminator = None + self.key = key + self.comment = comment + + @property + def key(self): + """Gets the key of this PoaPostDataKeys. # noqa: E501 + + + :return: The key of this PoaPostDataKeys. # noqa: E501 + :rtype: str + """ + return self._key + + @key.setter + def key(self, key): + """Sets the key of this PoaPostDataKeys. + + + :param key: The key of this PoaPostDataKeys. # noqa: E501 + :type: str + """ + if key is None: + raise ValueError("Invalid value for `key`, must not be `None`") # noqa: E501 + + self._key = key + + @property + def comment(self): + """Gets the comment of this PoaPostDataKeys. # noqa: E501 + + + :return: The comment of this PoaPostDataKeys. # noqa: E501 + :rtype: str + """ + return self._comment + + @comment.setter + def comment(self, comment): + """Sets the comment of this PoaPostDataKeys. + + + :param comment: The comment of this PoaPostDataKeys. # noqa: E501 + :type: str + """ + if comment is None: + raise ValueError("Invalid value for `comment`, must not be `None`") # noqa: E501 + + self._comment = comment + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + if issubclass(PoaPostDataKeys, dict): + for key, value in self.items(): + result[key] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, PoaPostDataKeys): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other diff --git a/fabric_cf/orchestrator/swagger_client/models/poa_post_data_vcpu_cpu_map.py b/fabric_cf/orchestrator/swagger_client/models/poa_post_data_vcpu_cpu_map.py index e936ec4..d03ecfb 100644 --- a/fabric_cf/orchestrator/swagger_client/models/poa_post_data_vcpu_cpu_map.py +++ b/fabric_cf/orchestrator/swagger_client/models/poa_post_data_vcpu_cpu_map.py @@ -42,10 +42,8 @@ def __init__(self, vcpu=None, cpu=None): # noqa: E501 self._vcpu = None self._cpu = None self.discriminator = None - if vcpu is not None: - self.vcpu = vcpu - if cpu is not None: - self.cpu = cpu + self.vcpu = vcpu + self.cpu = cpu @property def vcpu(self): @@ -65,6 +63,8 @@ def vcpu(self, vcpu): :param vcpu: The vcpu of this PoaPostDataVcpuCpuMap. # noqa: E501 :type: str """ + if vcpu is None: + raise ValueError("Invalid value for `vcpu`, must not be `None`") # noqa: E501 self._vcpu = vcpu @@ -86,6 +86,8 @@ def cpu(self, cpu): :param cpu: The cpu of this PoaPostDataVcpuCpuMap. # noqa: E501 :type: str """ + if cpu is None: + raise ValueError("Invalid value for `cpu`, must not be `None`") # noqa: E501 self._cpu = cpu