From 6dd33d2dca8663d65d00c4e5694bfa11abbb5d22 Mon Sep 17 00:00:00 2001 From: JACK SARTORE Date: Thu, 23 Mar 2023 17:37:37 -0400 Subject: [PATCH 1/8] feat(oneOf): addeed type support for secret data types (#9) * feat(oneOf): addeed type support for secret data types BREAKING CHANGE: new classes for each secret data type added * test fix * test fix * added more secret examples * updated to latest openAPI, added oneOf for secret updates * udpated timeout on int test * increase timeout * adjust timeout * removed retries * set retries to 0 * udpated retry interval * sleep adjust * removed loop, depending on python retry * increased project sleep to 2 minutes before trying get * moved sleep * fixed timestamp name, will removed security alerts --- Makefile | 14 +- examples/test_code_engine_v2_examples.py | 10 +- ibm_code_engine_sdk/code_engine_v2.py | 1366 ++++++++++++++-------- pylint.sh | 2 +- test/integration/test_v2.py | 243 +++- test/unit/test_code_engine_v2.py | 588 +++++----- 6 files changed, 1376 insertions(+), 847 deletions(-) diff --git a/Makefile b/Makefile index 45ca62d..2b349d4 100644 --- a/Makefile +++ b/Makefile @@ -9,27 +9,27 @@ all: upgrade_pip setup test-unit lint ci: setup test-unit lint upgrade_pip: - python -m pip install --upgrade pip + python3 -m pip install --upgrade pip deps: - python -m pip install -r requirements.txt + python3 -m pip install -r requirements.txt dev_deps: - python -m pip install -r requirements-dev.txt + python3 -m pip install -r requirements-dev.txt install_project: - python -m pip install -e . + python3 -m pip install -e . test: test-unit test-int test-unit: - python -m pytest --cov=ibm_code_engine_sdk test/unit + python3 -m pytest --cov=ibm_code_engine_sdk test/unit test-int: - python -m pytest test/integration + python3 -m pytest test/integration test-examples: - python -m pytest example + python3 -m pytest example lint: ./pylint.sh && black --check . diff --git a/examples/test_code_engine_v2_examples.py b/examples/test_code_engine_v2_examples.py index 72e3033..69151ec 100644 --- a/examples/test_code_engine_v2_examples.py +++ b/examples/test_code_engine_v2_examples.py @@ -277,7 +277,7 @@ def test_get_app_revision_example(self): response = code_engine_service.get_app_revision( project_id='15314cc3-85b4-4338-903f-c28cdee6d005', app_name='my-app', - name='my-app-001', + name='my-app-00001', ) app_revision = response.get_result() @@ -444,7 +444,7 @@ def test_get_job_run_example(self): response = code_engine_service.get_job_run( project_id='15314cc3-85b4-4338-903f-c28cdee6d005', - name='my-job', + name='my-job-run', ) job_run = response.get_result() @@ -662,7 +662,7 @@ def test_create_config_map_example(self): response = code_engine_service.create_config_map( project_id='15314cc3-85b4-4338-903f-c28cdee6d005', - name='my-configmap', + name='my-config-map', ) config_map = response.get_result() @@ -860,7 +860,7 @@ def test_delete_app_revision_example(self): response = code_engine_service.delete_app_revision( project_id='15314cc3-85b4-4338-903f-c28cdee6d005', app_name='my-app', - name='my-app-001', + name='my-app-00001', ) # end-delete_app_revision @@ -898,7 +898,7 @@ def test_delete_job_run_example(self): response = code_engine_service.delete_job_run( project_id='15314cc3-85b4-4338-903f-c28cdee6d005', - name='my-job', + name='my-job-run', ) # end-delete_job_run diff --git a/ibm_code_engine_sdk/code_engine_v2.py b/ibm_code_engine_sdk/code_engine_v2.py index f9f5b1b..b21125e 100644 --- a/ibm_code_engine_sdk/code_engine_v2.py +++ b/ibm_code_engine_sdk/code_engine_v2.py @@ -796,7 +796,8 @@ def create_job( private registry when you download the container image. If the image reference points to a registry that requires authentication, the job / job runs will be created but submitted job runs will fail, until this property - is provided, too. + is provided, too. This property must not be set on a job run, which + references a job template. :param List[str] run_arguments: (optional) Set arguments for the job that are passed to start job run containers. If not specified an empty string array will be applied and the arguments specified by the container image, @@ -811,12 +812,13 @@ def create_job( references to config maps, secrets or a literal values. :param str run_mode: (optional) The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `max_execution_time` and - `retry_limit` options apply. In `daemon` mode, since there is no timeout + `retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `max_execution_time` - and `retry_limit` options are not allowed. + and `retry_limit` properties are not allowed. :param str run_service_account: (optional) The name of the service account. For built-in service accounts, you can use the shortened names `manager`, - `none`, `reader`, and `writer`. + `none`, `reader`, and `writer`. This property must not be set on a job run, + which references a job template. :param List[VolumeMountPrototype] run_volume_mounts: (optional) Optional mounts of config maps or a secrets. :param str scale_array_spec: (optional) Define a custom set of array @@ -835,8 +837,8 @@ def create_job( information see [Units of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :param int scale_max_execution_time: (optional) The maximum execution time - in seconds for runs of the job. This option can only be specified if `mode` - is `task`. + in seconds for runs of the job. This property can only be specified if + `run_mode` is `task`. :param str scale_memory_limit: (optional) Optional amount of memory set for the instance of the job. For valid values see [Supported memory and CPU combinations](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo). @@ -845,8 +847,8 @@ def create_job( [Units of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :param int scale_retry_limit: (optional) The number of times to rerun an - instance of the job before the job is marked as failed. This option can - only be specified if `mode` is `task`. + instance of the job before the job is marked as failed. This property can + only be specified if `run_mode` is `task`. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `Job` object @@ -1120,7 +1122,8 @@ def create_job_run( private registry when you download the container image. If the image reference points to a registry that requires authentication, the job / job runs will be created but submitted job runs will fail, until this property - is provided, too. + is provided, too. This property must not be set on a job run, which + references a job template. :param str job_name: (optional) Optional name of the job on which this job run is based on. If specified, the job run will inherit the configuration of the referenced job. @@ -1140,12 +1143,13 @@ def create_job_run( references to config maps, secrets or a literal values. :param str run_mode: (optional) The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `max_execution_time` and - `retry_limit` options apply. In `daemon` mode, since there is no timeout + `retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `max_execution_time` - and `retry_limit` options are not allowed. + and `retry_limit` properties are not allowed. :param str run_service_account: (optional) The name of the service account. For built-in service accounts, you can use the shortened names `manager`, - `none`, `reader`, and `writer`. + `none`, `reader`, and `writer`. This property must not be set on a job run, + which references a job template. :param List[VolumeMountPrototype] run_volume_mounts: (optional) Optional mounts of config maps or a secrets. :param str scale_array_spec: (optional) Define a custom set of array @@ -1164,8 +1168,8 @@ def create_job_run( information see [Units of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :param int scale_max_execution_time: (optional) The maximum execution time - in seconds for runs of the job. This option can only be specified if `mode` - is `task`. + in seconds for runs of the job. This property can only be specified if + `run_mode` is `task`. :param str scale_memory_limit: (optional) Optional amount of memory set for the instance of the job. For valid values see [Supported memory and CPU combinations](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo). @@ -1174,8 +1178,8 @@ def create_job_run( [Units of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :param int scale_retry_limit: (optional) The number of times to rerun an - instance of the job before the job is marked as failed. This option can - only be specified if `mode` is `task`. + instance of the job before the job is marked as failed. This property can + only be specified if `run_mode` is `task`. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `JobRun` object @@ -2118,7 +2122,7 @@ def list_secrets(self, project_id: str, *, limit: int = None, start: str = None, return response def create_secret( - self, project_id: str, format: str, name: str, *, data: dict = None, **kwargs + self, project_id: str, format: str, name: str, *, data: 'SecretData' = None, **kwargs ) -> DetailedResponse: """ Create a secret. @@ -2128,11 +2132,11 @@ def create_secret( :param str project_id: The ID of the project. :param str format: Specify the format of the secret. :param str name: The name of the secret. - :param dict data: (optional) Data container that allows to specify config - parameters and their values as a key-value map. Each key field must consist - of alphanumeric characters, `-`, `_` or `.` and must not be exceed a max - length of 253 characters. Each value field can consists of any character - and must not be exceed a max length of 1048576 characters. + :param SecretData data: (optional) Data container that allows to specify + config parameters and their values as a key-value map. Each key field must + consist of alphanumeric characters, `-`, `_` or `.` and must not be exceed + a max length of 253 characters. Each value field can consists of any + character and must not be exceed a max length of 1048576 characters. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `Secret` object @@ -2144,6 +2148,8 @@ def create_secret( raise ValueError('format must be provided') if name is None: raise ValueError('name must be provided') + if data is not None: + data = convert_model(data) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='create_secret' @@ -2211,7 +2217,7 @@ def get_secret(self, project_id: str, name: str, **kwargs) -> DetailedResponse: return response def replace_secret( - self, project_id: str, name: str, if_match: str, *, data: dict = None, format: str = None, **kwargs + self, project_id: str, name: str, if_match: str, *, data: 'SecretData' = None, format: str = None, **kwargs ) -> DetailedResponse: """ Update a secret. @@ -2225,11 +2231,11 @@ def replace_secret( secret. This value helps identifying parallel usage of this API. Pass * to indicate to update any version available. This might result in stale updates. - :param dict data: (optional) Data container that allows to specify config - parameters and their values as a key-value map. Each key field must consist - of alphanumeric characters, `-`, `_` or `.` and must not be exceed a max - length of 253 characters. Each value field can consists of any character - and must not be exceed a max length of 1048576 characters. + :param SecretData data: (optional) Data container that allows to specify + config parameters and their values as a key-value map. Each key field must + consist of alphanumeric characters, `-`, `_` or `.` and must not be exceed + a max length of 253 characters. Each value field can consists of any + character and must not be exceed a max length of 1048576 characters. :param str format: (optional) Specify the format of the secret. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. @@ -2242,6 +2248,8 @@ def replace_secret( raise ValueError('name must be provided') if not if_match: raise ValueError('if_match must be provided') + if data is not None: + data = convert_model(data) headers = { 'If-Match': if_match, } @@ -2318,17 +2326,17 @@ class App: """ App is the response model for app resources. - :attr str created_at: The date when the resource was created. + :attr str created_at: (optional) The date when the resource was created. :attr str endpoint: (optional) Optional URL to invoke app. Depending on visibility this is accessible publicly ot in the private network only. Empty in case 'managed_domain_mappings' is set to 'local'. :attr str endpoint_internal: (optional) URL to app that is only visible within the project. - :attr str entity_tag: The version of the job instance, which is used to achieve + :attr str entity_tag: The version of the app instance, which is used to achieve optimistic locking. - :attr str href: When you provision a new app, a URL is created identifying the - location of the instance. - :attr str id: The identifier of the resource. + :attr str href: (optional) When you provision a new app, a URL is created + identifying the location of the instance. + :attr str id: (optional) The identifier of the resource. :attr int image_port: (optional) Optional port the app listens on. While the app will always be exposed via port `443` for end users, this port is used to connect to the port that is exposed by the container image. @@ -2348,8 +2356,9 @@ class App: are 'local_public', 'local_private' and 'local'. Visibility can only be 'local_private' if the project supports application private visibility. :attr str name: The name of the app. - :attr str project_id: The ID of the project the resource is located in. - :attr str resource_type: The type of the app. + :attr str project_id: (optional) The ID of the project the resource is located + in. + :attr str resource_type: (optional) The type of the app. :attr List[str] run_arguments: Optional arguments for the app that are passed to start the container. If not specified an empty string array will be applied and the arguments specified by the container image, will be used to start the @@ -2401,22 +2410,17 @@ class App: by any request for some time. :attr int scale_request_timeout: Optional amount of time in seconds that is allowed for a running app to respond to a request. - :attr str status: The current status of the app. + :attr str status: (optional) The current status of the app. :attr AppStatus status_details: (optional) The detailed status of the application. """ def __init__( self, - created_at: str, entity_tag: str, - href: str, - id: str, image_reference: str, managed_domain_mappings: str, name: str, - project_id: str, - resource_type: str, run_arguments: List[str], run_commands: List[str], run_env_variables: List['EnvVar'], @@ -2427,28 +2431,29 @@ def __init__( scale_memory_limit: str, scale_min_instances: int, scale_request_timeout: int, - status: str, *, + created_at: str = None, endpoint: str = None, endpoint_internal: str = None, + href: str = None, + id: str = None, image_port: int = None, image_secret: str = None, + project_id: str = None, + resource_type: str = None, run_as_user: int = None, run_service_account: str = None, scale_concurrency: int = None, scale_concurrency_target: int = None, scale_initial_instances: int = None, + status: str = None, status_details: 'AppStatus' = None, ) -> None: """ Initialize a App object. - :param str created_at: The date when the resource was created. - :param str entity_tag: The version of the job instance, which is used to + :param str entity_tag: The version of the app instance, which is used to achieve optimistic locking. - :param str href: When you provision a new app, a URL is created - identifying the location of the instance. - :param str id: The identifier of the resource. :param str image_reference: The name of the image that is used for this job. The format is `REGISTRY/NAMESPACE/REPOSITORY:TAG` where `REGISTRY` and `TAG` are optional. If `REGISTRY` is not specified, the default is @@ -2460,8 +2465,6 @@ def __init__( values are 'local_public', 'local_private' and 'local'. Visibility can only be 'local_private' if the project supports application private visibility. :param str name: The name of the app. - :param str project_id: The ID of the project the resource is located in. - :param str resource_type: The type of the app. :param List[str] run_arguments: Optional arguments for the app that are passed to start the container. If not specified an empty string array will be applied and the arguments specified by the container image, will be used @@ -2502,12 +2505,6 @@ def __init__( not hit by any request for some time. :param int scale_request_timeout: Optional amount of time in seconds that is allowed for a running app to respond to a request. - :param str status: The current status of the app. - :param str endpoint: (optional) Optional URL to invoke app. Depending on - visibility this is accessible publicly ot in the private network only. - Empty in case 'managed_domain_mappings' is set to 'local'. - :param str endpoint_internal: (optional) URL to app that is only visible - within the project. :param int image_port: (optional) Optional port the app listens on. While the app will always be exposed via port `443` for end users, this port is used to connect to the port that is exposed by the container image. @@ -2571,8 +2568,6 @@ def from_dict(cls, _dict: Dict) -> 'App': args = {} if 'created_at' in _dict: args['created_at'] = _dict.get('created_at') - else: - raise ValueError('Required property \'created_at\' not present in App JSON') if 'endpoint' in _dict: args['endpoint'] = _dict.get('endpoint') if 'endpoint_internal' in _dict: @@ -2583,12 +2578,8 @@ def from_dict(cls, _dict: Dict) -> 'App': raise ValueError('Required property \'entity_tag\' not present in App JSON') if 'href' in _dict: args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in App JSON') if 'id' in _dict: args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in App JSON') if 'image_port' in _dict: args['image_port'] = _dict.get('image_port') if 'image_reference' in _dict: @@ -2607,12 +2598,8 @@ def from_dict(cls, _dict: Dict) -> 'App': raise ValueError('Required property \'name\' not present in App JSON') if 'project_id' in _dict: args['project_id'] = _dict.get('project_id') - else: - raise ValueError('Required property \'project_id\' not present in App JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in App JSON') if 'run_arguments' in _dict: args['run_arguments'] = _dict.get('run_arguments') else: @@ -2665,8 +2652,6 @@ def from_dict(cls, _dict: Dict) -> 'App': raise ValueError('Required property \'scale_request_timeout\' not present in App JSON') if 'status' in _dict: args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in App JSON') if 'status_details' in _dict: args['status_details'] = AppStatus.from_dict(_dict.get('status_details')) return cls(**args) @@ -2679,18 +2664,18 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = self.created_at - if hasattr(self, 'endpoint') and self.endpoint is not None: - _dict['endpoint'] = self.endpoint - if hasattr(self, 'endpoint_internal') and self.endpoint_internal is not None: - _dict['endpoint_internal'] = self.endpoint_internal + if hasattr(self, 'created_at') and getattr(self, 'created_at') is not None: + _dict['created_at'] = getattr(self, 'created_at') + if hasattr(self, 'endpoint') and getattr(self, 'endpoint') is not None: + _dict['endpoint'] = getattr(self, 'endpoint') + if hasattr(self, 'endpoint_internal') and getattr(self, 'endpoint_internal') is not None: + _dict['endpoint_internal'] = getattr(self, 'endpoint_internal') if hasattr(self, 'entity_tag') and self.entity_tag is not None: _dict['entity_tag'] = self.entity_tag - 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, 'href') and getattr(self, 'href') is not None: + _dict['href'] = getattr(self, 'href') + if hasattr(self, 'id') and getattr(self, 'id') is not None: + _dict['id'] = getattr(self, 'id') if hasattr(self, 'image_port') and self.image_port is not None: _dict['image_port'] = self.image_port if hasattr(self, 'image_reference') and self.image_reference is not None: @@ -2701,10 +2686,10 @@ def to_dict(self) -> Dict: _dict['managed_domain_mappings'] = self.managed_domain_mappings if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'project_id') and self.project_id is not None: - _dict['project_id'] = self.project_id - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'project_id') and getattr(self, 'project_id') is not None: + _dict['project_id'] = getattr(self, 'project_id') + if hasattr(self, 'resource_type') and getattr(self, 'resource_type') is not None: + _dict['resource_type'] = getattr(self, 'resource_type') if hasattr(self, 'run_arguments') and self.run_arguments is not None: _dict['run_arguments'] = self.run_arguments if hasattr(self, 'run_as_user') and self.run_as_user is not None: @@ -2747,8 +2732,8 @@ def to_dict(self) -> Dict: _dict['scale_min_instances'] = self.scale_min_instances if hasattr(self, 'scale_request_timeout') and self.scale_request_timeout is not None: _dict['scale_request_timeout'] = self.scale_request_timeout - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status + if hasattr(self, 'status') and getattr(self, 'status') is not None: + _dict['status'] = getattr(self, 'status') if hasattr(self, 'status_details') and self.status_details is not None: if isinstance(self.status_details, dict): _dict['status_details'] = self.status_details @@ -3263,10 +3248,10 @@ class AppRevision: AppRevision is the response model for app revision resources. :attr str app_name: (optional) Name of the associated app. - :attr str created_at: The date when the resource was created. - :attr str href: When you provision a new revision, a URL is created identifying - the location of the instance. - :attr str id: The identifier of the resource. + :attr str created_at: (optional) The date when the resource was created. + :attr str href: (optional) When you provision a new revision, a URL is created + identifying the location of the instance. + :attr str id: (optional) The identifier of the resource. :attr int image_port: (optional) Optional port the app listens on. While the app will always be exposed via port `443` for end users, this port is used to connect to the port that is exposed by the container image. @@ -3281,9 +3266,10 @@ class AppRevision: registry when you download the container image. If the image reference points to a registry that requires authentication, the app will be created but cannot reach the ready status, until this property is provided, too. - :attr str name: The name of the app revison. - :attr str project_id: The ID of the project the resource is located in. - :attr str resource_type: The type of the app revision. + :attr str name: (optional) The name of the app revison. + :attr str project_id: (optional) The ID of the project the resource is located + in. + :attr str resource_type: (optional) The type of the app revision. :attr List[str] run_arguments: Optional arguments for the app that are passed to start the container. If not specified an empty string array will be applied and the arguments specified by the container image, will be used to start the @@ -3335,20 +3321,14 @@ class AppRevision: by any request for some time. :attr int scale_request_timeout: Optional amount of time in seconds that is allowed for a running app to respond to a request. - :attr str status: The current status of the app revision. + :attr str status: (optional) The current status of the app revision. :attr AppRevisionStatus status_details: (optional) The detailed status of the application revision. """ def __init__( self, - created_at: str, - href: str, - id: str, image_reference: str, - name: str, - project_id: str, - resource_type: str, run_arguments: List[str], run_commands: List[str], run_env_variables: List['EnvVar'], @@ -3359,34 +3339,33 @@ def __init__( scale_memory_limit: str, scale_min_instances: int, scale_request_timeout: int, - status: str, *, app_name: str = None, + created_at: str = None, + href: str = None, + id: str = None, image_port: int = None, image_secret: str = None, + name: str = None, + project_id: str = None, + resource_type: str = None, run_as_user: int = None, run_service_account: str = None, scale_concurrency: int = None, scale_concurrency_target: int = None, scale_initial_instances: int = None, + status: str = None, status_details: 'AppRevisionStatus' = None, ) -> None: """ Initialize a AppRevision object. - :param str created_at: The date when the resource was created. - :param str href: When you provision a new revision, a URL is created - identifying the location of the instance. - :param str id: The identifier of the resource. :param str image_reference: The name of the image that is used for this job. The format is `REGISTRY/NAMESPACE/REPOSITORY:TAG` where `REGISTRY` and `TAG` are optional. If `REGISTRY` is not specified, the default is `docker.io`. If `TAG` is not specified, the default is `latest`. If the image reference points to a registry that requires authentication, make sure to also specify the property `image_secret`. - :param str name: The name of the app revison. - :param str project_id: The ID of the project the resource is located in. - :param str resource_type: The type of the app revision. :param List[str] run_arguments: Optional arguments for the app that are passed to start the container. If not specified an empty string array will be applied and the arguments specified by the container image, will be used @@ -3427,7 +3406,6 @@ def __init__( not hit by any request for some time. :param int scale_request_timeout: Optional amount of time in seconds that is allowed for a running app to respond to a request. - :param str status: The current status of the app revision. :param str app_name: (optional) Name of the associated app. :param int image_port: (optional) Optional port the app listens on. While the app will always be exposed via port `443` for end users, this port is @@ -3491,16 +3469,10 @@ def from_dict(cls, _dict: Dict) -> 'AppRevision': args['app_name'] = _dict.get('app_name') if 'created_at' in _dict: args['created_at'] = _dict.get('created_at') - else: - raise ValueError('Required property \'created_at\' not present in AppRevision JSON') if 'href' in _dict: args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in AppRevision JSON') if 'id' in _dict: args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in AppRevision JSON') if 'image_port' in _dict: args['image_port'] = _dict.get('image_port') if 'image_reference' in _dict: @@ -3511,16 +3483,10 @@ def from_dict(cls, _dict: Dict) -> 'AppRevision': args['image_secret'] = _dict.get('image_secret') if 'name' in _dict: args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in AppRevision JSON') if 'project_id' in _dict: args['project_id'] = _dict.get('project_id') - else: - raise ValueError('Required property \'project_id\' not present in AppRevision JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in AppRevision JSON') if 'run_arguments' in _dict: args['run_arguments'] = _dict.get('run_arguments') else: @@ -3573,8 +3539,6 @@ def from_dict(cls, _dict: Dict) -> 'AppRevision': raise ValueError('Required property \'scale_request_timeout\' not present in AppRevision JSON') if 'status' in _dict: args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in AppRevision JSON') if 'status_details' in _dict: args['status_details'] = AppRevisionStatus.from_dict(_dict.get('status_details')) return cls(**args) @@ -3589,24 +3553,24 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'app_name') and self.app_name is not None: _dict['app_name'] = self.app_name - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = self.created_at - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'created_at') and getattr(self, 'created_at') is not None: + _dict['created_at'] = getattr(self, 'created_at') + if hasattr(self, 'href') and getattr(self, 'href') is not None: + _dict['href'] = getattr(self, 'href') + if hasattr(self, 'id') and getattr(self, 'id') is not None: + _dict['id'] = getattr(self, 'id') if hasattr(self, 'image_port') and self.image_port is not None: _dict['image_port'] = self.image_port if hasattr(self, 'image_reference') and self.image_reference is not None: _dict['image_reference'] = self.image_reference if hasattr(self, 'image_secret') and self.image_secret is not None: _dict['image_secret'] = self.image_secret - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'project_id') and self.project_id is not None: - _dict['project_id'] = self.project_id - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'name') and getattr(self, 'name') is not None: + _dict['name'] = getattr(self, 'name') + if hasattr(self, 'project_id') and getattr(self, 'project_id') is not None: + _dict['project_id'] = getattr(self, 'project_id') + if hasattr(self, 'resource_type') and getattr(self, 'resource_type') is not None: + _dict['resource_type'] = getattr(self, 'resource_type') if hasattr(self, 'run_arguments') and self.run_arguments is not None: _dict['run_arguments'] = self.run_arguments if hasattr(self, 'run_as_user') and self.run_as_user is not None: @@ -3649,8 +3613,8 @@ def to_dict(self) -> Dict: _dict['scale_min_instances'] = self.scale_min_instances if hasattr(self, 'scale_request_timeout') and self.scale_request_timeout is not None: _dict['scale_request_timeout'] = self.scale_request_timeout - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status + if hasattr(self, 'status') and getattr(self, 'status') is not None: + _dict['status'] = getattr(self, 'status') if hasattr(self, 'status_details') and self.status_details is not None: if isinstance(self.status_details, dict): _dict['status_details'] = self.status_details @@ -3822,10 +3786,6 @@ def __init__(self, *, actual_instances: int = None, reason: str = None) -> None: """ Initialize a AppRevisionStatus object. - :param int actual_instances: (optional) The number of running instances of - the revision. - :param str reason: (optional) Optional information to provide more context - in case of a 'failed' or 'warning' status. """ self.actual_instances = actual_instances self.reason = reason @@ -3848,10 +3808,10 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'actual_instances') and self.actual_instances is not None: - _dict['actual_instances'] = self.actual_instances - if hasattr(self, 'reason') and self.reason is not None: - _dict['reason'] = self.reason + if hasattr(self, 'actual_instances') and getattr(self, 'actual_instances') is not None: + _dict['actual_instances'] = getattr(self, 'actual_instances') + if hasattr(self, 'reason') and getattr(self, 'reason') is not None: + _dict['reason'] = getattr(self, 'reason') return _dict def _to_dict(self): @@ -3915,12 +3875,6 @@ def __init__( """ Initialize a AppStatus object. - :param str latest_created_revision: (optional) Latest app revision that has - been created. - :param str latest_ready_revision: (optional) Latest app revision that - reached a ready state. - :param str reason: (optional) Optional information to provide more context - in case of a 'failed' or 'warning' status. """ self.latest_created_revision = latest_created_revision self.latest_ready_revision = latest_ready_revision @@ -3946,12 +3900,12 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'latest_created_revision') and self.latest_created_revision is not None: - _dict['latest_created_revision'] = self.latest_created_revision - if hasattr(self, 'latest_ready_revision') and self.latest_ready_revision is not None: - _dict['latest_ready_revision'] = self.latest_ready_revision - if hasattr(self, 'reason') and self.reason is not None: - _dict['reason'] = self.reason + if hasattr(self, 'latest_created_revision') and getattr(self, 'latest_created_revision') is not None: + _dict['latest_created_revision'] = getattr(self, 'latest_created_revision') + if hasattr(self, 'latest_ready_revision') and getattr(self, 'latest_ready_revision') is not None: + _dict['latest_ready_revision'] = getattr(self, 'latest_ready_revision') + if hasattr(self, 'reason') and getattr(self, 'reason') is not None: + _dict['reason'] = getattr(self, 'reason') return _dict def _to_dict(self): @@ -3989,18 +3943,19 @@ class Build: """ Response model for build definitions. - :attr str created_at: The date when the resource was created. + :attr str created_at: (optional) The date when the resource was created. :attr str entity_tag: The version of the build instance, which is used to achieve optimistic locking. :attr str href: (optional) When you provision a new build, a URL is created identifying the location of the instance. - :attr str id: The identifier of the resource. + :attr str id: (optional) The identifier of the resource. :attr str name: (optional) The name of the build. :attr str output_image: The name of the image. :attr str output_secret: The secret that is required to access the image registry. Make sure that the secret is granted with push permissions towards the specified container registry namespace. - :attr str project_id: The ID of the project the resource is located in. + :attr str project_id: (optional) The ID of the project the resource is located + in. :attr str resource_type: (optional) The type of the build. :attr str source_context_dir: (optional) Option directory in the repository that contains the buildpacks file or the Dockerfile. @@ -4038,19 +3993,19 @@ class Build: def __init__( self, - created_at: str, entity_tag: str, - id: str, output_image: str, output_secret: str, - project_id: str, source_type: str, source_url: str, strategy_size: str, strategy_type: str, *, + created_at: str = None, href: str = None, + id: str = None, name: str = None, + project_id: str = None, resource_type: str = None, source_context_dir: str = None, source_revision: str = None, @@ -4063,15 +4018,12 @@ def __init__( """ Initialize a Build object. - :param str created_at: The date when the resource was created. :param str entity_tag: The version of the build instance, which is used to achieve optimistic locking. - :param str id: The identifier of the resource. :param str output_image: The name of the image. :param str output_secret: The secret that is required to access the image registry. Make sure that the secret is granted with push permissions towards the specified container registry namespace. - :param str project_id: The ID of the project the resource is located in. :param str source_type: Specifies the type of source to determine if your build source is in a repository or based on local source code. * local - For builds from local source code. @@ -4088,10 +4040,7 @@ def __init__( amount of resources used. Build sizes are `small`, `medium`, `large`, `xlarge`. :param str strategy_type: The strategy to use for building the image. - :param str href: (optional) When you provision a new build, a URL is - created identifying the location of the instance. :param str name: (optional) The name of the build. - :param str resource_type: (optional) The type of the build. :param str source_context_dir: (optional) Option directory in the repository that contains the buildpacks file or the Dockerfile. :param str source_revision: (optional) Commit, tag, or branch in the source @@ -4104,7 +4053,6 @@ def __init__( requires authentication, the build will be created but cannot access any source code, until this property is provided, too. If the `source_type` value is `local`, this field must be omitted. - :param str status: (optional) The current status of the build. :param BuildStatus status_details: (optional) The detailed status of the build. :param str strategy_spec_file: (optional) Optional path to the @@ -4139,8 +4087,6 @@ def from_dict(cls, _dict: Dict) -> 'Build': args = {} if 'created_at' in _dict: args['created_at'] = _dict.get('created_at') - else: - raise ValueError('Required property \'created_at\' not present in Build JSON') if 'entity_tag' in _dict: args['entity_tag'] = _dict.get('entity_tag') else: @@ -4149,8 +4095,6 @@ def from_dict(cls, _dict: Dict) -> 'Build': args['href'] = _dict.get('href') if 'id' in _dict: args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in Build JSON') if 'name' in _dict: args['name'] = _dict.get('name') if 'output_image' in _dict: @@ -4163,8 +4107,6 @@ def from_dict(cls, _dict: Dict) -> 'Build': raise ValueError('Required property \'output_secret\' not present in Build JSON') if 'project_id' in _dict: args['project_id'] = _dict.get('project_id') - else: - raise ValueError('Required property \'project_id\' not present in Build JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') if 'source_context_dir' in _dict: @@ -4207,24 +4149,24 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = self.created_at + if hasattr(self, 'created_at') and getattr(self, 'created_at') is not None: + _dict['created_at'] = getattr(self, 'created_at') if hasattr(self, 'entity_tag') and self.entity_tag is not None: _dict['entity_tag'] = self.entity_tag - 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, 'href') and getattr(self, 'href') is not None: + _dict['href'] = getattr(self, 'href') + if hasattr(self, 'id') and getattr(self, 'id') is not None: + _dict['id'] = getattr(self, 'id') if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name if hasattr(self, 'output_image') and self.output_image is not None: _dict['output_image'] = self.output_image if hasattr(self, 'output_secret') and self.output_secret is not None: _dict['output_secret'] = self.output_secret - if hasattr(self, 'project_id') and self.project_id is not None: - _dict['project_id'] = self.project_id - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'project_id') and getattr(self, 'project_id') is not None: + _dict['project_id'] = getattr(self, 'project_id') + if hasattr(self, 'resource_type') and getattr(self, 'resource_type') is not None: + _dict['resource_type'] = getattr(self, 'resource_type') if hasattr(self, 'source_context_dir') and self.source_context_dir is not None: _dict['source_context_dir'] = self.source_context_dir if hasattr(self, 'source_revision') and self.source_revision is not None: @@ -4235,8 +4177,8 @@ def to_dict(self) -> Dict: _dict['source_type'] = self.source_type if hasattr(self, 'source_url') and self.source_url is not None: _dict['source_url'] = self.source_url - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status + if hasattr(self, 'status') and getattr(self, 'status') is not None: + _dict['status'] = getattr(self, 'status') if hasattr(self, 'status_details') and self.status_details is not None: if isinstance(self.status_details, dict): _dict['status_details'] = self.status_details @@ -4603,17 +4545,18 @@ class BuildRun: referenced build. If not specified, make sure to specify at least the fields `strategy_type`, `source_url`, `output_image` and `output_secret` to describe the build run. - :attr str created_at: The date when the resource was created. + :attr str created_at: (optional) The date when the resource was created. :attr str href: (optional) When you trigger a new build run, a URL is created identifying the location of the instance. - :attr str id: The identifier of the resource. + :attr str id: (optional) The identifier of the resource. :attr str name: The name of the build run. :attr str output_image: (optional) The name of the image. :attr str output_secret: (optional) The secret that is required to access the image registry. Make sure that the secret is granted with push permissions towards the specified container registry namespace. - :attr str project_id: The ID of the project the resource is located in. - :attr str resource_type: The type of the build run. + :attr str project_id: (optional) The ID of the project the resource is located + in. + :attr str resource_type: (optional) The type of the build run. :attr str service_account: (optional) Optional service account which is used for resource control. :attr str source_context_dir: (optional) Option directory in the repository that @@ -4639,7 +4582,7 @@ class BuildRun: repository requires authentication, you need to provide a 'ssh' URL like `git@github.com:IBM/CodeEngine.git` along with a `source_secret` that points to a secret of format `ssh_auth`. - :attr str status: The current status of the build run. + :attr str status: (optional) The current status of the build run. :attr BuildRunStatus status_details: (optional) Current status condition of a build run. :attr str strategy_size: (optional) Optional size for the build, which @@ -4655,22 +4598,22 @@ class BuildRun: def __init__( self, build_name: str, - created_at: str, - id: str, name: str, - project_id: str, - resource_type: str, - status: str, *, + created_at: str = None, href: str = None, + id: str = None, output_image: str = None, output_secret: str = None, + project_id: str = None, + resource_type: str = None, service_account: str = None, source_context_dir: str = None, source_revision: str = None, source_secret: str = None, source_type: str = None, source_url: str = None, + status: str = None, status_details: 'BuildRunStatus' = None, strategy_size: str = None, strategy_spec_file: str = None, @@ -4685,14 +4628,7 @@ def __init__( the referenced build. If not specified, make sure to specify at least the fields `strategy_type`, `source_url`, `output_image` and `output_secret` to describe the build run. - :param str created_at: The date when the resource was created. - :param str id: The identifier of the resource. :param str name: The name of the build run. - :param str project_id: The ID of the project the resource is located in. - :param str resource_type: The type of the build run. - :param str status: The current status of the build run. - :param str href: (optional) When you trigger a new build run, a URL is - created identifying the location of the instance. :param str output_image: (optional) The name of the image. :param str output_secret: (optional) The secret that is required to access the image registry. Make sure that the secret is granted with push @@ -4768,14 +4704,10 @@ def from_dict(cls, _dict: Dict) -> 'BuildRun': raise ValueError('Required property \'build_name\' not present in BuildRun JSON') if 'created_at' in _dict: args['created_at'] = _dict.get('created_at') - else: - raise ValueError('Required property \'created_at\' not present in BuildRun JSON') if 'href' in _dict: args['href'] = _dict.get('href') if 'id' in _dict: args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in BuildRun JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: @@ -4786,12 +4718,8 @@ def from_dict(cls, _dict: Dict) -> 'BuildRun': args['output_secret'] = _dict.get('output_secret') if 'project_id' in _dict: args['project_id'] = _dict.get('project_id') - else: - raise ValueError('Required property \'project_id\' not present in BuildRun JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in BuildRun JSON') if 'service_account' in _dict: args['service_account'] = _dict.get('service_account') if 'source_context_dir' in _dict: @@ -4806,8 +4734,6 @@ def from_dict(cls, _dict: Dict) -> 'BuildRun': args['source_url'] = _dict.get('source_url') if 'status' in _dict: args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in BuildRun JSON') if 'status_details' in _dict: args['status_details'] = BuildRunStatus.from_dict(_dict.get('status_details')) if 'strategy_size' in _dict: @@ -4830,22 +4756,22 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'build_name') and self.build_name is not None: _dict['build_name'] = self.build_name - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = self.created_at - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'created_at') and getattr(self, 'created_at') is not None: + _dict['created_at'] = getattr(self, 'created_at') + if hasattr(self, 'href') and getattr(self, 'href') is not None: + _dict['href'] = getattr(self, 'href') + if hasattr(self, 'id') and getattr(self, 'id') is not None: + _dict['id'] = getattr(self, 'id') if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name if hasattr(self, 'output_image') and self.output_image is not None: _dict['output_image'] = self.output_image if hasattr(self, 'output_secret') and self.output_secret is not None: _dict['output_secret'] = self.output_secret - if hasattr(self, 'project_id') and self.project_id is not None: - _dict['project_id'] = self.project_id - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'project_id') and getattr(self, 'project_id') is not None: + _dict['project_id'] = getattr(self, 'project_id') + if hasattr(self, 'resource_type') and getattr(self, 'resource_type') is not None: + _dict['resource_type'] = getattr(self, 'resource_type') if hasattr(self, 'service_account') and self.service_account is not None: _dict['service_account'] = self.service_account if hasattr(self, 'source_context_dir') and self.source_context_dir is not None: @@ -4858,8 +4784,8 @@ def to_dict(self) -> Dict: _dict['source_type'] = self.source_type if hasattr(self, 'source_url') and self.source_url is not None: _dict['source_url'] = self.source_url - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status + if hasattr(self, 'status') and getattr(self, 'status') is not None: + _dict['status'] = getattr(self, 'status') if hasattr(self, 'status_details') and self.status_details is not None: if isinstance(self.status_details, dict): _dict['status_details'] = self.status_details @@ -5052,12 +4978,6 @@ def __init__( """ Initialize a BuildRunStatus object. - :param str completion_time: (optional) Time the build run completed. - :param str output_digest: (optional) Describes the time the build run - completed. - :param str reason: (optional) Optional information to provide more context - in case of a 'failed' or 'warning' status. - :param str start_time: (optional) Time the build run started. """ self.completion_time = completion_time self.output_digest = output_digest @@ -5086,14 +5006,14 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'completion_time') and self.completion_time is not None: - _dict['completion_time'] = self.completion_time - if hasattr(self, 'output_digest') and self.output_digest is not None: - _dict['output_digest'] = self.output_digest - if hasattr(self, 'reason') and self.reason is not None: - _dict['reason'] = self.reason - if hasattr(self, 'start_time') and self.start_time is not None: - _dict['start_time'] = self.start_time + if hasattr(self, 'completion_time') and getattr(self, 'completion_time') is not None: + _dict['completion_time'] = getattr(self, 'completion_time') + if hasattr(self, 'output_digest') and getattr(self, 'output_digest') is not None: + _dict['output_digest'] = getattr(self, 'output_digest') + if hasattr(self, 'reason') and getattr(self, 'reason') is not None: + _dict['reason'] = getattr(self, 'reason') + if hasattr(self, 'start_time') and getattr(self, 'start_time') is not None: + _dict['start_time'] = getattr(self, 'start_time') return _dict def _to_dict(self): @@ -5151,8 +5071,6 @@ def __init__(self, *, reason: str = None) -> None: """ Initialize a BuildStatus object. - :param str reason: (optional) Optional information to provide more context - in case of a 'failed' or 'warning' status. """ self.reason = reason @@ -5172,8 +5090,8 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'reason') and self.reason is not None: - _dict['reason'] = self.reason + if hasattr(self, 'reason') and getattr(self, 'reason') is not None: + _dict['reason'] = getattr(self, 'reason') return _dict def _to_dict(self): @@ -5217,45 +5135,40 @@ class ConfigMap: """ Describes the model of a configmap. - :attr str created_at: The date when the resource was created. + :attr str created_at: (optional) The date when the resource was created. :attr dict data: (optional) The key-value pair for the config map. Values must be specified in `KEY=VALUE` format. :attr str entity_tag: The version of the config map instance, which is used to achieve optimistic locking. :attr str href: (optional) When you provision a new config map, a URL is created identifying the location of the instance. - :attr str id: The identifier of the resource. + :attr str id: (optional) The identifier of the resource. :attr str name: The name of the config map. - :attr str project_id: The ID of the project the resource is located in. - :attr str resource_type: The type of the config map. + :attr str project_id: (optional) The ID of the project the resource is located + in. + :attr str resource_type: (optional) The type of the config map. """ def __init__( self, - created_at: str, entity_tag: str, - id: str, name: str, - project_id: str, - resource_type: str, *, + created_at: str = None, data: dict = None, href: str = None, + id: str = None, + project_id: str = None, + resource_type: str = None, ) -> None: """ Initialize a ConfigMap object. - :param str created_at: The date when the resource was created. :param str entity_tag: The version of the config map instance, which is used to achieve optimistic locking. - :param str id: The identifier of the resource. :param str name: The name of the config map. - :param str project_id: The ID of the project the resource is located in. - :param str resource_type: The type of the config map. :param dict data: (optional) The key-value pair for the config map. Values must be specified in `KEY=VALUE` format. - :param str href: (optional) When you provision a new config map, a URL is - created identifying the location of the instance. """ self.created_at = created_at self.data = data @@ -5272,8 +5185,6 @@ def from_dict(cls, _dict: Dict) -> 'ConfigMap': args = {} if 'created_at' in _dict: args['created_at'] = _dict.get('created_at') - else: - raise ValueError('Required property \'created_at\' not present in ConfigMap JSON') if 'data' in _dict: args['data'] = _dict.get('data') if 'entity_tag' in _dict: @@ -5284,20 +5195,14 @@ def from_dict(cls, _dict: Dict) -> 'ConfigMap': args['href'] = _dict.get('href') if 'id' in _dict: args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in ConfigMap JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: raise ValueError('Required property \'name\' not present in ConfigMap JSON') if 'project_id' in _dict: args['project_id'] = _dict.get('project_id') - else: - raise ValueError('Required property \'project_id\' not present in ConfigMap JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in ConfigMap JSON') return cls(**args) @classmethod @@ -5308,22 +5213,22 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = self.created_at + if hasattr(self, 'created_at') and getattr(self, 'created_at') is not None: + _dict['created_at'] = getattr(self, 'created_at') if hasattr(self, 'data') and self.data is not None: _dict['data'] = self.data if hasattr(self, 'entity_tag') and self.entity_tag is not None: _dict['entity_tag'] = self.entity_tag - 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, 'href') and getattr(self, 'href') is not None: + _dict['href'] = getattr(self, 'href') + if hasattr(self, 'id') and getattr(self, 'id') is not None: + _dict['id'] = getattr(self, 'id') if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'project_id') and self.project_id is not None: - _dict['project_id'] = self.project_id - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'project_id') and getattr(self, 'project_id') is not None: + _dict['project_id'] = getattr(self, 'project_id') + if hasattr(self, 'resource_type') and getattr(self, 'resource_type') is not None: + _dict['resource_type'] = getattr(self, 'resource_type') return _dict def _to_dict(self): @@ -5682,12 +5587,12 @@ class Job: """ Job is the response model for job resources. - :attr str created_at: The date when the resource was created. + :attr str created_at: (optional) The date when the resource was created. :attr str entity_tag: The version of the job instance, which is used to achieve optimistic locking. - :attr str href: When you provision a new job, a URL is created identifying the - location of the instance. - :attr str id: The identifier of the resource. + :attr str href: (optional) When you provision a new job, a URL is created + identifying the location of the instance. + :attr str id: (optional) The identifier of the resource. :attr str image_reference: The name of the image that is used for this job. The format is `REGISTRY/NAMESPACE/REPOSITORY:TAG` where `REGISTRY` and `TAG` are optional. If `REGISTRY` is not specified, the default is `docker.io`. If `TAG` @@ -5698,10 +5603,12 @@ class Job: The image registry access secret is used to authenticate with a private registry when you download the container image. If the image reference points to a registry that requires authentication, the job / job runs will be created but - submitted job runs will fail, until this property is provided, too. + submitted job runs will fail, until this property is provided, too. This + property must not be set on a job run, which references a job template. :attr str name: The name of the job. - :attr str project_id: The ID of the project the resource is located in. - :attr str resource_type: The type of the job. + :attr str project_id: (optional) The ID of the project the resource is located + in. + :attr str resource_type: (optional) The type of the job. :attr List[str] run_arguments: Set arguments for the job that are passed to start job run containers. If not specified an empty string array will be applied and the arguments specified by the container image, will be used to start the @@ -5715,13 +5622,14 @@ class Job: :attr List[EnvVar] run_env_variables: References to config maps, secrets or a literal values, which are exposed as environment variables in the job run. :attr str run_mode: The mode for runs of the job. Valid values are `task` and - `daemon`. In `task` mode, the `max_execution_time` and `retry_limit` options + `daemon`. In `task` mode, the `max_execution_time` and `retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are - restarted indefinitely, the `max_execution_time` and `retry_limit` options are - not allowed. + restarted indefinitely, the `max_execution_time` and `retry_limit` properties + are not allowed. :attr str run_service_account: (optional) The name of the service account. For built-in service accounts, you can use the shortened names `manager`, `none`, - `reader`, and `writer`. + `reader`, and `writer`. This property must not be set on a job run, which + references a job template. :attr List[VolumeMount] run_volume_mounts: Optional mounts of config maps or a secrets. :attr str scale_array_spec: Define a custom set of array indices as @@ -5739,8 +5647,8 @@ class Job: shorthand expressions for GB and MB. For more information see [Units of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :attr int scale_max_execution_time: (optional) The maximum execution time in - seconds for runs of the job. This option can only be specified if `mode` is - `task`. + seconds for runs of the job. This property can only be specified if `run_mode` + is `task`. :attr str scale_memory_limit: Optional amount of memory set for the instance of the job. For valid values see [Supported memory and CPU combinations](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo). @@ -5749,20 +5657,15 @@ class Job: of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :attr int scale_retry_limit: (optional) The number of times to rerun an instance - of the job before the job is marked as failed. This option can only be specified - if `mode` is `task`. + of the job before the job is marked as failed. This property can only be + specified if `run_mode` is `task`. """ def __init__( self, - created_at: str, entity_tag: str, - href: str, - id: str, image_reference: str, name: str, - project_id: str, - resource_type: str, run_arguments: List[str], run_commands: List[str], run_env_variables: List['EnvVar'], @@ -5773,7 +5676,12 @@ def __init__( scale_ephemeral_storage_limit: str, scale_memory_limit: str, *, + created_at: str = None, + href: str = None, + id: str = None, image_secret: str = None, + project_id: str = None, + resource_type: str = None, run_as_user: int = None, run_service_account: str = None, scale_max_execution_time: int = None, @@ -5782,12 +5690,8 @@ def __init__( """ Initialize a Job object. - :param str created_at: The date when the resource was created. :param str entity_tag: The version of the job instance, which is used to achieve optimistic locking. - :param str href: When you provision a new job, a URL is created - identifying the location of the instance. - :param str id: The identifier of the resource. :param str image_reference: The name of the image that is used for this job. The format is `REGISTRY/NAMESPACE/REPOSITORY:TAG` where `REGISTRY` and `TAG` are optional. If `REGISTRY` is not specified, the default is @@ -5795,8 +5699,6 @@ def __init__( image reference points to a registry that requires authentication, make sure to also specify the property `image_secret`. :param str name: The name of the job. - :param str project_id: The ID of the project the resource is located in. - :param str resource_type: The type of the job. :param List[str] run_arguments: Set arguments for the job that are passed to start job run containers. If not specified an empty string array will be applied and the arguments specified by the container image, will be used to @@ -5810,9 +5712,9 @@ def __init__( run. :param str run_mode: The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `max_execution_time` and `retry_limit` - options apply. In `daemon` mode, since there is no timeout and failed + properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `max_execution_time` and - `retry_limit` options are not allowed. + `retry_limit` properties are not allowed. :param List[VolumeMount] run_volume_mounts: Optional mounts of config maps or a secrets. :param str scale_array_spec: Define a custom set of array indices as @@ -5842,18 +5744,20 @@ def __init__( private registry when you download the container image. If the image reference points to a registry that requires authentication, the job / job runs will be created but submitted job runs will fail, until this property - is provided, too. + is provided, too. This property must not be set on a job run, which + references a job template. :param int run_as_user: (optional) The user ID (UID) to run the application (e.g., 1001). :param str run_service_account: (optional) The name of the service account. For built-in service accounts, you can use the shortened names `manager`, - `none`, `reader`, and `writer`. + `none`, `reader`, and `writer`. This property must not be set on a job run, + which references a job template. :param int scale_max_execution_time: (optional) The maximum execution time - in seconds for runs of the job. This option can only be specified if `mode` - is `task`. + in seconds for runs of the job. This property can only be specified if + `run_mode` is `task`. :param int scale_retry_limit: (optional) The number of times to rerun an - instance of the job before the job is marked as failed. This option can - only be specified if `mode` is `task`. + instance of the job before the job is marked as failed. This property can + only be specified if `run_mode` is `task`. """ self.created_at = created_at self.entity_tag = entity_tag @@ -5884,20 +5788,14 @@ def from_dict(cls, _dict: Dict) -> 'Job': args = {} if 'created_at' in _dict: args['created_at'] = _dict.get('created_at') - else: - raise ValueError('Required property \'created_at\' not present in Job JSON') if 'entity_tag' in _dict: args['entity_tag'] = _dict.get('entity_tag') else: raise ValueError('Required property \'entity_tag\' not present in Job JSON') if 'href' in _dict: args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in Job JSON') if 'id' in _dict: args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in Job JSON') if 'image_reference' in _dict: args['image_reference'] = _dict.get('image_reference') else: @@ -5910,12 +5808,8 @@ def from_dict(cls, _dict: Dict) -> 'Job': raise ValueError('Required property \'name\' not present in Job JSON') if 'project_id' in _dict: args['project_id'] = _dict.get('project_id') - else: - raise ValueError('Required property \'project_id\' not present in Job JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in Job JSON') if 'run_arguments' in _dict: args['run_arguments'] = _dict.get('run_arguments') else: @@ -5970,24 +5864,24 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = self.created_at + if hasattr(self, 'created_at') and getattr(self, 'created_at') is not None: + _dict['created_at'] = getattr(self, 'created_at') if hasattr(self, 'entity_tag') and self.entity_tag is not None: _dict['entity_tag'] = self.entity_tag - 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, 'href') and getattr(self, 'href') is not None: + _dict['href'] = getattr(self, 'href') + if hasattr(self, 'id') and getattr(self, 'id') is not None: + _dict['id'] = getattr(self, 'id') if hasattr(self, 'image_reference') and self.image_reference is not None: _dict['image_reference'] = self.image_reference if hasattr(self, 'image_secret') and self.image_secret is not None: _dict['image_secret'] = self.image_secret if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'project_id') and self.project_id is not None: - _dict['project_id'] = self.project_id - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'project_id') and getattr(self, 'project_id') is not None: + _dict['project_id'] = getattr(self, 'project_id') + if hasattr(self, 'resource_type') and getattr(self, 'resource_type') is not None: + _dict['resource_type'] = getattr(self, 'resource_type') if hasattr(self, 'run_arguments') and self.run_arguments is not None: _dict['run_arguments'] = self.run_arguments if hasattr(self, 'run_as_user') and self.run_as_user is not None: @@ -6056,9 +5950,9 @@ class ResourceTypeEnum(str, Enum): class RunModeEnum(str, Enum): """ The mode for runs of the job. Valid values are `task` and `daemon`. In `task` - mode, the `max_execution_time` and `retry_limit` options apply. In `daemon` mode, - since there is no timeout and failed instances are restarted indefinitely, the - `max_execution_time` and `retry_limit` options are not allowed. + mode, the `max_execution_time` and `retry_limit` properties apply. In `daemon` + mode, since there is no timeout and failed instances are restarted indefinitely, + the `max_execution_time` and `retry_limit` properties are not allowed. """ TASK = 'task' @@ -6067,7 +5961,8 @@ class RunModeEnum(str, Enum): class RunServiceAccountEnum(str, Enum): """ The name of the service account. For built-in service accounts, you can use the - shortened names `manager`, `none`, `reader`, and `writer`. + shortened names `manager`, `none`, `reader`, and `writer`. This property must not + be set on a job run, which references a job template. """ DEFAULT = 'default' @@ -6188,7 +6083,8 @@ class JobPatch: The image registry access secret is used to authenticate with a private registry when you download the container image. If the image reference points to a registry that requires authentication, the job / job runs will be created but - submitted job runs will fail, until this property is provided, too. + submitted job runs will fail, until this property is provided, too. This + property must not be set on a job run, which references a job template. :attr List[str] run_arguments: (optional) Set arguments for the job that are passed to start job run containers. If not specified an empty string array will be applied and the arguments specified by the container image, will be used to @@ -6203,12 +6099,13 @@ class JobPatch: config maps, secrets or a literal values. :attr str run_mode: (optional) The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `max_execution_time` and `retry_limit` - options apply. In `daemon` mode, since there is no timeout and failed instances - are restarted indefinitely, the `max_execution_time` and `retry_limit` options - are not allowed. + properties apply. In `daemon` mode, since there is no timeout and failed + instances are restarted indefinitely, the `max_execution_time` and `retry_limit` + properties are not allowed. :attr str run_service_account: (optional) The name of the service account. For built-in service accounts, you can use the shortened names `manager`, `none`, - `reader`, and `writer`. + `reader`, and `writer`. This property must not be set on a job run, which + references a job template. :attr List[VolumeMountPrototype] run_volume_mounts: (optional) Optional mounts of config maps or a secrets. In case this is provided, existing `run_volume_mounts` will be overwritten. @@ -6227,8 +6124,8 @@ class JobPatch: are the shorthand expressions for GB and MB. For more information see [Units of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :attr int scale_max_execution_time: (optional) The maximum execution time in - seconds for runs of the job. This option can only be specified if `mode` is - `task`. + seconds for runs of the job. This property can only be specified if `run_mode` + is `task`. :attr str scale_memory_limit: (optional) Optional amount of memory set for the instance of the job. For valid values see [Supported memory and CPU combinations](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo). @@ -6237,8 +6134,8 @@ class JobPatch: of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :attr int scale_retry_limit: (optional) The number of times to rerun an instance - of the job before the job is marked as failed. This option can only be specified - if `mode` is `task`. + of the job before the job is marked as failed. This property can only be + specified if `run_mode` is `task`. """ def __init__( @@ -6274,7 +6171,8 @@ def __init__( private registry when you download the container image. If the image reference points to a registry that requires authentication, the job / job runs will be created but submitted job runs will fail, until this property - is provided, too. + is provided, too. This property must not be set on a job run, which + references a job template. :param List[str] run_arguments: (optional) Set arguments for the job that are passed to start job run containers. If not specified an empty string array will be applied and the arguments specified by the container image, @@ -6289,12 +6187,13 @@ def __init__( references to config maps, secrets or a literal values. :param str run_mode: (optional) The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `max_execution_time` and - `retry_limit` options apply. In `daemon` mode, since there is no timeout + `retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `max_execution_time` - and `retry_limit` options are not allowed. + and `retry_limit` properties are not allowed. :param str run_service_account: (optional) The name of the service account. For built-in service accounts, you can use the shortened names `manager`, - `none`, `reader`, and `writer`. + `none`, `reader`, and `writer`. This property must not be set on a job run, + which references a job template. :param List[VolumeMountPrototype] run_volume_mounts: (optional) Optional mounts of config maps or a secrets. In case this is provided, existing `run_volume_mounts` will be overwritten. @@ -6314,8 +6213,8 @@ def __init__( information see [Units of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :param int scale_max_execution_time: (optional) The maximum execution time - in seconds for runs of the job. This option can only be specified if `mode` - is `task`. + in seconds for runs of the job. This property can only be specified if + `run_mode` is `task`. :param str scale_memory_limit: (optional) Optional amount of memory set for the instance of the job. For valid values see [Supported memory and CPU combinations](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo). @@ -6324,8 +6223,8 @@ def __init__( [Units of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :param int scale_retry_limit: (optional) The number of times to rerun an - instance of the job before the job is marked as failed. This option can - only be specified if `mode` is `task`. + instance of the job before the job is marked as failed. This property can + only be specified if `run_mode` is `task`. """ self.image_reference = image_reference self.image_secret = image_secret @@ -6452,9 +6351,9 @@ def __ne__(self, other: 'JobPatch') -> bool: class RunModeEnum(str, Enum): """ The mode for runs of the job. Valid values are `task` and `daemon`. In `task` - mode, the `max_execution_time` and `retry_limit` options apply. In `daemon` mode, - since there is no timeout and failed instances are restarted indefinitely, the - `max_execution_time` and `retry_limit` options are not allowed. + mode, the `max_execution_time` and `retry_limit` properties apply. In `daemon` + mode, since there is no timeout and failed instances are restarted indefinitely, + the `max_execution_time` and `retry_limit` properties are not allowed. """ TASK = 'task' @@ -6463,7 +6362,8 @@ class RunModeEnum(str, Enum): class RunServiceAccountEnum(str, Enum): """ The name of the service account. For built-in service accounts, you can use the - shortened names `manager`, `none`, `reader`, and `writer`. + shortened names `manager`, `none`, `reader`, and `writer`. This property must not + be set on a job run, which references a job template. """ DEFAULT = 'default' @@ -6491,12 +6391,14 @@ class JobRun: The image registry access secret is used to authenticate with a private registry when you download the container image. If the image reference points to a registry that requires authentication, the job / job runs will be created but - submitted job runs will fail, until this property is provided, too. + submitted job runs will fail, until this property is provided, too. This + property must not be set on a job run, which references a job template. :attr str job_name: (optional) Optional name of the job reference of this job run. If specified, the job run will inherit the configuration of the referenced job. :attr str name: (optional) The name of the job run. - :attr str project_id: The ID of the project the resource is located in. + :attr str project_id: (optional) The ID of the project the resource is located + in. :attr str resource_type: (optional) The type of the job run. :attr List[str] run_arguments: Set arguments for the job that are passed to start job run containers. If not specified an empty string array will be applied @@ -6512,12 +6414,13 @@ class JobRun: literal values, which are exposed as environment variables in the job run. :attr str run_mode: (optional) The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `max_execution_time` and `retry_limit` - options apply. In `daemon` mode, since there is no timeout and failed instances - are restarted indefinitely, the `max_execution_time` and `retry_limit` options - are not allowed. + properties apply. In `daemon` mode, since there is no timeout and failed + instances are restarted indefinitely, the `max_execution_time` and `retry_limit` + properties are not allowed. :attr str run_service_account: (optional) The name of the service account. For built-in service accounts, you can use the shortened names `manager`, `none`, - `reader`, and `writer`. + `reader`, and `writer`. This property must not be set on a job run, which + references a job template. :attr List[VolumeMount] run_volume_mounts: Optional mounts of config maps or a secrets. :attr str scale_array_spec: (optional) Define a custom set of array indices as @@ -6535,8 +6438,8 @@ class JobRun: are the shorthand expressions for GB and MB. For more information see [Units of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :attr int scale_max_execution_time: (optional) The maximum execution time in - seconds for runs of the job. This option can only be specified if `mode` is - `task`. + seconds for runs of the job. This property can only be specified if `run_mode` + is `task`. :attr str scale_memory_limit: (optional) Optional amount of memory set for the instance of the job. For valid values see [Supported memory and CPU combinations](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo). @@ -6545,8 +6448,8 @@ class JobRun: of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :attr int scale_retry_limit: (optional) The number of times to rerun an instance - of the job before the job is marked as failed. This option can only be specified - if `mode` is `task`. + of the job before the job is marked as failed. This property can only be + specified if `run_mode` is `task`. :attr str status: (optional) The current status of the job run. :attr JobRunStatus status_details: (optional) The detailed status of the job run. @@ -6554,7 +6457,6 @@ class JobRun: def __init__( self, - project_id: str, run_arguments: List[str], run_commands: List[str], run_env_variables: List['EnvVar'], @@ -6567,6 +6469,7 @@ def __init__( image_secret: str = None, job_name: str = None, name: str = None, + project_id: str = None, resource_type: str = None, run_as_user: int = None, run_mode: str = None, @@ -6583,7 +6486,6 @@ def __init__( """ Initialize a JobRun object. - :param str project_id: The ID of the project the resource is located in. :param List[str] run_arguments: Set arguments for the job that are passed to start job run containers. If not specified an empty string array will be applied and the arguments specified by the container image, will be used to @@ -6597,10 +6499,6 @@ def __init__( run. :param List[VolumeMount] run_volume_mounts: Optional mounts of config maps or a secrets. - :param str created_at: (optional) The date when the resource was created. - :param str href: (optional) When you provision a new job run, a URL is - created identifying the location of the instance. - :param str id: (optional) The identifier of the resource. :param str image_reference: (optional) The name of the image that is used for this job. The format is `REGISTRY/NAMESPACE/REPOSITORY:TAG` where `REGISTRY` and `TAG` are optional. If `REGISTRY` is not specified, the @@ -6612,22 +6510,23 @@ def __init__( private registry when you download the container image. If the image reference points to a registry that requires authentication, the job / job runs will be created but submitted job runs will fail, until this property - is provided, too. + is provided, too. This property must not be set on a job run, which + references a job template. :param str job_name: (optional) Optional name of the job reference of this job run. If specified, the job run will inherit the configuration of the referenced job. :param str name: (optional) The name of the job run. - :param str resource_type: (optional) The type of the job run. :param int run_as_user: (optional) The user ID (UID) to run the application (e.g., 1001). :param str run_mode: (optional) The mode for runs of the job. Valid values are `task` and `daemon`. In `task` mode, the `max_execution_time` and - `retry_limit` options apply. In `daemon` mode, since there is no timeout + `retry_limit` properties apply. In `daemon` mode, since there is no timeout and failed instances are restarted indefinitely, the `max_execution_time` - and `retry_limit` options are not allowed. + and `retry_limit` properties are not allowed. :param str run_service_account: (optional) The name of the service account. For built-in service accounts, you can use the shortened names `manager`, - `none`, `reader`, and `writer`. + `none`, `reader`, and `writer`. This property must not be set on a job run, + which references a job template. :param str scale_array_spec: (optional) Define a custom set of array indices as comma-separated list containing single values and hyphen-separated ranges like `5,12-14,23,27`. Each instance can pick up its @@ -6644,8 +6543,8 @@ def __init__( information see [Units of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :param int scale_max_execution_time: (optional) The maximum execution time - in seconds for runs of the job. This option can only be specified if `mode` - is `task`. + in seconds for runs of the job. This property can only be specified if + `run_mode` is `task`. :param str scale_memory_limit: (optional) Optional amount of memory set for the instance of the job. For valid values see [Supported memory and CPU combinations](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo). @@ -6654,9 +6553,8 @@ def __init__( [Units of measurement](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo#unit-measurements). :param int scale_retry_limit: (optional) The number of times to rerun an - instance of the job before the job is marked as failed. This option can - only be specified if `mode` is `task`. - :param str status: (optional) The current status of the job run. + instance of the job before the job is marked as failed. This property can + only be specified if `run_mode` is `task`. :param JobRunStatus status_details: (optional) The detailed status of the job run. """ @@ -6705,8 +6603,6 @@ def from_dict(cls, _dict: Dict) -> 'JobRun': args['name'] = _dict.get('name') if 'project_id' in _dict: args['project_id'] = _dict.get('project_id') - else: - raise ValueError('Required property \'project_id\' not present in JobRun JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') if 'run_arguments' in _dict: @@ -6757,12 +6653,12 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = self.created_at - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'created_at') and getattr(self, 'created_at') is not None: + _dict['created_at'] = getattr(self, 'created_at') + if hasattr(self, 'href') and getattr(self, 'href') is not None: + _dict['href'] = getattr(self, 'href') + if hasattr(self, 'id') and getattr(self, 'id') is not None: + _dict['id'] = getattr(self, 'id') if hasattr(self, 'image_reference') and self.image_reference is not None: _dict['image_reference'] = self.image_reference if hasattr(self, 'image_secret') and self.image_secret is not None: @@ -6771,10 +6667,10 @@ def to_dict(self) -> Dict: _dict['job_name'] = self.job_name if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'project_id') and self.project_id is not None: - _dict['project_id'] = self.project_id - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'project_id') and getattr(self, 'project_id') is not None: + _dict['project_id'] = getattr(self, 'project_id') + if hasattr(self, 'resource_type') and getattr(self, 'resource_type') is not None: + _dict['resource_type'] = getattr(self, 'resource_type') if hasattr(self, 'run_arguments') and self.run_arguments is not None: _dict['run_arguments'] = self.run_arguments if hasattr(self, 'run_as_user') and self.run_as_user is not None: @@ -6813,8 +6709,8 @@ def to_dict(self) -> Dict: _dict['scale_memory_limit'] = self.scale_memory_limit if hasattr(self, 'scale_retry_limit') and self.scale_retry_limit is not None: _dict['scale_retry_limit'] = self.scale_retry_limit - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status + if hasattr(self, 'status') and getattr(self, 'status') is not None: + _dict['status'] = getattr(self, 'status') if hasattr(self, 'status_details') and self.status_details is not None: if isinstance(self.status_details, dict): _dict['status_details'] = self.status_details @@ -6850,9 +6746,9 @@ class ResourceTypeEnum(str, Enum): class RunModeEnum(str, Enum): """ The mode for runs of the job. Valid values are `task` and `daemon`. In `task` - mode, the `max_execution_time` and `retry_limit` options apply. In `daemon` mode, - since there is no timeout and failed instances are restarted indefinitely, the - `max_execution_time` and `retry_limit` options are not allowed. + mode, the `max_execution_time` and `retry_limit` properties apply. In `daemon` + mode, since there is no timeout and failed instances are restarted indefinitely, + the `max_execution_time` and `retry_limit` properties are not allowed. """ TASK = 'task' @@ -6861,7 +6757,8 @@ class RunModeEnum(str, Enum): class RunServiceAccountEnum(str, Enum): """ The name of the service account. For built-in service accounts, you can use the - shortened names `manager`, `none`, `reader`, and `writer`. + shortened names `manager`, `none`, `reader`, and `writer`. This property must not + be set on a job run, which references a job template. """ DEFAULT = 'default' @@ -7011,15 +6908,6 @@ def __init__( """ Initialize a JobRunStatus object. - :param str completion_time: (optional) Time the job run completed. - :param int failed: (optional) Number of failed job run instances. - :param int pending: (optional) Number of pending job run instances. - :param int requested: (optional) Number of requested job run instances. - :param int running: (optional) Number of running job run instances. - :param str start_time: (optional) Time the job run started. - :param int succeeded: (optional) Number of succeeded job run instances. - :param int unknown: (optional) Number of job run instances with unknown - state. """ self.completion_time = completion_time self.failed = failed @@ -7060,22 +6948,22 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'completion_time') and self.completion_time is not None: - _dict['completion_time'] = self.completion_time - if hasattr(self, 'failed') and self.failed is not None: - _dict['failed'] = self.failed - if hasattr(self, 'pending') and self.pending is not None: - _dict['pending'] = self.pending - if hasattr(self, 'requested') and self.requested is not None: - _dict['requested'] = self.requested - if hasattr(self, 'running') and self.running is not None: - _dict['running'] = self.running - if hasattr(self, 'start_time') and self.start_time is not None: - _dict['start_time'] = self.start_time - if hasattr(self, 'succeeded') and self.succeeded is not None: - _dict['succeeded'] = self.succeeded - if hasattr(self, 'unknown') and self.unknown is not None: - _dict['unknown'] = self.unknown + if hasattr(self, 'completion_time') and getattr(self, 'completion_time') is not None: + _dict['completion_time'] = getattr(self, 'completion_time') + if hasattr(self, 'failed') and getattr(self, 'failed') is not None: + _dict['failed'] = getattr(self, 'failed') + if hasattr(self, 'pending') and getattr(self, 'pending') is not None: + _dict['pending'] = getattr(self, 'pending') + if hasattr(self, 'requested') and getattr(self, 'requested') is not None: + _dict['requested'] = getattr(self, 'requested') + if hasattr(self, 'running') and getattr(self, 'running') is not None: + _dict['running'] = getattr(self, 'running') + if hasattr(self, 'start_time') and getattr(self, 'start_time') is not None: + _dict['start_time'] = getattr(self, 'start_time') + if hasattr(self, 'succeeded') and getattr(self, 'succeeded') is not None: + _dict['succeeded'] = getattr(self, 'succeeded') + if hasattr(self, 'unknown') and getattr(self, 'unknown') is not None: + _dict['unknown'] = getattr(self, 'unknown') return _dict def _to_dict(self): @@ -7216,52 +7104,42 @@ class Project: """ Describes the model of a project. - :attr str account_id: An alphanumeric value identifying the account ID. - :attr str created_at: The date when the project was created. - :attr str crn: The CRN of the project. - :attr str href: When you provision a new resource, a URL is created identifying - the location of the instance. - :attr str id: The ID of the project. + :attr str account_id: (optional) An alphanumeric value identifying the account + ID. + :attr str created_at: (optional) The date when the project was created. + :attr str crn: (optional) The CRN of the project. + :attr str href: (optional) When you provision a new resource, a URL is created + identifying the location of the instance. + :attr str id: (optional) The ID of the project. :attr str name: The name of the project. - :attr str region: The region for your project deployment. Possible values: - 'au-syd', 'br-sao', 'ca-tor', 'eu-de', 'eu-gb', 'jp-osa', 'jp-tok', 'us-east', - 'us-south'. + :attr str region: (optional) The region for your project deployment. Possible + values: 'au-syd', 'br-sao', 'ca-tor', 'eu-de', 'eu-gb', 'jp-osa', 'jp-tok', + 'us-east', 'us-south'. :attr str resource_group_id: The ID of the resource group. - :attr str resource_type: The type of the project. - :attr str status: The current state of the project. For example, if the project - is created and ready to get used, it will return active. + :attr str resource_type: (optional) The type of the project. + :attr str status: (optional) The current state of the project. For example, if + the project is created and ready to get used, it will return active. """ def __init__( self, - account_id: str, - created_at: str, - crn: str, - href: str, - id: str, name: str, - region: str, resource_group_id: str, - resource_type: str, - status: str, + *, + account_id: str = None, + created_at: str = None, + crn: str = None, + href: str = None, + id: str = None, + region: str = None, + resource_type: str = None, + status: str = None, ) -> None: """ Initialize a Project object. - :param str account_id: An alphanumeric value identifying the account ID. - :param str created_at: The date when the project was created. - :param str crn: The CRN of the project. - :param str href: When you provision a new resource, a URL is created - identifying the location of the instance. - :param str id: The ID of the project. :param str name: The name of the project. - :param str region: The region for your project deployment. Possible values: - 'au-syd', 'br-sao', 'ca-tor', 'eu-de', 'eu-gb', 'jp-osa', 'jp-tok', - 'us-east', 'us-south'. :param str resource_group_id: The ID of the resource group. - :param str resource_type: The type of the project. - :param str status: The current state of the project. For example, if the - project is created and ready to get used, it will return active. """ self.account_id = account_id self.created_at = created_at @@ -7280,44 +7158,28 @@ def from_dict(cls, _dict: Dict) -> 'Project': args = {} if 'account_id' in _dict: args['account_id'] = _dict.get('account_id') - else: - raise ValueError('Required property \'account_id\' not present in Project JSON') if 'created_at' in _dict: args['created_at'] = _dict.get('created_at') - else: - raise ValueError('Required property \'created_at\' not present in Project JSON') if 'crn' in _dict: args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in Project JSON') if 'href' in _dict: args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in Project JSON') if 'id' in _dict: args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in Project JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: raise ValueError('Required property \'name\' not present in Project JSON') if 'region' in _dict: args['region'] = _dict.get('region') - else: - raise ValueError('Required property \'region\' not present in Project JSON') if 'resource_group_id' in _dict: args['resource_group_id'] = _dict.get('resource_group_id') else: raise ValueError('Required property \'resource_group_id\' not present in Project JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in Project JSON') if 'status' in _dict: args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in Project JSON') return cls(**args) @classmethod @@ -7328,26 +7190,26 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'account_id') and self.account_id is not None: - _dict['account_id'] = self.account_id - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = self.created_at - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'account_id') and getattr(self, 'account_id') is not None: + _dict['account_id'] = getattr(self, 'account_id') + if hasattr(self, 'created_at') and getattr(self, 'created_at') is not None: + _dict['created_at'] = getattr(self, 'created_at') + if hasattr(self, 'crn') and getattr(self, 'crn') is not None: + _dict['crn'] = getattr(self, 'crn') + if hasattr(self, 'href') and getattr(self, 'href') is not None: + _dict['href'] = getattr(self, 'href') + if hasattr(self, 'id') and getattr(self, 'id') is not None: + _dict['id'] = getattr(self, 'id') if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'region') and self.region is not None: - _dict['region'] = self.region + if hasattr(self, 'region') and getattr(self, 'region') is not None: + _dict['region'] = getattr(self, 'region') if hasattr(self, 'resource_group_id') and self.resource_group_id is not None: _dict['resource_group_id'] = self.resource_group_id - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status + if hasattr(self, 'resource_type') and getattr(self, 'resource_type') is not None: + _dict['resource_type'] = getattr(self, 'resource_type') + if hasattr(self, 'status') and getattr(self, 'status') is not None: + _dict['status'] = getattr(self, 'status') return _dict def _to_dict(self): @@ -7501,7 +7363,7 @@ class Secret: """ Describes the model of a secret. - :attr str created_at: The date when the resource was created. + :attr str created_at: (optional) The date when the resource was created. :attr dict data: (optional) Data container that allows to specify config parameters and their values as a key-value map. Each key field must consist of alphanumeric characters, `-`, `_` or `.` and must not be exceed a max length of @@ -7512,43 +7374,38 @@ class Secret: :attr str format: (optional) Specify the format of the secret. :attr str href: (optional) When you provision a new secret, a URL is created identifying the location of the instance. - :attr str id: The identifier of the resource. + :attr str id: (optional) The identifier of the resource. :attr str name: The name of the secret. - :attr str project_id: The ID of the project the resource is located in. - :attr str resource_type: The type of the secret. + :attr str project_id: (optional) The ID of the project the resource is located + in. + :attr str resource_type: (optional) The type of the secret. """ def __init__( self, - created_at: str, entity_tag: str, - id: str, name: str, - project_id: str, - resource_type: str, *, + created_at: str = None, data: dict = None, format: str = None, href: str = None, + id: str = None, + project_id: str = None, + resource_type: str = None, ) -> None: """ Initialize a Secret object. - :param str created_at: The date when the resource was created. :param str entity_tag: The version of the secret instance, which is used to achieve optimistic locking. - :param str id: The identifier of the resource. :param str name: The name of the secret. - :param str project_id: The ID of the project the resource is located in. - :param str resource_type: The type of the secret. :param dict data: (optional) Data container that allows to specify config parameters and their values as a key-value map. Each key field must consist of alphanumeric characters, `-`, `_` or `.` and must not be exceed a max length of 253 characters. Each value field can consists of any character and must not be exceed a max length of 1048576 characters. :param str format: (optional) Specify the format of the secret. - :param str href: (optional) When you provision a new secret, a URL is - created identifying the location of the instance. """ self.created_at = created_at self.data = data @@ -7566,8 +7423,6 @@ def from_dict(cls, _dict: Dict) -> 'Secret': args = {} if 'created_at' in _dict: args['created_at'] = _dict.get('created_at') - else: - raise ValueError('Required property \'created_at\' not present in Secret JSON') if 'data' in _dict: args['data'] = _dict.get('data') if 'entity_tag' in _dict: @@ -7580,20 +7435,14 @@ def from_dict(cls, _dict: Dict) -> 'Secret': args['href'] = _dict.get('href') if 'id' in _dict: args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in Secret JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: raise ValueError('Required property \'name\' not present in Secret JSON') if 'project_id' in _dict: args['project_id'] = _dict.get('project_id') - else: - raise ValueError('Required property \'project_id\' not present in Secret JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in Secret JSON') return cls(**args) @classmethod @@ -7604,24 +7453,24 @@ def _from_dict(cls, _dict): def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = self.created_at + if hasattr(self, 'created_at') and getattr(self, 'created_at') is not None: + _dict['created_at'] = getattr(self, 'created_at') if hasattr(self, 'data') and self.data is not None: _dict['data'] = self.data if hasattr(self, 'entity_tag') and self.entity_tag is not None: _dict['entity_tag'] = self.entity_tag if hasattr(self, 'format') and self.format is not None: _dict['format'] = self.format - 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, 'href') and getattr(self, 'href') is not None: + _dict['href'] = getattr(self, 'href') + if hasattr(self, 'id') and getattr(self, 'id') is not None: + _dict['id'] = getattr(self, 'id') if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'project_id') and self.project_id is not None: - _dict['project_id'] = self.project_id - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'project_id') and getattr(self, 'project_id') is not None: + _dict['project_id'] = getattr(self, 'project_id') + if hasattr(self, 'resource_type') and getattr(self, 'resource_type') is not None: + _dict['resource_type'] = getattr(self, 'resource_type') return _dict def _to_dict(self): @@ -7656,6 +7505,35 @@ class FormatEnum(str, Enum): OTHER = 'other' +class SecretData: + """ + Data container that allows to specify config parameters and their values as a + key-value map. Each key field must consist of alphanumeric characters, `-`, `_` or `.` + and must not be exceed a max length of 253 characters. Each value field can consists + of any character and must not be exceed a max length of 1048576 characters. + + """ + + def __init__(self, **kwargs) -> None: + """ + Initialize a SecretData object. + + :param **kwargs: (optional) Any additional properties. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join( + [ + 'SecretDataSSHSecretData', + 'SecretDataRegistrySecretData', + 'SecretDataTLSSecretData', + 'SecretDataGenericSecretData', + 'SecretDataBasicAuthSecretData', + ] + ) + ) + raise Exception(msg) + + class SecretList: """ List of secret resources. @@ -7941,6 +7819,458 @@ class TypeEnum(str, Enum): SECRET = 'secret' +class SecretDataBasicAuthSecretData(SecretData): + """ + SecretDataBasicAuthSecretData. + + :attr str username: Basic auth username. + :attr str password: Basic auth password. + """ + + # The set of defined properties for the class + _properties = frozenset(['username', 'password']) + + def __init__(self, username: str, password: str, **kwargs) -> None: + """ + Initialize a SecretDataBasicAuthSecretData object. + + :param str username: Basic auth username. + :param str password: Basic auth password. + :param **kwargs: (optional) Any additional properties. + """ + # pylint: disable=super-init-not-called + self.username = username + self.password = password + for _key, _value in kwargs.items(): + setattr(self, _key, _value) + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SecretDataBasicAuthSecretData': + """Initialize a SecretDataBasicAuthSecretData object from a json dictionary.""" + args = {} + if 'username' in _dict: + args['username'] = _dict.get('username') + else: + raise ValueError('Required property \'username\' not present in SecretDataBasicAuthSecretData JSON') + if 'password' in _dict: + args['password'] = _dict.get('password') + else: + raise ValueError('Required property \'password\' not present in SecretDataBasicAuthSecretData JSON') + args.update({k: v for (k, v) in _dict.items() if k not in cls._properties}) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SecretDataBasicAuthSecretData object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'username') and self.username is not None: + _dict['username'] = self.username + if hasattr(self, 'password') and self.password is not None: + _dict['password'] = self.password + for _key in [k for k in vars(self).keys() if k not in SecretDataBasicAuthSecretData._properties]: + _dict[_key] = getattr(self, _key) + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def get_properties(self) -> Dict: + """Return a dictionary of arbitrary properties from this instance of SecretDataBasicAuthSecretData""" + _dict = {} + + for _key in [k for k in vars(self).keys() if k not in SecretDataBasicAuthSecretData._properties]: + _dict[_key] = getattr(self, _key) + return _dict + + def set_properties(self, _dict: dict): + """Set a dictionary of arbitrary properties to this instance of SecretDataBasicAuthSecretData""" + for _key in [k for k in vars(self).keys() if k not in SecretDataBasicAuthSecretData._properties]: + delattr(self, _key) + + for _key, _value in _dict.items(): + if _key not in SecretDataBasicAuthSecretData._properties: + setattr(self, _key, _value) + + def __str__(self) -> str: + """Return a `str` version of this SecretDataBasicAuthSecretData object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SecretDataBasicAuthSecretData') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'SecretDataBasicAuthSecretData') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class SecretDataGenericSecretData(SecretData): + """ + Data container that allows to specify config parameters and their values as a + key-value map. Each key field must consist of alphanumeric characters, `-`, `_` or `.` + and must not be exceed a max length of 253 characters. Each value field can consists + of any character and must not be exceed a max length of 1048576 characters. + + """ + + def __init__(self, **kwargs) -> None: + """ + Initialize a SecretDataGenericSecretData object. + + :param **kwargs: (optional) Any additional properties. + """ + # pylint: disable=super-init-not-called + for _key, _value in kwargs.items(): + setattr(self, _key, _value) + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SecretDataGenericSecretData': + """Initialize a SecretDataGenericSecretData object from a json dictionary.""" + return cls(**_dict) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SecretDataGenericSecretData object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + return vars(self) + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def get_properties(self) -> Dict: + """Return a dictionary of arbitrary properties from this instance of SecretDataGenericSecretData""" + _dict = {} + + for _key in [k for k in vars(self).keys()]: + _dict[_key] = getattr(self, _key) + return _dict + + def set_properties(self, _dict: dict): + """Set a dictionary of arbitrary properties to this instance of SecretDataGenericSecretData""" + for _key in [k for k in vars(self).keys()]: + delattr(self, _key) + + for _key, _value in _dict.items(): + setattr(self, _key, _value) + + def __str__(self) -> str: + """Return a `str` version of this SecretDataGenericSecretData object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SecretDataGenericSecretData') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'SecretDataGenericSecretData') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class SecretDataRegistrySecretData(SecretData): + """ + SecretDataRegistrySecretData. + + :attr str username: Registry username. + :attr str password: Registry password. + :attr str server: Registry server. + :attr str email: Registry email address. + """ + + # The set of defined properties for the class + _properties = frozenset(['username', 'password', 'server', 'email']) + + def __init__(self, username: str, password: str, server: str, email: str, **kwargs) -> None: + """ + Initialize a SecretDataRegistrySecretData object. + + :param str username: Registry username. + :param str password: Registry password. + :param str server: Registry server. + :param str email: Registry email address. + :param **kwargs: (optional) Any additional properties. + """ + # pylint: disable=super-init-not-called + self.username = username + self.password = password + self.server = server + self.email = email + for _key, _value in kwargs.items(): + setattr(self, _key, _value) + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SecretDataRegistrySecretData': + """Initialize a SecretDataRegistrySecretData object from a json dictionary.""" + args = {} + if 'username' in _dict: + args['username'] = _dict.get('username') + else: + raise ValueError('Required property \'username\' not present in SecretDataRegistrySecretData JSON') + if 'password' in _dict: + args['password'] = _dict.get('password') + else: + raise ValueError('Required property \'password\' not present in SecretDataRegistrySecretData JSON') + if 'server' in _dict: + args['server'] = _dict.get('server') + else: + raise ValueError('Required property \'server\' not present in SecretDataRegistrySecretData JSON') + if 'email' in _dict: + args['email'] = _dict.get('email') + else: + raise ValueError('Required property \'email\' not present in SecretDataRegistrySecretData JSON') + args.update({k: v for (k, v) in _dict.items() if k not in cls._properties}) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SecretDataRegistrySecretData object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'username') and self.username is not None: + _dict['username'] = self.username + if hasattr(self, 'password') and self.password is not None: + _dict['password'] = self.password + if hasattr(self, 'server') and self.server is not None: + _dict['server'] = self.server + if hasattr(self, 'email') and self.email is not None: + _dict['email'] = self.email + for _key in [k for k in vars(self).keys() if k not in SecretDataRegistrySecretData._properties]: + _dict[_key] = getattr(self, _key) + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def get_properties(self) -> Dict: + """Return a dictionary of arbitrary properties from this instance of SecretDataRegistrySecretData""" + _dict = {} + + for _key in [k for k in vars(self).keys() if k not in SecretDataRegistrySecretData._properties]: + _dict[_key] = getattr(self, _key) + return _dict + + def set_properties(self, _dict: dict): + """Set a dictionary of arbitrary properties to this instance of SecretDataRegistrySecretData""" + for _key in [k for k in vars(self).keys() if k not in SecretDataRegistrySecretData._properties]: + delattr(self, _key) + + for _key, _value in _dict.items(): + if _key not in SecretDataRegistrySecretData._properties: + setattr(self, _key, _value) + + def __str__(self) -> str: + """Return a `str` version of this SecretDataRegistrySecretData object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SecretDataRegistrySecretData') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'SecretDataRegistrySecretData') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class SecretDataSSHSecretData(SecretData): + """ + Secret Data field used by SSH secrets. + + :attr str ssh_key: SSH key. + :attr str known_hosts: (optional) Known hosts. + """ + + # The set of defined properties for the class + _properties = frozenset(['ssh_key', 'known_hosts']) + + def __init__(self, ssh_key: str, *, known_hosts: str = None, **kwargs) -> None: + """ + Initialize a SecretDataSSHSecretData object. + + :param str ssh_key: SSH key. + :param str known_hosts: (optional) Known hosts. + :param **kwargs: (optional) Any additional properties. + """ + # pylint: disable=super-init-not-called + self.ssh_key = ssh_key + self.known_hosts = known_hosts + for _key, _value in kwargs.items(): + setattr(self, _key, _value) + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SecretDataSSHSecretData': + """Initialize a SecretDataSSHSecretData object from a json dictionary.""" + args = {} + if 'ssh_key' in _dict: + args['ssh_key'] = _dict.get('ssh_key') + else: + raise ValueError('Required property \'ssh_key\' not present in SecretDataSSHSecretData JSON') + if 'known_hosts' in _dict: + args['known_hosts'] = _dict.get('known_hosts') + args.update({k: v for (k, v) in _dict.items() if k not in cls._properties}) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SecretDataSSHSecretData object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'ssh_key') and self.ssh_key is not None: + _dict['ssh_key'] = self.ssh_key + if hasattr(self, 'known_hosts') and self.known_hosts is not None: + _dict['known_hosts'] = self.known_hosts + for _key in [k for k in vars(self).keys() if k not in SecretDataSSHSecretData._properties]: + _dict[_key] = getattr(self, _key) + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def get_properties(self) -> Dict: + """Return a dictionary of arbitrary properties from this instance of SecretDataSSHSecretData""" + _dict = {} + + for _key in [k for k in vars(self).keys() if k not in SecretDataSSHSecretData._properties]: + _dict[_key] = getattr(self, _key) + return _dict + + def set_properties(self, _dict: dict): + """Set a dictionary of arbitrary properties to this instance of SecretDataSSHSecretData""" + for _key in [k for k in vars(self).keys() if k not in SecretDataSSHSecretData._properties]: + delattr(self, _key) + + for _key, _value in _dict.items(): + if _key not in SecretDataSSHSecretData._properties: + setattr(self, _key, _value) + + def __str__(self) -> str: + """Return a `str` version of this SecretDataSSHSecretData object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SecretDataSSHSecretData') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'SecretDataSSHSecretData') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class SecretDataTLSSecretData(SecretData): + """ + SecretDataTLSSecretData. + + :attr str tls_cert: The TLS certificate used in a TLS secret. + :attr str tls_key: The TLS key used in a TLS secret. + """ + + # The set of defined properties for the class + _properties = frozenset(['tls_cert', 'tls_key']) + + def __init__(self, tls_cert: str, tls_key: str, **kwargs) -> None: + """ + Initialize a SecretDataTLSSecretData object. + + :param str tls_cert: The TLS certificate used in a TLS secret. + :param str tls_key: The TLS key used in a TLS secret. + :param **kwargs: (optional) Any additional properties. + """ + # pylint: disable=super-init-not-called + self.tls_cert = tls_cert + self.tls_key = tls_key + for _key, _value in kwargs.items(): + setattr(self, _key, _value) + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SecretDataTLSSecretData': + """Initialize a SecretDataTLSSecretData object from a json dictionary.""" + args = {} + if 'tls_cert' in _dict: + args['tls_cert'] = _dict.get('tls_cert') + else: + raise ValueError('Required property \'tls_cert\' not present in SecretDataTLSSecretData JSON') + if 'tls_key' in _dict: + args['tls_key'] = _dict.get('tls_key') + else: + raise ValueError('Required property \'tls_key\' not present in SecretDataTLSSecretData JSON') + args.update({k: v for (k, v) in _dict.items() if k not in cls._properties}) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SecretDataTLSSecretData object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'tls_cert') and self.tls_cert is not None: + _dict['tls_cert'] = self.tls_cert + if hasattr(self, 'tls_key') and self.tls_key is not None: + _dict['tls_key'] = self.tls_key + for _key in [k for k in vars(self).keys() if k not in SecretDataTLSSecretData._properties]: + _dict[_key] = getattr(self, _key) + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def get_properties(self) -> Dict: + """Return a dictionary of arbitrary properties from this instance of SecretDataTLSSecretData""" + _dict = {} + + for _key in [k for k in vars(self).keys() if k not in SecretDataTLSSecretData._properties]: + _dict[_key] = getattr(self, _key) + return _dict + + def set_properties(self, _dict: dict): + """Set a dictionary of arbitrary properties to this instance of SecretDataTLSSecretData""" + for _key in [k for k in vars(self).keys() if k not in SecretDataTLSSecretData._properties]: + delattr(self, _key) + + for _key, _value in _dict.items(): + if _key not in SecretDataTLSSecretData._properties: + setattr(self, _key, _value) + + def __str__(self) -> str: + """Return a `str` version of this SecretDataTLSSecretData object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SecretDataTLSSecretData') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'SecretDataTLSSecretData') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + ############################################################################## # Pagers ############################################################################## diff --git a/pylint.sh b/pylint.sh index a3ac091..1c6a71b 100755 --- a/pylint.sh +++ b/pylint.sh @@ -1,3 +1,3 @@ #!/bin/bash -python -m pylint ibm_code_engine_sdk test --exit-zero +python3 -m pylint ibm_code_engine_sdk test --exit-zero diff --git a/test/integration/test_v2.py b/test/integration/test_v2.py index d98318a..f6cc35e 100644 --- a/test/integration/test_v2.py +++ b/test/integration/test_v2.py @@ -43,7 +43,7 @@ def setup_class(cls): cls.config = read_external_sources(CodeEngineV2.DEFAULT_SERVICE_NAME) assert cls.config is not None - cls.code_engine_service.enable_retries() + cls.code_engine_service.enable_retries(max_retries=0, retry_interval=10) print('Setup complete.') @@ -53,7 +53,6 @@ def setup_class(cls): @needscredentials def test_list_projects(self): - response = self.code_engine_service.list_projects( limit=100, ) @@ -89,9 +88,8 @@ def test_list_projects_with_pager(self): @needscredentials def test_create_project(self): - response = self.code_engine_service.create_project( - name=f'sdk-e2e-python-{time.time()}', + name=f'sdk-e2e-python-{int(time.time())}', tags=['testString'], ) @@ -105,7 +103,7 @@ def test_create_project(self): @needscredentials def test_get_project(self): - + time.sleep(120) response = self.code_engine_service.get_project( id=pytest.e2e_test_project_id, ) @@ -117,8 +115,8 @@ def test_get_project(self): # Assume that the project creation takes some time i = 0 obtained_project = [] - while i < 20: - time.sleep(10) + while i < 30: + time.sleep(15) proj_res = self.code_engine_service.get_project( id=pytest.e2e_test_project_id, ) @@ -136,7 +134,6 @@ def test_get_project(self): @needscredentials def test_list_apps(self): - response = self.code_engine_service.list_apps( project_id=pytest.e2e_test_project_id, limit=100, @@ -175,7 +172,6 @@ def test_list_apps_with_pager(self): @needscredentials def test_create_app(self): - # Construct a dict representation of a EnvVarPrototype model env_var_prototype_model = { 'key': 'MY_VARIABLE', @@ -224,7 +220,6 @@ def test_create_app(self): @needscredentials def test_get_app(self): - response = self.code_engine_service.get_app( project_id=pytest.e2e_test_project_id, name='my-app', @@ -236,7 +231,6 @@ def test_get_app(self): @needscredentials def test_update_app(self): - # Construct a dict representation of a EnvVarPrototype model env_var_prototype_model = { 'key': 'MY_VARIABLE', @@ -291,7 +285,6 @@ def test_update_app(self): @needscredentials def test_list_app_revisions(self): - response = self.code_engine_service.list_app_revisions( project_id=pytest.e2e_test_project_id, app_name='my-app', @@ -333,7 +326,6 @@ def test_list_app_revisions_with_pager(self): @needscredentials def test_get_app_revision(self): - response = self.code_engine_service.get_app_revision( project_id=pytest.e2e_test_project_id, app_name='my-app', @@ -346,7 +338,6 @@ def test_get_app_revision(self): @needscredentials def test_list_jobs(self): - response = self.code_engine_service.list_jobs( project_id=pytest.e2e_test_project_id, limit=100, @@ -385,7 +376,6 @@ def test_list_jobs_with_pager(self): @needscredentials def test_create_job(self): - # Construct a dict representation of a EnvVarPrototype model env_var_prototype_model = { 'key': 'MY_VARIABLE', @@ -430,7 +420,6 @@ def test_create_job(self): @needscredentials def test_get_job(self): - response = self.code_engine_service.get_job( project_id=pytest.e2e_test_project_id, name='my-job', @@ -442,7 +431,6 @@ def test_get_job(self): @needscredentials def test_update_job(self): - # Construct a dict representation of a EnvVarPrototype model env_var_prototype_model = { 'key': 'MY_VARIABLE', @@ -493,7 +481,6 @@ def test_update_job(self): @needscredentials def test_list_job_runs(self): - response = self.code_engine_service.list_job_runs( project_id=pytest.e2e_test_project_id, job_name='my-job', @@ -535,7 +522,6 @@ def test_list_job_runs_with_pager(self): @needscredentials def test_create_job_run(self): - # Construct a dict representation of a EnvVarPrototype model env_var_prototype_model = { 'key': 'MY_VARIABLE', @@ -579,7 +565,6 @@ def test_create_job_run(self): @needscredentials def test_get_job_run(self): - response = self.code_engine_service.get_job_run( project_id=pytest.e2e_test_project_id, name='my-job-run', @@ -591,7 +576,6 @@ def test_get_job_run(self): @needscredentials def test_list_builds(self): - response = self.code_engine_service.list_builds( project_id=pytest.e2e_test_project_id, limit=100, @@ -630,7 +614,6 @@ def test_list_builds_with_pager(self): @needscredentials def test_create_build(self): - response = self.code_engine_service.create_build( project_id=pytest.e2e_test_project_id, name='my-build', @@ -653,7 +636,6 @@ def test_create_build(self): @needscredentials def test_get_build(self): - response = self.code_engine_service.get_build( project_id=pytest.e2e_test_project_id, name='my-build', @@ -665,7 +647,6 @@ def test_get_build(self): @needscredentials def test_update_build(self): - # Construct a dict representation of a BuildPatch model build_patch_model = { 'output_image': 'private.de.icr.io/icr_namespace/image-name', @@ -694,7 +675,6 @@ def test_update_build(self): @needscredentials def test_list_build_runs(self): - response = self.code_engine_service.list_build_runs( project_id=pytest.e2e_test_project_id, build_name='my-build', @@ -736,7 +716,6 @@ def test_list_build_runs_with_pager(self): @needscredentials def test_create_build_run(self): - response = self.code_engine_service.create_build_run( project_id=pytest.e2e_test_project_id, build_name='my-build', @@ -761,7 +740,6 @@ def test_create_build_run(self): @needscredentials def test_get_build_run(self): - response = self.code_engine_service.get_build_run( project_id=pytest.e2e_test_project_id, name='my-build-run', @@ -773,7 +751,6 @@ def test_get_build_run(self): @needscredentials def test_list_config_maps(self): - response = self.code_engine_service.list_config_maps( project_id=pytest.e2e_test_project_id, limit=100, @@ -812,7 +789,6 @@ def test_list_config_maps_with_pager(self): @needscredentials def test_create_config_map(self): - response = self.code_engine_service.create_config_map( project_id=pytest.e2e_test_project_id, name='my-config-map', @@ -825,7 +801,6 @@ def test_create_config_map(self): @needscredentials def test_get_config_map(self): - response = self.code_engine_service.get_config_map( project_id=pytest.e2e_test_project_id, name='my-config-map', @@ -837,7 +812,6 @@ def test_get_config_map(self): @needscredentials def test_replace_config_map(self): - response = self.code_engine_service.replace_config_map( project_id=pytest.e2e_test_project_id, name='my-config-map', @@ -851,7 +825,6 @@ def test_replace_config_map(self): @needscredentials def test_list_secrets(self): - response = self.code_engine_service.list_secrets( project_id=pytest.e2e_test_project_id, limit=100, @@ -890,7 +863,6 @@ def test_list_secrets_with_pager(self): @needscredentials def test_create_secret(self): - response = self.code_engine_service.create_secret( project_id=pytest.e2e_test_project_id, format='generic', @@ -903,8 +875,62 @@ def test_create_secret(self): assert secret is not None @needscredentials - def test_get_secret(self): + def test_create_ssh_secret(self): + response = self.code_engine_service.create_secret( + project_id=pytest.e2e_test_project_id, + format='ssh_auth', + name='my-ssh-secret', + data={'ssh_key': '-----BEGIN RSA PRIVATE KEY----------END RSA PRIVATE KEY-----'}, + ) + + assert response.get_status_code() == 201 + secret = response.get_result() + assert secret is not None + + @needscredentials + def test_create_tls_secret(self): + response = self.code_engine_service.create_secret( + project_id=pytest.e2e_test_project_id, + format='tls', + name='my-tls-secret', + data={ + 'tls_key': '-----BEGIN RSA PRIVATE KEY----------END RSA PRIVATE KEY-----', + 'tls_cert': '---BEGIN CERTIFICATE------END CERTIFICATE---', + }, + ) + + assert response.get_status_code() == 201 + secret = response.get_result() + assert secret is not None + + @needscredentials + def test_create_basic_auth_secret(self): + response = self.code_engine_service.create_secret( + project_id=pytest.e2e_test_project_id, + format='basic_auth', + name='my-basic-auth-secret', + data={'username': 'user1', 'password': 'pass1'}, + ) + assert response.get_status_code() == 201 + secret = response.get_result() + assert secret is not None + + @needscredentials + def test_create_registry_secret(self): + response = self.code_engine_service.create_secret( + project_id=pytest.e2e_test_project_id, + format='registry', + name='my-registry-secret', + data={'username': 'user1', 'password': 'pass1', 'server': 'github.com', 'email': 'myemail@email.com'}, + ) + + assert response.get_status_code() == 201 + secret = response.get_result() + assert secret is not None + + @needscredentials + def test_get_secret(self): response = self.code_engine_service.get_secret( project_id=pytest.e2e_test_project_id, name='my-secret', @@ -915,8 +941,51 @@ def test_get_secret(self): assert secret is not None @needscredentials - def test_replace_secret(self): + def test_get_ssh_secret(self): + response = self.code_engine_service.get_secret( + project_id=pytest.e2e_test_project_id, + name='my-ssh-secret', + ) + + assert response.get_status_code() == 200 + secret = response.get_result() + assert secret is not None + + @needscredentials + def test_get_tls_secret(self): + response = self.code_engine_service.get_secret( + project_id=pytest.e2e_test_project_id, + name='my-tls-secret', + ) + + assert response.get_status_code() == 200 + secret = response.get_result() + assert secret is not None + + @needscredentials + def test_get_basic_auth_secret(self): + response = self.code_engine_service.get_secret( + project_id=pytest.e2e_test_project_id, + name='my-basic-auth-secret', + ) + + assert response.get_status_code() == 200 + secret = response.get_result() + assert secret is not None + + @needscredentials + def test_get_registry_secret(self): + response = self.code_engine_service.get_secret( + project_id=pytest.e2e_test_project_id, + name='my-registry-secret', + ) + + assert response.get_status_code() == 200 + secret = response.get_result() + assert secret is not None + @needscredentials + def test_replace_secret(self): response = self.code_engine_service.replace_secret( project_id=pytest.e2e_test_project_id, name='my-secret', @@ -930,8 +999,66 @@ def test_replace_secret(self): assert secret is not None @needscredentials - def test_delete_app_revision(self): + def test_replace_ssh_secret(self): + response = self.code_engine_service.replace_secret( + project_id=pytest.e2e_test_project_id, + name='my-ssh-secret', + if_match='*', + data={'ssh_key': '-----BEGIN RSA PRIVATE KEY----------END RSA PRIVATE KEY-----'}, + format='ssh_auth', + ) + + assert response.get_status_code() == 200 + secret = response.get_result() + assert secret is not None + + @needscredentials + def test_replace_tls_secret(self): + response = self.code_engine_service.replace_secret( + project_id=pytest.e2e_test_project_id, + name='my-tls-secret', + if_match='*', + data={ + 'tls_key': '-----BEGIN RSA PRIVATE KEY-----update-----END RSA PRIVATE KEY-----', + 'tls_cert': '---BEGIN CERTIFICATE---update---END CERTIFICATE---', + }, + format='tls', + ) + + assert response.get_status_code() == 200 + secret = response.get_result() + assert secret is not None + + @needscredentials + def test_replace_basic_auth_secret(self): + response = self.code_engine_service.replace_secret( + project_id=pytest.e2e_test_project_id, + name='my-basic-auth-secret', + if_match='*', + data={'username': 'user2', 'password': 'pass2'}, + format='basic_auth', + ) + + assert response.get_status_code() == 200 + secret = response.get_result() + assert secret is not None + + @needscredentials + def test_replace_registry_secret(self): + response = self.code_engine_service.replace_secret( + project_id=pytest.e2e_test_project_id, + name='my-registry-secret', + if_match='*', + data={'username': 'user2', 'password': 'pass2', 'server': 'github.com', 'email': 'myemail@email.com'}, + format='registry', + ) + + assert response.get_status_code() == 200 + secret = response.get_result() + assert secret is not None + @needscredentials + def test_delete_app_revision(self): response = self.code_engine_service.delete_app_revision( project_id=pytest.e2e_test_project_id, app_name='my-app', @@ -942,7 +1069,6 @@ def test_delete_app_revision(self): @needscredentials def test_delete_app(self): - response = self.code_engine_service.delete_app( project_id=pytest.e2e_test_project_id, name='my-app', @@ -952,7 +1078,6 @@ def test_delete_app(self): @needscredentials def test_delete_job_run(self): - response = self.code_engine_service.delete_job_run( project_id=pytest.e2e_test_project_id, name='my-job-run', @@ -962,7 +1087,6 @@ def test_delete_job_run(self): @needscredentials def test_delete_job(self): - response = self.code_engine_service.delete_job( project_id=pytest.e2e_test_project_id, name='my-job', @@ -972,7 +1096,6 @@ def test_delete_job(self): @needscredentials def test_delete_build_run(self): - response = self.code_engine_service.delete_build_run( project_id=pytest.e2e_test_project_id, name='my-build-run', @@ -982,7 +1105,6 @@ def test_delete_build_run(self): @needscredentials def test_delete_build(self): - response = self.code_engine_service.delete_build( project_id=pytest.e2e_test_project_id, name='my-build', @@ -992,7 +1114,6 @@ def test_delete_build(self): @needscredentials def test_delete_config_map(self): - response = self.code_engine_service.delete_config_map( project_id=pytest.e2e_test_project_id, name='my-config-map', @@ -1002,7 +1123,6 @@ def test_delete_config_map(self): @needscredentials def test_delete_secret(self): - response = self.code_engine_service.delete_secret( project_id=pytest.e2e_test_project_id, name='my-secret', @@ -1011,8 +1131,43 @@ def test_delete_secret(self): assert response.get_status_code() == 202 @needscredentials - def test_delete_project(self): + def test_delete_ssh_secret(self): + response = self.code_engine_service.delete_secret( + project_id=pytest.e2e_test_project_id, + name='my-ssh-secret', + ) + assert response.get_status_code() == 202 + + @needscredentials + def test_delete_tls_secret(self): + response = self.code_engine_service.delete_secret( + project_id=pytest.e2e_test_project_id, + name='my-tls-secret', + ) + + assert response.get_status_code() == 202 + + @needscredentials + def test_delete_basic_auth_secret(self): + response = self.code_engine_service.delete_secret( + project_id=pytest.e2e_test_project_id, + name='my-basic-auth-secret', + ) + + assert response.get_status_code() == 202 + + @needscredentials + def test_delete_registry_secret(self): + response = self.code_engine_service.delete_secret( + project_id=pytest.e2e_test_project_id, + name='my-registry-secret', + ) + + assert response.get_status_code() == 202 + + @needscredentials + def test_delete_project(self): response = self.code_engine_service.delete_project( id=pytest.e2e_test_project_id, ) diff --git a/test/unit/test_code_engine_v2.py b/test/unit/test_code_engine_v2.py index 04ad236..8dc00e7 100644 --- a/test/unit/test_code_engine_v2.py +++ b/test/unit/test_code_engine_v2.py @@ -1241,14 +1241,14 @@ def test_get_app_revision_all_params(self): get_app_revision() """ # Set up mock - url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/apps/my-app/revisions/my-app-001') + url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/apps/my-app/revisions/my-app-00001') mock_response = '{"app_name": "my-app", "created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/apps/my-app/revisions/my-app-00001", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_port": 8080, "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-app-00001", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "app_revision_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_concurrency": 100, "scale_concurrency_target": 80, "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_initial_instances": 1, "scale_max_instances": 10, "scale_memory_limit": "4G", "scale_min_instances": 1, "scale_request_timeout": 300, "status": "ready", "status_details": {"actual_instances": 1, "reason": "ready"}}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' app_name = 'my-app' - name = 'my-app-001' + name = 'my-app-00001' # Invoke method response = _service.get_app_revision(project_id, app_name, name, headers={}) @@ -1272,14 +1272,14 @@ def test_get_app_revision_value_error(self): test_get_app_revision_value_error() """ # Set up mock - url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/apps/my-app/revisions/my-app-001') + url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/apps/my-app/revisions/my-app-00001') mock_response = '{"app_name": "my-app", "created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/apps/my-app/revisions/my-app-00001", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_port": 8080, "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-app-00001", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "app_revision_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_concurrency": 100, "scale_concurrency_target": 80, "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_initial_instances": 1, "scale_max_instances": 10, "scale_memory_limit": "4G", "scale_min_instances": 1, "scale_request_timeout": 300, "status": "ready", "status_details": {"actual_instances": 1, "reason": "ready"}}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' app_name = 'my-app' - name = 'my-app-001' + name = 'my-app-00001' # Pass in all but one required param and check for a ValueError req_param_dict = { @@ -1313,13 +1313,13 @@ def test_delete_app_revision_all_params(self): delete_app_revision() """ # Set up mock - url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/apps/my-app/revisions/my-app-001') + url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/apps/my-app/revisions/my-app-00001') responses.add(responses.DELETE, url, status=202) # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' app_name = 'my-app' - name = 'my-app-001' + name = 'my-app-00001' # Invoke method response = _service.delete_app_revision(project_id, app_name, name, headers={}) @@ -1343,13 +1343,13 @@ def test_delete_app_revision_value_error(self): test_delete_app_revision_value_error() """ # Set up mock - url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/apps/my-app/revisions/my-app-001') + url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/apps/my-app/revisions/my-app-00001') responses.add(responses.DELETE, url, status=202) # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' app_name = 'my-app' - name = 'my-app-001' + name = 'my-app-00001' # Pass in all but one required param and check for a ValueError req_param_dict = { @@ -1423,7 +1423,7 @@ def test_list_jobs_all_params(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/jobs') - mock_response = '{"first": {"href": "href"}, "jobs": [{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}], "limit": 100, "next": {"href": "href", "start": "start"}}' + mock_response = '{"first": {"href": "href"}, "jobs": [{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}], "limit": 100, "next": {"href": "href", "start": "start"}}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values @@ -1459,7 +1459,7 @@ def test_list_jobs_required_params(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/jobs') - mock_response = '{"first": {"href": "href"}, "jobs": [{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}], "limit": 100, "next": {"href": "href", "start": "start"}}' + mock_response = '{"first": {"href": "href"}, "jobs": [{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}], "limit": 100, "next": {"href": "href", "start": "start"}}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values @@ -1488,7 +1488,7 @@ def test_list_jobs_value_error(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/jobs') - mock_response = '{"first": {"href": "href"}, "jobs": [{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}], "limit": 100, "next": {"href": "href", "start": "start"}}' + mock_response = '{"first": {"href": "href"}, "jobs": [{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}], "limit": 100, "next": {"href": "href", "start": "start"}}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values @@ -1519,8 +1519,8 @@ def test_list_jobs_with_pager_get_next(self): """ # Set up a two-page mock response url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/jobs') - mock_response1 = '{"next":{"start":"1"},"total_count":2,"jobs":[{"created_at":"2022-09-13T11:41:35+02:00","entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","name":"my-job","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"daemon","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3}],"limit":1}' - mock_response2 = '{"total_count":2,"jobs":[{"created_at":"2022-09-13T11:41:35+02:00","entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","name":"my-job","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"daemon","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3}],"limit":1}' + mock_response1 = '{"next":{"start":"1"},"total_count":2,"jobs":[{"created_at":"2022-09-13T11:41:35+02:00","entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","name":"my-job","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"task","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3}],"limit":1}' + mock_response2 = '{"total_count":2,"jobs":[{"created_at":"2022-09-13T11:41:35+02:00","entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","name":"my-job","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"task","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3}],"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) @@ -1544,8 +1544,8 @@ def test_list_jobs_with_pager_get_all(self): """ # Set up a two-page mock response url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/jobs') - mock_response1 = '{"next":{"start":"1"},"total_count":2,"jobs":[{"created_at":"2022-09-13T11:41:35+02:00","entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","name":"my-job","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"daemon","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3}],"limit":1}' - mock_response2 = '{"total_count":2,"jobs":[{"created_at":"2022-09-13T11:41:35+02:00","entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","name":"my-job","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"daemon","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3}],"limit":1}' + mock_response1 = '{"next":{"start":"1"},"total_count":2,"jobs":[{"created_at":"2022-09-13T11:41:35+02:00","entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","name":"my-job","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"task","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3}],"limit":1}' + mock_response2 = '{"total_count":2,"jobs":[{"created_at":"2022-09-13T11:41:35+02:00","entity_tag":"2385407409","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","name":"my-job","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"task","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3}],"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) @@ -1572,7 +1572,7 @@ def test_create_job_all_params(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/jobs') - mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}' + mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) # Construct a dict representation of a EnvVarPrototype model @@ -1600,7 +1600,7 @@ def test_create_job_all_params(self): run_as_user = 1001 run_commands = ['testString'] run_env_variables = [env_var_prototype_model] - run_mode = 'daemon' + run_mode = 'task' run_service_account = 'default' run_volume_mounts = [volume_mount_prototype_model] scale_array_spec = '1-5,7-8,10' @@ -1644,7 +1644,7 @@ def test_create_job_all_params(self): assert req_body['run_as_user'] == 1001 assert req_body['run_commands'] == ['testString'] assert req_body['run_env_variables'] == [env_var_prototype_model] - assert req_body['run_mode'] == 'daemon' + assert req_body['run_mode'] == 'task' assert req_body['run_service_account'] == 'default' assert req_body['run_volume_mounts'] == [volume_mount_prototype_model] assert req_body['scale_array_spec'] == '1-5,7-8,10' @@ -1670,7 +1670,7 @@ def test_create_job_value_error(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/jobs') - mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}' + mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) # Construct a dict representation of a EnvVarPrototype model @@ -1698,7 +1698,7 @@ def test_create_job_value_error(self): run_as_user = 1001 run_commands = ['testString'] run_env_variables = [env_var_prototype_model] - run_mode = 'daemon' + run_mode = 'task' run_service_account = 'default' run_volume_mounts = [volume_mount_prototype_model] scale_array_spec = '1-5,7-8,10' @@ -1741,7 +1741,7 @@ def test_get_job_all_params(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/jobs/my-job') - mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}' + mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values @@ -1771,7 +1771,7 @@ def test_get_job_value_error(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/jobs/my-job') - mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}' + mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values @@ -1877,7 +1877,7 @@ def test_update_job_all_params(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/jobs/my-job') - mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}' + mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) # Construct a dict representation of a EnvVarPrototype model @@ -1904,7 +1904,7 @@ def test_update_job_all_params(self): job_patch_model['run_as_user'] = 1001 job_patch_model['run_commands'] = ['testString'] job_patch_model['run_env_variables'] = [env_var_prototype_model] - job_patch_model['run_mode'] = 'daemon' + job_patch_model['run_mode'] = 'task' job_patch_model['run_service_account'] = 'default' job_patch_model['run_volume_mounts'] = [volume_mount_prototype_model] job_patch_model['scale_array_spec'] = '1-5,7-8,10' @@ -1946,7 +1946,7 @@ def test_update_job_value_error(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/jobs/my-job') - mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}' + mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "entity_tag": "2385407409", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "name": "my-job", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) # Construct a dict representation of a EnvVarPrototype model @@ -1973,7 +1973,7 @@ def test_update_job_value_error(self): job_patch_model['run_as_user'] = 1001 job_patch_model['run_commands'] = ['testString'] job_patch_model['run_env_variables'] = [env_var_prototype_model] - job_patch_model['run_mode'] = 'daemon' + job_patch_model['run_mode'] = 'task' job_patch_model['run_service_account'] = 'default' job_patch_model['run_volume_mounts'] = [volume_mount_prototype_model] job_patch_model['scale_array_spec'] = '1-5,7-8,10' @@ -2023,7 +2023,7 @@ def test_list_job_runs_all_params(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs') - mock_response = '{"first": {"href": "href"}, "job_runs": [{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}], "limit": 100, "next": {"href": "href", "start": "start"}}' + mock_response = '{"first": {"href": "href"}, "job_runs": [{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}], "limit": 100, "next": {"href": "href", "start": "start"}}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values @@ -2061,7 +2061,7 @@ def test_list_job_runs_required_params(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs') - mock_response = '{"first": {"href": "href"}, "job_runs": [{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}], "limit": 100, "next": {"href": "href", "start": "start"}}' + mock_response = '{"first": {"href": "href"}, "job_runs": [{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}], "limit": 100, "next": {"href": "href", "start": "start"}}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values @@ -2090,7 +2090,7 @@ def test_list_job_runs_value_error(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs') - mock_response = '{"first": {"href": "href"}, "job_runs": [{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}], "limit": 100, "next": {"href": "href", "start": "start"}}' + mock_response = '{"first": {"href": "href"}, "job_runs": [{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}], "limit": 100, "next": {"href": "href", "start": "start"}}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values @@ -2121,8 +2121,8 @@ def test_list_job_runs_with_pager_get_next(self): """ # Set up a two-page mock response url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs') - mock_response1 = '{"next":{"start":"1"},"job_runs":[{"created_at":"2022-09-13T11:41:35+02:00","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","job_name":"my-job","name":"my-job-run","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_run_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"daemon","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3,"status":"completed","status_details":{"completion_time":"2022-09-22T17:40:00Z","failed":0,"pending":0,"requested":0,"running":0,"start_time":"2022-09-22T17:34:00Z","succeeded":1,"unknown":0}}],"total_count":2,"limit":1}' - mock_response2 = '{"job_runs":[{"created_at":"2022-09-13T11:41:35+02:00","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","job_name":"my-job","name":"my-job-run","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_run_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"daemon","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3,"status":"completed","status_details":{"completion_time":"2022-09-22T17:40:00Z","failed":0,"pending":0,"requested":0,"running":0,"start_time":"2022-09-22T17:34:00Z","succeeded":1,"unknown":0}}],"total_count":2,"limit":1}' + mock_response1 = '{"next":{"start":"1"},"job_runs":[{"created_at":"2022-09-13T11:41:35+02:00","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","job_name":"my-job","name":"my-job-run","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_run_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"task","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3,"status":"completed","status_details":{"completion_time":"2022-09-22T17:40:00Z","failed":0,"pending":0,"requested":0,"running":0,"start_time":"2022-09-22T17:34:00Z","succeeded":1,"unknown":0}}],"total_count":2,"limit":1}' + mock_response2 = '{"job_runs":[{"created_at":"2022-09-13T11:41:35+02:00","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","job_name":"my-job","name":"my-job-run","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_run_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"task","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3,"status":"completed","status_details":{"completion_time":"2022-09-22T17:40:00Z","failed":0,"pending":0,"requested":0,"running":0,"start_time":"2022-09-22T17:34:00Z","succeeded":1,"unknown":0}}],"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) @@ -2147,8 +2147,8 @@ def test_list_job_runs_with_pager_get_all(self): """ # Set up a two-page mock response url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs') - mock_response1 = '{"next":{"start":"1"},"job_runs":[{"created_at":"2022-09-13T11:41:35+02:00","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","job_name":"my-job","name":"my-job-run","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_run_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"daemon","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3,"status":"completed","status_details":{"completion_time":"2022-09-22T17:40:00Z","failed":0,"pending":0,"requested":0,"running":0,"start_time":"2022-09-22T17:34:00Z","succeeded":1,"unknown":0}}],"total_count":2,"limit":1}' - mock_response2 = '{"job_runs":[{"created_at":"2022-09-13T11:41:35+02:00","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","job_name":"my-job","name":"my-job-run","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_run_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"daemon","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3,"status":"completed","status_details":{"completion_time":"2022-09-22T17:40:00Z","failed":0,"pending":0,"requested":0,"running":0,"start_time":"2022-09-22T17:34:00Z","succeeded":1,"unknown":0}}],"total_count":2,"limit":1}' + mock_response1 = '{"next":{"start":"1"},"job_runs":[{"created_at":"2022-09-13T11:41:35+02:00","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","job_name":"my-job","name":"my-job-run","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_run_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"task","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3,"status":"completed","status_details":{"completion_time":"2022-09-22T17:40:00Z","failed":0,"pending":0,"requested":0,"running":0,"start_time":"2022-09-22T17:34:00Z","succeeded":1,"unknown":0}}],"total_count":2,"limit":1}' + mock_response2 = '{"job_runs":[{"created_at":"2022-09-13T11:41:35+02:00","href":"https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run","id":"e33b1cv7-7390-4437-a5c2-130d5ccdddc3","image_reference":"icr.io/codeengine/helloworld","image_secret":"my-secret","job_name":"my-job","name":"my-job-run","project_id":"4e49b3e0-27a8-48d2-a784-c7ee48bb863b","resource_type":"job_run_v2","run_arguments":["run_arguments"],"run_as_user":1001,"run_commands":["run_commands"],"run_env_variables":[{"key":"MY_VARIABLE","name":"SOME","prefix":"PREFIX_","reference":"my-secret","type":"literal","value":"VALUE"}],"run_mode":"task","run_service_account":"default","run_volume_mounts":[{"mount_path":"/app","name":"codeengine-mount-b69u90","reference":"my-secret","type":"secret"}],"scale_array_spec":"1-5,7-8,10","scale_cpu_limit":"1","scale_ephemeral_storage_limit":"4G","scale_max_execution_time":7200,"scale_memory_limit":"4G","scale_retry_limit":3,"status":"completed","status_details":{"completion_time":"2022-09-22T17:40:00Z","failed":0,"pending":0,"requested":0,"running":0,"start_time":"2022-09-22T17:34:00Z","succeeded":1,"unknown":0}}],"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) @@ -2176,7 +2176,7 @@ def test_create_job_run_all_params(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs') - mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}' + mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=202) # Construct a dict representation of a EnvVarPrototype model @@ -2205,7 +2205,7 @@ def test_create_job_run_all_params(self): run_as_user = 1001 run_commands = ['testString'] run_env_variables = [env_var_prototype_model] - run_mode = 'daemon' + run_mode = 'task' run_service_account = 'default' run_volume_mounts = [volume_mount_prototype_model] scale_array_spec = '1-5,7-8,10' @@ -2251,7 +2251,7 @@ def test_create_job_run_all_params(self): assert req_body['run_as_user'] == 1001 assert req_body['run_commands'] == ['testString'] assert req_body['run_env_variables'] == [env_var_prototype_model] - assert req_body['run_mode'] == 'daemon' + assert req_body['run_mode'] == 'task' assert req_body['run_service_account'] == 'default' assert req_body['run_volume_mounts'] == [volume_mount_prototype_model] assert req_body['scale_array_spec'] == '1-5,7-8,10' @@ -2277,7 +2277,7 @@ def test_create_job_run_value_error(self): """ # Set up mock url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs') - mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}' + mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=202) # Construct a dict representation of a EnvVarPrototype model @@ -2306,7 +2306,7 @@ def test_create_job_run_value_error(self): run_as_user = 1001 run_commands = ['testString'] run_env_variables = [env_var_prototype_model] - run_mode = 'daemon' + run_mode = 'task' run_service_account = 'default' run_volume_mounts = [volume_mount_prototype_model] scale_array_spec = '1-5,7-8,10' @@ -2346,13 +2346,13 @@ def test_get_job_run_all_params(self): get_job_run() """ # Set up mock - url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs/my-job') - mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}' + url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs/my-job-run') + mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' - name = 'my-job' + name = 'my-job-run' # Invoke method response = _service.get_job_run(project_id, name, headers={}) @@ -2376,13 +2376,13 @@ def test_get_job_run_value_error(self): test_get_job_run_value_error() """ # Set up mock - url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs/my-job') - mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "daemon", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}' + url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs/my-job-run') + mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "image_reference": "icr.io/codeengine/helloworld", "image_secret": "my-secret", "job_name": "my-job", "name": "my-job-run", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "job_run_v2", "run_arguments": ["run_arguments"], "run_as_user": 1001, "run_commands": ["run_commands"], "run_env_variables": [{"key": "MY_VARIABLE", "name": "SOME", "prefix": "PREFIX_", "reference": "my-secret", "type": "literal", "value": "VALUE"}], "run_mode": "task", "run_service_account": "default", "run_volume_mounts": [{"mount_path": "/app", "name": "codeengine-mount-b69u90", "reference": "my-secret", "type": "secret"}], "scale_array_spec": "1-5,7-8,10", "scale_cpu_limit": "1", "scale_ephemeral_storage_limit": "4G", "scale_max_execution_time": 7200, "scale_memory_limit": "4G", "scale_retry_limit": 3, "status": "completed", "status_details": {"completion_time": "2022-09-22T17:40:00Z", "failed": 0, "pending": 0, "requested": 0, "running": 0, "start_time": "2022-09-22T17:34:00Z", "succeeded": 1, "unknown": 0}}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' - name = 'my-job' + name = 'my-job-run' # Pass in all but one required param and check for a ValueError req_param_dict = { @@ -2415,12 +2415,12 @@ def test_delete_job_run_all_params(self): delete_job_run() """ # Set up mock - url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs/my-job') + url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs/my-job-run') responses.add(responses.DELETE, url, status=202) # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' - name = 'my-job' + name = 'my-job-run' # Invoke method response = _service.delete_job_run(project_id, name, headers={}) @@ -2444,12 +2444,12 @@ def test_delete_job_run_value_error(self): test_delete_job_run_value_error() """ # Set up mock - url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs/my-job') + url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/job_runs/my-job-run') responses.add(responses.DELETE, url, status=202) # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' - name = 'my-job' + name = 'my-job-run' # Pass in all but one required param and check for a ValueError req_param_dict = { @@ -3646,7 +3646,7 @@ def test_create_config_map_all_params(self): # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' - name = 'my-configmap' + name = 'my-config-map' data = {'key1': 'testString'} # Invoke method @@ -3657,7 +3657,7 @@ def test_create_config_map_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-configmap' + assert req_body['name'] == 'my-config-map' assert req_body['data'] == {'key1': 'testString'} def test_create_config_map_all_params_with_retries(self): @@ -3681,7 +3681,7 @@ def test_create_config_map_value_error(self): # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' - name = 'my-configmap' + name = 'my-config-map' data = {'key1': 'testString'} # Pass in all but one required param and check for a ValueError @@ -4081,11 +4081,17 @@ def test_create_secret_all_params(self): mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "data": {"mapKey": "inner"}, "entity_tag": "2385407409", "format": "generic", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/secrets/my-secret", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "name": "my-secret", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "resource_type"}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) + # Construct a dict representation of a SecretDataSSHSecretData model + secret_data_model = {} + secret_data_model['ssh_key'] = 'testString' + secret_data_model['known_hosts'] = 'testString' + secret_data_model['foo'] = 'testString' + # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' format = 'generic' name = 'my-secret' - data = {'key1': 'testString'} + data = secret_data_model # Invoke method response = _service.create_secret(project_id, format, name, data=data, headers={}) @@ -4097,7 +4103,7 @@ def test_create_secret_all_params(self): req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) assert req_body['format'] == 'generic' assert req_body['name'] == 'my-secret' - assert req_body['data'] == {'key1': 'testString'} + assert req_body['data'] == secret_data_model def test_create_secret_all_params_with_retries(self): # Enable retries and run test_create_secret_all_params. @@ -4118,11 +4124,17 @@ def test_create_secret_value_error(self): mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "data": {"mapKey": "inner"}, "entity_tag": "2385407409", "format": "generic", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/secrets/my-secret", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "name": "my-secret", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "resource_type"}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) + # Construct a dict representation of a SecretDataSSHSecretData model + secret_data_model = {} + secret_data_model['ssh_key'] = 'testString' + secret_data_model['known_hosts'] = 'testString' + secret_data_model['foo'] = 'testString' + # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' format = 'generic' name = 'my-secret' - data = {'key1': 'testString'} + data = secret_data_model # Pass in all but one required param and check for a ValueError req_param_dict = { @@ -4229,11 +4241,17 @@ def test_replace_secret_all_params(self): mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "data": {"mapKey": "inner"}, "entity_tag": "2385407409", "format": "generic", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/secrets/my-secret", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "name": "my-secret", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "resource_type"}' responses.add(responses.PUT, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a SecretDataSSHSecretData model + secret_data_model = {} + secret_data_model['ssh_key'] = 'testString' + secret_data_model['known_hosts'] = 'testString' + secret_data_model['foo'] = 'testString' + # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' name = 'my-secret' if_match = 'testString' - data = {'key1': 'testString'} + data = secret_data_model format = 'generic' # Invoke method @@ -4244,7 +4262,7 @@ def test_replace_secret_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['data'] == {'key1': 'testString'} + assert req_body['data'] == secret_data_model assert req_body['format'] == 'generic' def test_replace_secret_all_params_with_retries(self): @@ -4266,11 +4284,17 @@ def test_replace_secret_value_error(self): mock_response = '{"created_at": "2022-09-13T11:41:35+02:00", "data": {"mapKey": "inner"}, "entity_tag": "2385407409", "format": "generic", "href": "https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/secrets/my-secret", "id": "e33b1cv7-7390-4437-a5c2-130d5ccdddc3", "name": "my-secret", "project_id": "4e49b3e0-27a8-48d2-a784-c7ee48bb863b", "resource_type": "resource_type"}' responses.add(responses.PUT, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a SecretDataSSHSecretData model + secret_data_model = {} + secret_data_model['ssh_key'] = 'testString' + secret_data_model['known_hosts'] = 'testString' + secret_data_model['foo'] = 'testString' + # Set up parameter values project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' name = 'my-secret' if_match = 'testString' - data = {'key1': 'testString'} + data = secret_data_model format = 'generic' # Pass in all but one required param and check for a ValueError @@ -4398,27 +4422,15 @@ def test_app_serialization(self): volume_mount_model['type'] = 'secret' app_status_model = {} # AppStatus - app_status_model['latest_created_revision'] = 'my-app-00001' - app_status_model['latest_ready_revision'] = 'my-app-00001' - app_status_model['reason'] = 'ready' # Construct a json representation of a App model app_model_json = {} - app_model_json['created_at'] = '2022-09-13T11:41:35+02:00' - app_model_json['endpoint'] = 'https://my-app.vg67hzldruk.eu-de.codeengine.appdomain.cloud' - app_model_json['endpoint_internal'] = 'http://my-app.vg67hzldruk.svc.cluster.local' app_model_json['entity_tag'] = '2385407409' - app_model_json[ - 'href' - ] = 'https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/apps/my-app' - app_model_json['id'] = 'e33b1cv7-7390-4437-a5c2-130d5ccdddc3' app_model_json['image_port'] = 8080 app_model_json['image_reference'] = 'icr.io/codeengine/helloworld' app_model_json['image_secret'] = 'my-secret' app_model_json['managed_domain_mappings'] = 'local_public' app_model_json['name'] = 'my-app' - app_model_json['project_id'] = '4e49b3e0-27a8-48d2-a784-c7ee48bb863b' - app_model_json['resource_type'] = 'app_v2' app_model_json['run_arguments'] = ['testString'] app_model_json['run_as_user'] = 1001 app_model_json['run_commands'] = ['testString'] @@ -4434,7 +4446,6 @@ def test_app_serialization(self): app_model_json['scale_memory_limit'] = '4G' app_model_json['scale_min_instances'] = 1 app_model_json['scale_request_timeout'] = 300 - app_model_json['status'] = 'ready' app_model_json['status_details'] = app_status_model # Construct a model instance of App by calling from_dict on the json representation @@ -4480,26 +4491,14 @@ def test_app_list_serialization(self): volume_mount_model['type'] = 'secret' app_status_model = {} # AppStatus - app_status_model['latest_created_revision'] = 'my-app-00001' - app_status_model['latest_ready_revision'] = 'my-app-00001' - app_status_model['reason'] = 'ready' app_model = {} # App - app_model['created_at'] = '2022-11-15T22:07:55+01:00' - app_model['endpoint'] = 'https://my-app.vg67hzldruk.eu-de.codeengine.appdomain.cloud' - app_model['endpoint_internal'] = 'http://my-app.vg67hzldruk.svc.cluster.local' app_model['entity_tag'] = '1' - app_model[ - 'href' - ] = 'https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/apps/my-app' - app_model['id'] = '230828b4-4f15-40a9-b183-1268c6ab88d5' app_model['image_port'] = 8080 app_model['image_reference'] = 'icr.io/codeengine/helloworld' app_model['image_secret'] = 'my-secret' app_model['managed_domain_mappings'] = 'local_public' app_model['name'] = 'my-app' - app_model['project_id'] = '15314cc3-85b4-4338-903f-c28cdee6d005' - app_model['resource_type'] = 'app_v2' app_model['run_arguments'] = [] app_model['run_as_user'] = 1001 app_model['run_commands'] = [] @@ -4515,7 +4514,6 @@ def test_app_list_serialization(self): app_model['scale_memory_limit'] = '4G' app_model['scale_min_instances'] = 0 app_model['scale_request_timeout'] = 300 - app_model['status'] = 'ready' app_model['status_details'] = app_status_model list_first_metadata_model = {} # ListFirstMetadata @@ -4639,23 +4637,13 @@ def test_app_revision_serialization(self): volume_mount_model['type'] = 'secret' app_revision_status_model = {} # AppRevisionStatus - app_revision_status_model['actual_instances'] = 1 - app_revision_status_model['reason'] = 'ready' # Construct a json representation of a AppRevision model app_revision_model_json = {} app_revision_model_json['app_name'] = 'my-app' - app_revision_model_json['created_at'] = '2022-09-13T11:41:35+02:00' - app_revision_model_json[ - 'href' - ] = 'https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/apps/my-app/revisions/my-app-00001' - app_revision_model_json['id'] = 'e33b1cv7-7390-4437-a5c2-130d5ccdddc3' app_revision_model_json['image_port'] = 8080 app_revision_model_json['image_reference'] = 'icr.io/codeengine/helloworld' app_revision_model_json['image_secret'] = 'my-secret' - app_revision_model_json['name'] = 'my-app-00001' - app_revision_model_json['project_id'] = '4e49b3e0-27a8-48d2-a784-c7ee48bb863b' - app_revision_model_json['resource_type'] = 'app_revision_v2' app_revision_model_json['run_arguments'] = ['testString'] app_revision_model_json['run_as_user'] = 1001 app_revision_model_json['run_commands'] = ['testString'] @@ -4671,7 +4659,6 @@ def test_app_revision_serialization(self): app_revision_model_json['scale_memory_limit'] = '4G' app_revision_model_json['scale_min_instances'] = 1 app_revision_model_json['scale_request_timeout'] = 300 - app_revision_model_json['status'] = 'ready' app_revision_model_json['status_details'] = app_revision_status_model # Construct a model instance of AppRevision by calling from_dict on the json representation @@ -4724,22 +4711,12 @@ def test_app_revision_list_serialization(self): volume_mount_model['type'] = 'secret' app_revision_status_model = {} # AppRevisionStatus - app_revision_status_model['actual_instances'] = 1 - app_revision_status_model['reason'] = 'ready' app_revision_model = {} # AppRevision app_revision_model['app_name'] = 'my-app' - app_revision_model['created_at'] = '2022-11-15T22:07:55+01:00' - app_revision_model[ - 'href' - ] = 'https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/apps/my-app/revisions/my-app-00001' - app_revision_model['id'] = 'b63b3e28-2c1b-4784-9cd6-18c201fc6806' app_revision_model['image_port'] = 8080 app_revision_model['image_reference'] = 'icr.io/codeengine/helloworld' app_revision_model['image_secret'] = 'my-secret' - app_revision_model['name'] = 'my-app-00001' - app_revision_model['project_id'] = '230828b4-4f15-40a9-b183-1268c6ab88d5' - app_revision_model['resource_type'] = 'app_revision_v2' app_revision_model['run_arguments'] = [] app_revision_model['run_as_user'] = 1001 app_revision_model['run_commands'] = [] @@ -4755,7 +4732,6 @@ def test_app_revision_list_serialization(self): app_revision_model['scale_memory_limit'] = '4G' app_revision_model['scale_min_instances'] = 0 app_revision_model['scale_request_timeout'] = 300 - app_revision_model['status'] = 'ready' app_revision_model['status_details'] = app_revision_status_model # Construct a json representation of a AppRevisionList model @@ -4793,8 +4769,6 @@ def test_app_revision_status_serialization(self): # Construct a json representation of a AppRevisionStatus model app_revision_status_model_json = {} - app_revision_status_model_json['actual_instances'] = 1 - app_revision_status_model_json['reason'] = 'ready' # Construct a model instance of AppRevisionStatus by calling from_dict on the json representation app_revision_status_model = AppRevisionStatus.from_dict(app_revision_status_model_json) @@ -4824,9 +4798,6 @@ def test_app_status_serialization(self): # Construct a json representation of a AppStatus model app_status_model_json = {} - app_status_model_json['latest_created_revision'] = 'my-app-00001' - app_status_model_json['latest_ready_revision'] = 'my-app-00001' - app_status_model_json['reason'] = 'ready' # Construct a model instance of AppStatus by calling from_dict on the json representation app_status_model = AppStatus.from_dict(app_status_model_json) @@ -4857,27 +4828,18 @@ def test_build_serialization(self): # Construct dict forms of any model objects needed in order to build this model. build_status_model = {} # BuildStatus - build_status_model['reason'] = 'registered' # Construct a json representation of a Build model build_model_json = {} - build_model_json['created_at'] = '2022-09-13T11:41:35+02:00' build_model_json['entity_tag'] = '2385407409' - build_model_json[ - 'href' - ] = 'https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/builds/my-build' - build_model_json['id'] = 'e33b1cv7-7390-4437-a5c2-130d5ccdddc3' build_model_json['name'] = 'my-build' build_model_json['output_image'] = 'private.de.icr.io/icr_namespace/image-name' build_model_json['output_secret'] = 'ce-auto-icr-private-eu-de' - build_model_json['project_id'] = '4e49b3e0-27a8-48d2-a784-c7ee48bb863b' - build_model_json['resource_type'] = 'build_v2' build_model_json['source_context_dir'] = 'some/subfolder' build_model_json['source_revision'] = 'main' build_model_json['source_secret'] = 'testString' build_model_json['source_type'] = 'git' build_model_json['source_url'] = 'https://github.com/IBM/CodeEngine' - build_model_json['status'] = 'ready' build_model_json['status_details'] = build_status_model build_model_json['strategy_size'] = 'medium' build_model_json['strategy_spec_file'] = 'Dockerfile' @@ -4913,26 +4875,17 @@ def test_build_list_serialization(self): # Construct dict forms of any model objects needed in order to build this model. build_status_model = {} # BuildStatus - build_status_model['reason'] = 'registered' build_model = {} # Build - build_model['created_at'] = '2022-11-15T11:31:27+01:00' build_model['entity_tag'] = '2385407409' - build_model[ - 'href' - ] = 'https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/builds/my-build' - build_model['id'] = '27587824-aba8-4f70-8c1d-416326907049' build_model['name'] = 'my-build' build_model['output_image'] = 'private.de.icr.io/icr_namespace/test-image-1' build_model['output_secret'] = 'ce-auto-icr-private-eu-de' - build_model['project_id'] = '230828b4-4f15-40a9-b183-1268c6ab88d5' - build_model['resource_type'] = 'build_v2' build_model['source_context_dir'] = 'some/subfolder' build_model['source_revision'] = 'main' build_model['source_secret'] = 'testString' build_model['source_type'] = 'git' build_model['source_url'] = 'https://github.com/IBM/CodeEngine' - build_model['status'] = 'ready' build_model['status_details'] = build_status_model build_model['strategy_size'] = 'medium' build_model['strategy_spec_file'] = 'Dockerfile' @@ -5022,33 +4975,19 @@ def test_build_run_serialization(self): # Construct dict forms of any model objects needed in order to build this model. build_run_status_model = {} # BuildRunStatus - build_run_status_model['completion_time'] = '2022-09-22T17:40:00Z' - build_run_status_model[ - 'output_digest' - ] = 'sha256:9a3d845c629d2b4a6b271b1d526dfafc1e7d9511f8863b43b5bb0483ef626384' - build_run_status_model['reason'] = 'succeeded' - build_run_status_model['start_time'] = '2022-09-22T17:34:00Z' # Construct a json representation of a BuildRun model build_run_model_json = {} build_run_model_json['build_name'] = 'testString' - build_run_model_json['created_at'] = '2022-09-13T11:41:35+02:00' - build_run_model_json[ - 'href' - ] = 'https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/build_runs/my-build-run' - build_run_model_json['id'] = 'e33b1cv7-7390-4437-a5c2-130d5ccdddc3' build_run_model_json['name'] = 'my-build-run' build_run_model_json['output_image'] = 'private.de.icr.io/icr_namespace/image-name' build_run_model_json['output_secret'] = 'ce-auto-icr-private-eu-de' - build_run_model_json['project_id'] = '4e49b3e0-27a8-48d2-a784-c7ee48bb863b' - build_run_model_json['resource_type'] = 'build_run_v2' build_run_model_json['service_account'] = 'default' build_run_model_json['source_context_dir'] = 'some/subfolder' build_run_model_json['source_revision'] = 'main' build_run_model_json['source_secret'] = 'testString' build_run_model_json['source_type'] = 'git' build_run_model_json['source_url'] = 'https://github.com/IBM/CodeEngine' - build_run_model_json['status'] = 'succeeded' build_run_model_json['status_details'] = build_run_status_model build_run_model_json['strategy_size'] = 'medium' build_run_model_json['strategy_spec_file'] = 'Dockerfile' @@ -5084,32 +5023,18 @@ def test_build_run_list_serialization(self): # Construct dict forms of any model objects needed in order to build this model. build_run_status_model = {} # BuildRunStatus - build_run_status_model['completion_time'] = '2022-09-22T17:40:00Z' - build_run_status_model[ - 'output_digest' - ] = 'sha256:9a3d845c629d2b4a6b271b1d526dfafc1e7d9511f8863b43b5bb0483ef626384' - build_run_status_model['reason'] = 'succeeded' - build_run_status_model['start_time'] = '2022-09-22T17:34:00Z' build_run_model = {} # BuildRun build_run_model['build_name'] = 'my-build' - build_run_model['created_at'] = '2022-06-20T10:10:00+02:00' - build_run_model[ - 'href' - ] = 'https://api.us-east.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/build_runs/my-buildrun-1' - build_run_model['id'] = 'ca151bf7-b1bf-4e18-a1cb-857329c2d097' build_run_model['name'] = 'my-buildrun-1' build_run_model['output_image'] = 'private.de.icr.io/icr_namespace/image-name' build_run_model['output_secret'] = 'ce-auto-icr-private-eu-de' - build_run_model['project_id'] = '4e49b3e0-27a8-48d2-a784-c7ee48bb863b' - build_run_model['resource_type'] = 'build_run_v2' build_run_model['service_account'] = 'default' build_run_model['source_context_dir'] = 'some/subfolder' build_run_model['source_revision'] = 'main' build_run_model['source_secret'] = 'testString' build_run_model['source_type'] = 'git' build_run_model['source_url'] = 'https://github.com/IBM/CodeEngine' - build_run_model['status'] = 'succeeded' build_run_model['status_details'] = build_run_status_model build_run_model['strategy_size'] = 'medium' build_run_model['strategy_spec_file'] = 'Dockerfile' @@ -5158,12 +5083,6 @@ def test_build_run_status_serialization(self): # Construct a json representation of a BuildRunStatus model build_run_status_model_json = {} - build_run_status_model_json['completion_time'] = '2022-09-22T17:40:00Z' - build_run_status_model_json[ - 'output_digest' - ] = 'sha256:9a3d845c629d2b4a6b271b1d526dfafc1e7d9511f8863b43b5bb0483ef626384' - build_run_status_model_json['reason'] = 'succeeded' - build_run_status_model_json['start_time'] = '2022-09-22T17:34:00Z' # Construct a model instance of BuildRunStatus by calling from_dict on the json representation build_run_status_model = BuildRunStatus.from_dict(build_run_status_model_json) @@ -5193,7 +5112,6 @@ def test_build_status_serialization(self): # Construct a json representation of a BuildStatus model build_status_model_json = {} - build_status_model_json['reason'] = 'registered' # Construct a model instance of BuildStatus by calling from_dict on the json representation build_status_model = BuildStatus.from_dict(build_status_model_json) @@ -5223,16 +5141,9 @@ def test_config_map_serialization(self): # Construct a json representation of a ConfigMap model config_map_model_json = {} - config_map_model_json['created_at'] = '2022-09-13T11:41:35+02:00' config_map_model_json['data'] = {'key1': 'testString'} config_map_model_json['entity_tag'] = '2385407409' - config_map_model_json[ - 'href' - ] = 'https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/config_maps/my-config-map' - config_map_model_json['id'] = 'e33b1cv7-7390-4437-a5c2-130d5ccdddc3' config_map_model_json['name'] = 'my-config-map' - config_map_model_json['project_id'] = '4e49b3e0-27a8-48d2-a784-c7ee48bb863b' - config_map_model_json['resource_type'] = 'config_map_v2' # Construct a model instance of ConfigMap by calling from_dict on the json representation config_map_model = ConfigMap.from_dict(config_map_model_json) @@ -5263,16 +5174,9 @@ def test_config_map_list_serialization(self): # Construct dict forms of any model objects needed in order to build this model. config_map_model = {} # ConfigMap - config_map_model['created_at'] = '2022-11-15T21:45:49+01:00' config_map_model['data'] = {'key1': 'testString'} config_map_model['entity_tag'] = '2386238209' - config_map_model[ - 'href' - ] = 'https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/config_maps/my-config-map' - config_map_model['id'] = 'b8376985-d6df-43c5-8feb-194d45390bc8' config_map_model['name'] = 'my-config-map' - config_map_model['project_id'] = '230828b4-4f15-40a9-b183-1268c6ab88d5' - config_map_model['resource_type'] = 'config_map_v2' list_first_metadata_model = {} # ListFirstMetadata list_first_metadata_model['href'] = 'testString' @@ -5402,22 +5306,15 @@ def test_job_serialization(self): # Construct a json representation of a Job model job_model_json = {} - job_model_json['created_at'] = '2022-09-13T11:41:35+02:00' job_model_json['entity_tag'] = '2385407409' - job_model_json[ - 'href' - ] = 'https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/jobs/my-job' - job_model_json['id'] = 'e33b1cv7-7390-4437-a5c2-130d5ccdddc3' job_model_json['image_reference'] = 'icr.io/codeengine/helloworld' job_model_json['image_secret'] = 'my-secret' job_model_json['name'] = 'my-job' - job_model_json['project_id'] = '4e49b3e0-27a8-48d2-a784-c7ee48bb863b' - job_model_json['resource_type'] = 'job_v2' job_model_json['run_arguments'] = ['testString'] job_model_json['run_as_user'] = 1001 job_model_json['run_commands'] = ['testString'] job_model_json['run_env_variables'] = [env_var_model] - job_model_json['run_mode'] = 'daemon' + job_model_json['run_mode'] = 'task' job_model_json['run_service_account'] = 'default' job_model_json['run_volume_mounts'] = [volume_mount_model] job_model_json['scale_array_spec'] = '1-5,7-8,10' @@ -5473,17 +5370,10 @@ def test_job_list_serialization(self): volume_mount_model['type'] = 'secret' job_model = {} # Job - job_model['created_at'] = '2022-11-15T21:40:40+01:00' job_model['entity_tag'] = '2386231540' - job_model[ - 'href' - ] = 'https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/jobs/my-job' - job_model['id'] = '7e49dd78-09d0-45c7-ad7e-cd968e0e7747' job_model['image_reference'] = 'icr.io/codeengine/helloworld' job_model['image_secret'] = 'my-secret' job_model['name'] = 'my-job' - job_model['project_id'] = '230828b4-4f15-40a9-b183-1268c6ab88d5' - job_model['resource_type'] = 'job_v2' job_model['run_arguments'] = [] job_model['run_as_user'] = 1001 job_model['run_commands'] = [] @@ -5559,7 +5449,7 @@ def test_job_patch_serialization(self): job_patch_model_json['run_as_user'] = 1001 job_patch_model_json['run_commands'] = ['testString'] job_patch_model_json['run_env_variables'] = [env_var_prototype_model] - job_patch_model_json['run_mode'] = 'daemon' + job_patch_model_json['run_mode'] = 'task' job_patch_model_json['run_service_account'] = 'default' job_patch_model_json['run_volume_mounts'] = [volume_mount_prototype_model] job_patch_model_json['scale_array_spec'] = '1-5,7-8,10' @@ -5612,33 +5502,18 @@ def test_job_run_serialization(self): volume_mount_model['type'] = 'secret' job_run_status_model = {} # JobRunStatus - job_run_status_model['completion_time'] = '2022-09-22T17:40:00Z' - job_run_status_model['failed'] = 0 - job_run_status_model['pending'] = 0 - job_run_status_model['requested'] = 0 - job_run_status_model['running'] = 0 - job_run_status_model['start_time'] = '2022-09-22T17:34:00Z' - job_run_status_model['succeeded'] = 1 - job_run_status_model['unknown'] = 0 # Construct a json representation of a JobRun model job_run_model_json = {} - job_run_model_json['created_at'] = '2022-09-13T11:41:35+02:00' - job_run_model_json[ - 'href' - ] = 'https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/job_runs/my-job-run' - job_run_model_json['id'] = 'e33b1cv7-7390-4437-a5c2-130d5ccdddc3' job_run_model_json['image_reference'] = 'icr.io/codeengine/helloworld' job_run_model_json['image_secret'] = 'my-secret' job_run_model_json['job_name'] = 'my-job' job_run_model_json['name'] = 'my-job-run' - job_run_model_json['project_id'] = '4e49b3e0-27a8-48d2-a784-c7ee48bb863b' - job_run_model_json['resource_type'] = 'job_run_v2' job_run_model_json['run_arguments'] = ['testString'] job_run_model_json['run_as_user'] = 1001 job_run_model_json['run_commands'] = ['testString'] job_run_model_json['run_env_variables'] = [env_var_model] - job_run_model_json['run_mode'] = 'daemon' + job_run_model_json['run_mode'] = 'task' job_run_model_json['run_service_account'] = 'default' job_run_model_json['run_volume_mounts'] = [volume_mount_model] job_run_model_json['scale_array_spec'] = '1-5,7-8,10' @@ -5647,7 +5522,6 @@ def test_job_run_serialization(self): job_run_model_json['scale_max_execution_time'] = 7200 job_run_model_json['scale_memory_limit'] = '4G' job_run_model_json['scale_retry_limit'] = 3 - job_run_model_json['status'] = 'completed' job_run_model_json['status_details'] = job_run_status_model # Construct a model instance of JobRun by calling from_dict on the json representation @@ -5696,27 +5570,12 @@ def test_job_run_list_serialization(self): volume_mount_model['type'] = 'secret' job_run_status_model = {} # JobRunStatus - job_run_status_model['completion_time'] = '2022-09-22T17:40:00Z' - job_run_status_model['failed'] = 0 - job_run_status_model['pending'] = 0 - job_run_status_model['requested'] = 0 - job_run_status_model['running'] = 0 - job_run_status_model['start_time'] = '2022-09-22T17:34:00Z' - job_run_status_model['succeeded'] = 1 - job_run_status_model['unknown'] = 0 job_run_model = {} # JobRun - job_run_model['created_at'] = '2022-11-15T22:06:21+01:00' - job_run_model[ - 'href' - ] = 'https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/jobs/my-job-run-1' - job_run_model['id'] = 'ced5039e-b1d3-4c51-aa29-8dbde3531ace' job_run_model['image_reference'] = 'icr.io/codeengine/helloworld' job_run_model['image_secret'] = 'my-secret' job_run_model['job_name'] = 'my-job' job_run_model['name'] = 'my-job-run-1' - job_run_model['project_id'] = '230828b4-4f15-40a9-b183-1268c6ab88d5' - job_run_model['resource_type'] = 'job_run_v2' job_run_model['run_arguments'] = [] job_run_model['run_as_user'] = 1001 job_run_model['run_commands'] = [] @@ -5730,7 +5589,6 @@ def test_job_run_list_serialization(self): job_run_model['scale_max_execution_time'] = 7200 job_run_model['scale_memory_limit'] = '4G' job_run_model['scale_retry_limit'] = 3 - job_run_model['status'] = 'completed' job_run_model['status_details'] = job_run_status_model list_next_metadata_model = {} # ListNextMetadata @@ -5772,14 +5630,6 @@ def test_job_run_status_serialization(self): # Construct a json representation of a JobRunStatus model job_run_status_model_json = {} - job_run_status_model_json['completion_time'] = '2022-09-22T17:40:00Z' - job_run_status_model_json['failed'] = 0 - job_run_status_model_json['pending'] = 0 - job_run_status_model_json['requested'] = 0 - job_run_status_model_json['running'] = 0 - job_run_status_model_json['start_time'] = '2022-09-22T17:34:00Z' - job_run_status_model_json['succeeded'] = 1 - job_run_status_model_json['unknown'] = 0 # Construct a model instance of JobRunStatus by calling from_dict on the json representation job_run_status_model = JobRunStatus.from_dict(job_run_status_model_json) @@ -5870,20 +5720,8 @@ def test_project_serialization(self): # Construct a json representation of a Project model project_model_json = {} - project_model_json['account_id'] = '4329073d16d2f3663f74bfa955259139' - project_model_json['created_at'] = '2021-03-29T12:18:13.992359829Z' - project_model_json[ - 'crn' - ] = 'crn:v1:bluemix:public:codeengine:eu-de:a/4329073d16d2f3663f74bfa955259139:4e49b3e0-27a8-48d2-a784-c7ee48bb863b::' - project_model_json[ - 'href' - ] = 'https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b' - project_model_json['id'] = '4e49b3e0-27a8-48d2-a784-c7ee48bb863b' project_model_json['name'] = 'project-name' - project_model_json['region'] = 'us-east' project_model_json['resource_group_id'] = '5c49eabcf5e85881a37e2d100a33b3df' - project_model_json['resource_type'] = 'project_v2' - project_model_json['status'] = 'active' # Construct a model instance of Project by calling from_dict on the json representation project_model = Project.from_dict(project_model_json) @@ -5921,20 +5759,8 @@ def test_project_list_serialization(self): list_next_metadata_model['start'] = 'testString' project_model = {} # Project - project_model['account_id'] = 'f9f1030ebf674eda8d57bdbc2b9e536a' - project_model['created_at'] = '2021-03-29T12:18:13.992359829Z' - project_model[ - 'crn' - ] = 'crn:v1:bluemix:public:codeengine:us-east:a/4329073d16d2f3663f74bfa955259139:15314cc3-85b4-4338-903f-c28cdee6d005::' - project_model[ - 'href' - ] = 'https://api.us-east.codeengine.cloud.ibm.com/v2/projects/15314cc3-85b4-4338-903f-c28cdee6d005' - project_model['id'] = '15314cc3-85b4-4338-903f-c28cdee6d005' project_model['name'] = 'test_project' - project_model['region'] = 'us-east' project_model['resource_group_id'] = 'b91e849cedb04e7e92bd68c040c672dc' - project_model['resource_type'] = 'project_v2' - project_model['status'] = 'active' # Construct a json representation of a ProjectList model project_list_model_json = {} @@ -5971,17 +5797,10 @@ def test_secret_serialization(self): # Construct a json representation of a Secret model secret_model_json = {} - secret_model_json['created_at'] = '2022-09-13T11:41:35+02:00' secret_model_json['data'] = {'key1': 'testString'} secret_model_json['entity_tag'] = '2385407409' secret_model_json['format'] = 'generic' - secret_model_json[ - 'href' - ] = 'https://api.eu-de.codeengine.cloud.ibm.com/v2/projects/4e49b3e0-27a8-48d2-a784-c7ee48bb863b/secrets/my-secret' - secret_model_json['id'] = 'e33b1cv7-7390-4437-a5c2-130d5ccdddc3' secret_model_json['name'] = 'my-secret' - secret_model_json['project_id'] = '4e49b3e0-27a8-48d2-a784-c7ee48bb863b' - secret_model_json['resource_type'] = 'testString' # Construct a model instance of Secret by calling from_dict on the json representation secret_model = Secret.from_dict(secret_model_json) @@ -6019,17 +5838,10 @@ def test_secret_list_serialization(self): list_next_metadata_model['start'] = 'testString' secret_model = {} # Secret - secret_model['created_at'] = '2022-11-15T21:59:08+01:00' secret_model['data'] = {'key1': 'testString'} secret_model['entity_tag'] = '2386255530' secret_model['format'] = 'generic' - secret_model[ - 'href' - ] = 'https://api.us-east.codeengine.cloud.ibm.com/v2/projects/230828b4-4f15-40a9-b183-1268c6ab88d5/secrets/my-secret' - secret_model['id'] = '36e3a621-4895-4bd1-b7e8-1163ab49a28f' secret_model['name'] = 'my-secret' - secret_model['project_id'] = '230828b4-4f15-40a9-b183-1268c6ab88d5' - secret_model['resource_type'] = 'secret_generic_v2' # Construct a json representation of a SecretList model secret_list_model_json = {} @@ -6120,6 +5932,238 @@ def test_volume_mount_prototype_serialization(self): assert volume_mount_prototype_model_json2 == volume_mount_prototype_model_json +class TestModel_SecretDataBasicAuthSecretData: + """ + Test Class for SecretDataBasicAuthSecretData + """ + + def test_secret_data_basic_auth_secret_data_serialization(self): + """ + Test serialization/deserialization for SecretDataBasicAuthSecretData + """ + + # Construct a json representation of a SecretDataBasicAuthSecretData model + secret_data_basic_auth_secret_data_model_json = {} + secret_data_basic_auth_secret_data_model_json['username'] = 'testString' + secret_data_basic_auth_secret_data_model_json['password'] = 'testString' + secret_data_basic_auth_secret_data_model_json['foo'] = 'testString' + + # Construct a model instance of SecretDataBasicAuthSecretData by calling from_dict on the json representation + secret_data_basic_auth_secret_data_model = SecretDataBasicAuthSecretData.from_dict( + secret_data_basic_auth_secret_data_model_json + ) + assert secret_data_basic_auth_secret_data_model != False + + # Construct a model instance of SecretDataBasicAuthSecretData by calling from_dict on the json representation + secret_data_basic_auth_secret_data_model_dict = SecretDataBasicAuthSecretData.from_dict( + secret_data_basic_auth_secret_data_model_json + ).__dict__ + secret_data_basic_auth_secret_data_model2 = SecretDataBasicAuthSecretData( + **secret_data_basic_auth_secret_data_model_dict + ) + + # Verify the model instances are equivalent + assert secret_data_basic_auth_secret_data_model == secret_data_basic_auth_secret_data_model2 + + # Convert model instance back to dict and verify no loss of data + secret_data_basic_auth_secret_data_model_json2 = secret_data_basic_auth_secret_data_model.to_dict() + assert secret_data_basic_auth_secret_data_model_json2 == secret_data_basic_auth_secret_data_model_json + + # Test get_properties and set_properties methods. + secret_data_basic_auth_secret_data_model.set_properties({}) + actual_dict = secret_data_basic_auth_secret_data_model.get_properties() + assert actual_dict == {} + + expected_dict = {'foo': 'testString'} + secret_data_basic_auth_secret_data_model.set_properties(expected_dict) + actual_dict = secret_data_basic_auth_secret_data_model.get_properties() + assert actual_dict == expected_dict + + +class TestModel_SecretDataGenericSecretData: + """ + Test Class for SecretDataGenericSecretData + """ + + def test_secret_data_generic_secret_data_serialization(self): + """ + Test serialization/deserialization for SecretDataGenericSecretData + """ + + # Construct a json representation of a SecretDataGenericSecretData model + secret_data_generic_secret_data_model_json = {} + secret_data_generic_secret_data_model_json['foo'] = 'testString' + + # Construct a model instance of SecretDataGenericSecretData by calling from_dict on the json representation + secret_data_generic_secret_data_model = SecretDataGenericSecretData.from_dict( + secret_data_generic_secret_data_model_json + ) + assert secret_data_generic_secret_data_model != False + + # Construct a model instance of SecretDataGenericSecretData by calling from_dict on the json representation + secret_data_generic_secret_data_model_dict = SecretDataGenericSecretData.from_dict( + secret_data_generic_secret_data_model_json + ).__dict__ + secret_data_generic_secret_data_model2 = SecretDataGenericSecretData( + **secret_data_generic_secret_data_model_dict + ) + + # Verify the model instances are equivalent + assert secret_data_generic_secret_data_model == secret_data_generic_secret_data_model2 + + # Convert model instance back to dict and verify no loss of data + secret_data_generic_secret_data_model_json2 = secret_data_generic_secret_data_model.to_dict() + assert secret_data_generic_secret_data_model_json2 == secret_data_generic_secret_data_model_json + + # Test get_properties and set_properties methods. + secret_data_generic_secret_data_model.set_properties({}) + actual_dict = secret_data_generic_secret_data_model.get_properties() + assert actual_dict == {} + + expected_dict = {'foo': 'testString'} + secret_data_generic_secret_data_model.set_properties(expected_dict) + actual_dict = secret_data_generic_secret_data_model.get_properties() + assert actual_dict == expected_dict + + +class TestModel_SecretDataRegistrySecretData: + """ + Test Class for SecretDataRegistrySecretData + """ + + def test_secret_data_registry_secret_data_serialization(self): + """ + Test serialization/deserialization for SecretDataRegistrySecretData + """ + + # Construct a json representation of a SecretDataRegistrySecretData model + secret_data_registry_secret_data_model_json = {} + secret_data_registry_secret_data_model_json['username'] = 'testString' + secret_data_registry_secret_data_model_json['password'] = 'testString' + secret_data_registry_secret_data_model_json['server'] = 'testString' + secret_data_registry_secret_data_model_json['email'] = 'testString' + secret_data_registry_secret_data_model_json['foo'] = 'testString' + + # Construct a model instance of SecretDataRegistrySecretData by calling from_dict on the json representation + secret_data_registry_secret_data_model = SecretDataRegistrySecretData.from_dict( + secret_data_registry_secret_data_model_json + ) + assert secret_data_registry_secret_data_model != False + + # Construct a model instance of SecretDataRegistrySecretData by calling from_dict on the json representation + secret_data_registry_secret_data_model_dict = SecretDataRegistrySecretData.from_dict( + secret_data_registry_secret_data_model_json + ).__dict__ + secret_data_registry_secret_data_model2 = SecretDataRegistrySecretData( + **secret_data_registry_secret_data_model_dict + ) + + # Verify the model instances are equivalent + assert secret_data_registry_secret_data_model == secret_data_registry_secret_data_model2 + + # Convert model instance back to dict and verify no loss of data + secret_data_registry_secret_data_model_json2 = secret_data_registry_secret_data_model.to_dict() + assert secret_data_registry_secret_data_model_json2 == secret_data_registry_secret_data_model_json + + # Test get_properties and set_properties methods. + secret_data_registry_secret_data_model.set_properties({}) + actual_dict = secret_data_registry_secret_data_model.get_properties() + assert actual_dict == {} + + expected_dict = {'foo': 'testString'} + secret_data_registry_secret_data_model.set_properties(expected_dict) + actual_dict = secret_data_registry_secret_data_model.get_properties() + assert actual_dict == expected_dict + + +class TestModel_SecretDataSSHSecretData: + """ + Test Class for SecretDataSSHSecretData + """ + + def test_secret_data_ssh_secret_data_serialization(self): + """ + Test serialization/deserialization for SecretDataSSHSecretData + """ + + # Construct a json representation of a SecretDataSSHSecretData model + secret_data_ssh_secret_data_model_json = {} + secret_data_ssh_secret_data_model_json['ssh_key'] = 'testString' + secret_data_ssh_secret_data_model_json['known_hosts'] = 'testString' + secret_data_ssh_secret_data_model_json['foo'] = 'testString' + + # Construct a model instance of SecretDataSSHSecretData by calling from_dict on the json representation + secret_data_ssh_secret_data_model = SecretDataSSHSecretData.from_dict(secret_data_ssh_secret_data_model_json) + assert secret_data_ssh_secret_data_model != False + + # Construct a model instance of SecretDataSSHSecretData by calling from_dict on the json representation + secret_data_ssh_secret_data_model_dict = SecretDataSSHSecretData.from_dict( + secret_data_ssh_secret_data_model_json + ).__dict__ + secret_data_ssh_secret_data_model2 = SecretDataSSHSecretData(**secret_data_ssh_secret_data_model_dict) + + # Verify the model instances are equivalent + assert secret_data_ssh_secret_data_model == secret_data_ssh_secret_data_model2 + + # Convert model instance back to dict and verify no loss of data + secret_data_ssh_secret_data_model_json2 = secret_data_ssh_secret_data_model.to_dict() + assert secret_data_ssh_secret_data_model_json2 == secret_data_ssh_secret_data_model_json + + # Test get_properties and set_properties methods. + secret_data_ssh_secret_data_model.set_properties({}) + actual_dict = secret_data_ssh_secret_data_model.get_properties() + assert actual_dict == {} + + expected_dict = {'foo': 'testString'} + secret_data_ssh_secret_data_model.set_properties(expected_dict) + actual_dict = secret_data_ssh_secret_data_model.get_properties() + assert actual_dict == expected_dict + + +class TestModel_SecretDataTLSSecretData: + """ + Test Class for SecretDataTLSSecretData + """ + + def test_secret_data_tls_secret_data_serialization(self): + """ + Test serialization/deserialization for SecretDataTLSSecretData + """ + + # Construct a json representation of a SecretDataTLSSecretData model + secret_data_tls_secret_data_model_json = {} + secret_data_tls_secret_data_model_json['tls_cert'] = 'testString' + secret_data_tls_secret_data_model_json['tls_key'] = 'testString' + secret_data_tls_secret_data_model_json['foo'] = 'testString' + + # Construct a model instance of SecretDataTLSSecretData by calling from_dict on the json representation + secret_data_tls_secret_data_model = SecretDataTLSSecretData.from_dict(secret_data_tls_secret_data_model_json) + assert secret_data_tls_secret_data_model != False + + # Construct a model instance of SecretDataTLSSecretData by calling from_dict on the json representation + secret_data_tls_secret_data_model_dict = SecretDataTLSSecretData.from_dict( + secret_data_tls_secret_data_model_json + ).__dict__ + secret_data_tls_secret_data_model2 = SecretDataTLSSecretData(**secret_data_tls_secret_data_model_dict) + + # Verify the model instances are equivalent + assert secret_data_tls_secret_data_model == secret_data_tls_secret_data_model2 + + # Convert model instance back to dict and verify no loss of data + secret_data_tls_secret_data_model_json2 = secret_data_tls_secret_data_model.to_dict() + assert secret_data_tls_secret_data_model_json2 == secret_data_tls_secret_data_model_json + + # Test get_properties and set_properties methods. + secret_data_tls_secret_data_model.set_properties({}) + actual_dict = secret_data_tls_secret_data_model.get_properties() + assert actual_dict == {} + + expected_dict = {'foo': 'testString'} + secret_data_tls_secret_data_model.set_properties(expected_dict) + actual_dict = secret_data_tls_secret_data_model.get_properties() + assert actual_dict == expected_dict + + # endregion ############################################################################## # End of Model Tests From aa98c6769e35d39397d8e92e24a6b5ea62879ad7 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 23 Mar 2023 21:42:39 +0000 Subject: [PATCH 2/8] Update version 2.0.3 -> 3.0.0 --- .bumpversion.cfg | 2 +- README.md | 10 +++++----- ibm_code_engine_sdk/version.py | 2 +- setup.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 0d165dd..52b025e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.0.3 +current_version = 3.0.0 commit = True message = Update version {current_version} -> {new_version} diff --git a/README.md b/README.md index 1d28e31..bc5aef0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -# Python SDK for IBM Cloud Code Engine 2.0.3 +# Python SDK for IBM Cloud Code Engine 3.0.0 Python client library to interact with the [IBM Cloud Code Engine API](https://cloud.ibm.com/apidocs/codeengine). @@ -39,8 +39,8 @@ IBM Cloud services: Service Name | Imported Class Name --- | --- -[IBM Cloud Code Engine V2](https://cloud.ibm.com/apidocs/codeengine/codeengine-v2.0.3) | CodeEngineV2 -[IBM Cloud Code Engine V1](https://cloud.ibm.com/apidocs/codeengine/codeengine-v2.0.3) | IbmCloudCodeEngineV1 +[IBM Cloud Code Engine V2](https://cloud.ibm.com/apidocs/codeengine/codeengine-v3.0.0) | CodeEngineV2 +[IBM Cloud Code Engine V1](https://cloud.ibm.com/apidocs/codeengine/codeengine-v3.0.0) | IbmCloudCodeEngineV1 ## Prerequisites @@ -55,13 +55,13 @@ Service Name | Imported Class Name To install, use `pip` or `easy_install`: ```bash -pip install --upgrade "ibm_code_engine_sdk>=2.0.3" +pip install --upgrade "ibm_code_engine_sdk>=3.0.0" ``` or ```bash -easy_install --upgrade "ibm_code_engine_sdk>=2.0.3" +easy_install --upgrade "ibm_code_engine_sdk>=3.0.0" ``` ## Using the SDK diff --git a/ibm_code_engine_sdk/version.py b/ibm_code_engine_sdk/version.py index 5e0057c..7c88a22 100644 --- a/ibm_code_engine_sdk/version.py +++ b/ibm_code_engine_sdk/version.py @@ -17,4 +17,4 @@ """ Version of ibm_code_engine_sdk """ -__version__ = '2.0.3' +__version__ = '3.0.0' diff --git a/setup.py b/setup.py index 0032ea2..e0741e5 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ import sys import pkg_resources -__version__ = '2.0.3' +__version__ = '3.0.0' PACKAGE_NAME = 'ibm_code_engine_sdk' PACKAGE_DESC = 'Python SDK for IBM Cloud Code Engine' From 399243130617db6b5783351ae67dd78e59b49e34 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 23 Mar 2023 21:42:39 +0000 Subject: [PATCH 3/8] chore(release): 3.0.0 release notes # [3.0.0](https://github.ibm.com/coligo/python-sdk/compare/v2.0.3...v3.0.0) (2023-03-23) ### Features * **oneOf:** addeed type support for secret data types ([#9](https://github.ibm.com/coligo/python-sdk/issues/9)) ([6dd33d2](https://github.ibm.com/coligo/python-sdk/commit/6dd33d2dca8663d65d00c4e5694bfa11abbb5d22)) ### BREAKING CHANGES * **oneOf:** new classes for each secret data type added * test fix * test fix * added more secret examples * updated to latest openAPI, added oneOf for secret updates * udpated timeout on int test * increase timeout * adjust timeout * removed retries * set retries to 0 * udpated retry interval * sleep adjust * removed loop, depending on python retry * increased project sleep to 2 minutes before trying get * moved sleep * fixed timestamp name, will removed security alerts --- CHANGELOG.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61d0819..fd41d64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,45 @@ +# [3.0.0](https://github.ibm.com/coligo/python-sdk/compare/v2.0.3...v3.0.0) (2023-03-23) + + +### Features + +* **oneOf:** addeed type support for secret data types ([#9](https://github.ibm.com/coligo/python-sdk/issues/9)) ([6dd33d2](https://github.ibm.com/coligo/python-sdk/commit/6dd33d2dca8663d65d00c4e5694bfa11abbb5d22)) + + +### BREAKING CHANGES + +* **oneOf:** new classes for each secret data type added + +* test fix + +* test fix + +* added more secret examples + +* updated to latest openAPI, added oneOf for secret updates + +* udpated timeout on int test + +* increase timeout + +* adjust timeout + +* removed retries + +* set retries to 0 + +* udpated retry interval + +* sleep adjust + +* removed loop, depending on python retry + +* increased project sleep to 2 minutes before trying get + +* moved sleep + +* fixed timestamp name, will removed security alerts + ## [2.0.3](https://github.ibm.com/coligo/python-sdk/compare/v2.0.2...v2.0.3) (2023-01-25) From 465c164099fb96d2c9f1b523d8c08a243d95a617 Mon Sep 17 00:00:00 2001 From: Enrico Regge Date: Fri, 24 Mar 2023 19:02:51 +0100 Subject: [PATCH 4/8] sdk-update-20230324-173405 (#12) * fix(generator): SDK update 20230324-173405 * fix(api): added integration tests for egress ips * fix(test): addressed linter violation --- .gitignore | 2 +- examples/test_code_engine_v2_examples.py | 21 +++++ ibm_code_engine_sdk/code_engine_v2.py | 99 +++++++++++++++++++++++- test/integration/test_v2.py | 10 +++ test/unit/test_code_engine_v2.py | 99 ++++++++++++++++++++++++ 5 files changed, 229 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8c833cb..094a138 100644 --- a/.gitignore +++ b/.gitignore @@ -82,4 +82,4 @@ package-lock.json node_modules/ # ignore the generated integration test files, as they cannot be used without manual editing -integration/test_code_engine_v2.py \ No newline at end of file +test/integration/test_code_engine_v2.py \ No newline at end of file diff --git a/examples/test_code_engine_v2_examples.py b/examples/test_code_engine_v2_examples.py index 69151ec..6054acc 100644 --- a/examples/test_code_engine_v2_examples.py +++ b/examples/test_code_engine_v2_examples.py @@ -141,6 +141,27 @@ def test_get_project_example(self): except ApiException as e: pytest.fail(str(e)) + @needscredentials + def test_get_project_egress_ips_example(self): + """ + get_project_egress_ips request example + """ + try: + print('\nget_project_egress_ips() result:') + # begin-get_project_egress_ips + + response = code_engine_service.get_project_egress_ips( + project_id='15314cc3-85b4-4338-903f-c28cdee6d005', + ) + project_egress_ip_addresses = response.get_result() + + print(json.dumps(project_egress_ip_addresses, indent=2)) + + # end-get_project_egress_ips + + except ApiException as e: + pytest.fail(str(e)) + @needscredentials def test_list_apps_example(self): """ diff --git a/ibm_code_engine_sdk/code_engine_v2.py b/ibm_code_engine_sdk/code_engine_v2.py index b21125e..0700044 100644 --- a/ibm_code_engine_sdk/code_engine_v2.py +++ b/ibm_code_engine_sdk/code_engine_v2.py @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# IBM OpenAPI SDK Code Generator Version: 3.64.0-959a5845-20230112-195144 +# IBM OpenAPI SDK Code Generator Version: 3.66.0-d6c2d7e0-20230215-221247 """ REST API for Code Engine @@ -232,6 +232,41 @@ def delete_project(self, id: str, **kwargs) -> DetailedResponse: response = self.send(request, **kwargs) return response + def get_project_egress_ips(self, project_id: str, **kwargs) -> DetailedResponse: + """ + List egress IP addresses. + + Lists all egress IP addresses (public and private) that are used by components + running in this project. + + :param str project_id: The ID of the project. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `ProjectEgressIPAddresses` object + """ + + if not project_id: + raise ValueError('project_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_project_egress_ips' + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['project_id'] + path_param_values = self.encode_path_vars(project_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/projects/{project_id}/egress_ips'.format(**path_param_dict) + request = self.prepare_request(method='GET', url=url, headers=headers) + + response = self.send(request, **kwargs) + return response + ######################### # Applications ######################### @@ -7257,6 +7292,68 @@ class StatusEnum(str, Enum): CREATION_FAILED = 'creation_failed' +class ProjectEgressIPAddresses: + """ + Describes the model of egress IP addresses. + + :attr List[str] private: (optional) List of IBM private network IP addresses. + :attr List[str] public: (optional) List of public IP addresses. + """ + + def __init__(self, *, private: List[str] = None, public: List[str] = None) -> None: + """ + Initialize a ProjectEgressIPAddresses object. + + :param List[str] private: (optional) List of IBM private network IP + addresses. + :param List[str] public: (optional) List of public IP addresses. + """ + self.private = private + self.public = public + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ProjectEgressIPAddresses': + """Initialize a ProjectEgressIPAddresses object from a json dictionary.""" + args = {} + if 'private' in _dict: + args['private'] = _dict.get('private') + if 'public' in _dict: + args['public'] = _dict.get('public') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ProjectEgressIPAddresses object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'private') and self.private is not None: + _dict['private'] = self.private + if hasattr(self, 'public') and self.public is not None: + _dict['public'] = self.public + 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 ProjectEgressIPAddresses object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ProjectEgressIPAddresses') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'ProjectEgressIPAddresses') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ProjectList: """ Contains a list of projects and pagination information. diff --git a/test/integration/test_v2.py b/test/integration/test_v2.py index f6cc35e..3eea6dd 100644 --- a/test/integration/test_v2.py +++ b/test/integration/test_v2.py @@ -132,6 +132,16 @@ def test_get_project(self): assert obtained_project['status'] == 'active' + @needscredentials + def test_get_project_egress_ips(self): + response = self.code_engine_service.get_project_egress_ips( + project_id=pytest.e2e_test_project_id, + ) + + assert response.get_status_code() == 200 + project_egress_ip_addresses = response.get_result() + assert project_egress_ip_addresses is not None + @needscredentials def test_list_apps(self): response = self.code_engine_service.list_apps( diff --git a/test/unit/test_code_engine_v2.py b/test/unit/test_code_engine_v2.py index 8dc00e7..72a3a86 100644 --- a/test/unit/test_code_engine_v2.py +++ b/test/unit/test_code_engine_v2.py @@ -412,6 +412,72 @@ def test_delete_project_value_error_with_retries(self): self.test_delete_project_value_error() +class TestGetProjectEgressIps: + """ + Test Class for get_project_egress_ips + """ + + @responses.activate + def test_get_project_egress_ips_all_params(self): + """ + get_project_egress_ips() + """ + # Set up mock + url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/egress_ips') + mock_response = '{"private": ["private"], "public": ["public"]}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) + + # Set up parameter values + project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' + + # Invoke method + response = _service.get_project_egress_ips(project_id, headers={}) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_project_egress_ips_all_params_with_retries(self): + # Enable retries and run test_get_project_egress_ips_all_params. + _service.enable_retries() + self.test_get_project_egress_ips_all_params() + + # Disable retries and run test_get_project_egress_ips_all_params. + _service.disable_retries() + self.test_get_project_egress_ips_all_params() + + @responses.activate + def test_get_project_egress_ips_value_error(self): + """ + test_get_project_egress_ips_value_error() + """ + # Set up mock + url = preprocess_url('/projects/15314cc3-85b4-4338-903f-c28cdee6d005/egress_ips') + mock_response = '{"private": ["private"], "public": ["public"]}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) + + # Set up parameter values + project_id = '15314cc3-85b4-4338-903f-c28cdee6d005' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "project_id": project_id, + } + for param in req_param_dict.keys(): + 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_project_egress_ips(**req_copy) + + def test_get_project_egress_ips_value_error_with_retries(self): + # Enable retries and run test_get_project_egress_ips_value_error. + _service.enable_retries() + self.test_get_project_egress_ips_value_error() + + # Disable retries and run test_get_project_egress_ips_value_error. + _service.disable_retries() + self.test_get_project_egress_ips_value_error() + + # endregion ############################################################################## # End of Service: Projects @@ -5739,6 +5805,39 @@ def test_project_serialization(self): assert project_model_json2 == project_model_json +class TestModel_ProjectEgressIPAddresses: + """ + Test Class for ProjectEgressIPAddresses + """ + + def test_project_egress_ip_addresses_serialization(self): + """ + Test serialization/deserialization for ProjectEgressIPAddresses + """ + + # Construct a json representation of a ProjectEgressIPAddresses model + project_egress_ip_addresses_model_json = {} + project_egress_ip_addresses_model_json['private'] = ['testString'] + project_egress_ip_addresses_model_json['public'] = ['testString'] + + # Construct a model instance of ProjectEgressIPAddresses by calling from_dict on the json representation + project_egress_ip_addresses_model = ProjectEgressIPAddresses.from_dict(project_egress_ip_addresses_model_json) + assert project_egress_ip_addresses_model != False + + # Construct a model instance of ProjectEgressIPAddresses by calling from_dict on the json representation + project_egress_ip_addresses_model_dict = ProjectEgressIPAddresses.from_dict( + project_egress_ip_addresses_model_json + ).__dict__ + project_egress_ip_addresses_model2 = ProjectEgressIPAddresses(**project_egress_ip_addresses_model_dict) + + # Verify the model instances are equivalent + assert project_egress_ip_addresses_model == project_egress_ip_addresses_model2 + + # Convert model instance back to dict and verify no loss of data + project_egress_ip_addresses_model_json2 = project_egress_ip_addresses_model.to_dict() + assert project_egress_ip_addresses_model_json2 == project_egress_ip_addresses_model_json + + class TestModel_ProjectList: """ Test Class for ProjectList From dcc340f4f177bb31faa2de3acff97304cf8bce1f Mon Sep 17 00:00:00 2001 From: REGGEENR Date: Fri, 24 Mar 2023 20:55:45 +0100 Subject: [PATCH 5/8] feat(api): added support to retrieve egress ips From f69ad533cf94d9eba997a14a456263747a80485b Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 24 Mar 2023 21:45:49 +0000 Subject: [PATCH 6/8] Update version 3.0.0 -> 3.1.0 --- .bumpversion.cfg | 2 +- README.md | 10 +++++----- ibm_code_engine_sdk/version.py | 2 +- setup.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 52b025e..a7b675c 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.0.0 +current_version = 3.1.0 commit = True message = Update version {current_version} -> {new_version} diff --git a/README.md b/README.md index bc5aef0..1e37342 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -# Python SDK for IBM Cloud Code Engine 3.0.0 +# Python SDK for IBM Cloud Code Engine 3.1.0 Python client library to interact with the [IBM Cloud Code Engine API](https://cloud.ibm.com/apidocs/codeengine). @@ -39,8 +39,8 @@ IBM Cloud services: Service Name | Imported Class Name --- | --- -[IBM Cloud Code Engine V2](https://cloud.ibm.com/apidocs/codeengine/codeengine-v3.0.0) | CodeEngineV2 -[IBM Cloud Code Engine V1](https://cloud.ibm.com/apidocs/codeengine/codeengine-v3.0.0) | IbmCloudCodeEngineV1 +[IBM Cloud Code Engine V2](https://cloud.ibm.com/apidocs/codeengine/codeengine-v3.1.0) | CodeEngineV2 +[IBM Cloud Code Engine V1](https://cloud.ibm.com/apidocs/codeengine/codeengine-v3.1.0) | IbmCloudCodeEngineV1 ## Prerequisites @@ -55,13 +55,13 @@ Service Name | Imported Class Name To install, use `pip` or `easy_install`: ```bash -pip install --upgrade "ibm_code_engine_sdk>=3.0.0" +pip install --upgrade "ibm_code_engine_sdk>=3.1.0" ``` or ```bash -easy_install --upgrade "ibm_code_engine_sdk>=3.0.0" +easy_install --upgrade "ibm_code_engine_sdk>=3.1.0" ``` ## Using the SDK diff --git a/ibm_code_engine_sdk/version.py b/ibm_code_engine_sdk/version.py index 7c88a22..b042a73 100644 --- a/ibm_code_engine_sdk/version.py +++ b/ibm_code_engine_sdk/version.py @@ -17,4 +17,4 @@ """ Version of ibm_code_engine_sdk """ -__version__ = '3.0.0' +__version__ = '3.1.0' diff --git a/setup.py b/setup.py index e0741e5..fc8c805 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ import sys import pkg_resources -__version__ = '3.0.0' +__version__ = '3.1.0' PACKAGE_NAME = 'ibm_code_engine_sdk' PACKAGE_DESC = 'Python SDK for IBM Cloud Code Engine' From 3a7ea02de66b1fe856f457ffdd360c3f8e78552f Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 24 Mar 2023 21:45:50 +0000 Subject: [PATCH 7/8] chore(release): 3.1.0 release notes # [3.1.0](https://github.ibm.com/coligo/python-sdk/compare/v3.0.0...v3.1.0) (2023-03-24) ### Features * **api:** added support to retrieve egress ips ([dcc340f](https://github.ibm.com/coligo/python-sdk/commit/dcc340f4f177bb31faa2de3acff97304cf8bce1f)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd41d64..d6e1c17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [3.1.0](https://github.ibm.com/coligo/python-sdk/compare/v3.0.0...v3.1.0) (2023-03-24) + + +### Features + +* **api:** added support to retrieve egress ips ([dcc340f](https://github.ibm.com/coligo/python-sdk/commit/dcc340f4f177bb31faa2de3acff97304cf8bce1f)) + # [3.0.0](https://github.ibm.com/coligo/python-sdk/compare/v2.0.3...v3.0.0) (2023-03-23) From c40e33ba1b791817be42cb3cdd52c83015092f3e Mon Sep 17 00:00:00 2001 From: John Sartore Date: Mon, 27 Mar 2023 12:23:44 -0400 Subject: [PATCH 8/8] SDK update 20230327-122344 Signed-off-by: John Sartore --- .bumpversion.cfg | 16 ------ .npmrc | 1 - .releaserc | 23 --------- .travis.yml | 32 ++++++------ .travis_public.yml | 42 ---------------- CHANGELOG.md | 93 ----------------------------------- example/README.md | 57 --------------------- example/example.py | 65 ------------------------ example/example_deprecated.py | 52 -------------------- package.json | 15 ------ sdkgen_config.json | 6 --- test-integration.sh | 29 ----------- 12 files changed, 14 insertions(+), 417 deletions(-) delete mode 100644 .bumpversion.cfg delete mode 100644 .npmrc delete mode 100644 .releaserc delete mode 100644 .travis_public.yml delete mode 100644 CHANGELOG.md delete mode 100644 example/README.md delete mode 100644 example/example.py delete mode 100644 example/example_deprecated.py delete mode 100644 package.json delete mode 100644 sdkgen_config.json delete mode 100755 test-integration.sh diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index a7b675c..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,16 +0,0 @@ -[bumpversion] -current_version = 3.1.0 -commit = True -message = Update version {current_version} -> {new_version} - -[bumpversion:file:ibm_code_engine_sdk/version.py] -search = __version__ = '{current_version}' -replace = __version__ = '{new_version}' - -[bumpversion:file:setup.py] -search = __version__ = '{current_version}' -replace = __version__ = '{new_version}' - -[bumpversion:file:README.md] -search = {current_version} -replace = {new_version} diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 9cf9495..0000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -package-lock=false \ No newline at end of file diff --git a/.releaserc b/.releaserc deleted file mode 100644 index dcd2868..0000000 --- a/.releaserc +++ /dev/null @@ -1,23 +0,0 @@ -{ - "debug": true, - "branches": [ "main" ], - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/changelog", - [ - "@semantic-release/exec", - { - "prepareCmd": "bump2version --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch" - } - ], - [ - "@semantic-release/git", - { - "assets" : [ "CHANGELOG.md" ], - "message": "chore(release): ${nextRelease.version} release notes\n\n${nextRelease.notes}" - } - ], - "@semantic-release/github" - ] -} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 4b289b5..a2cfab5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,6 @@ dist: bionic language: python -python: - - "3.11" cache: pip @@ -10,16 +8,17 @@ cache: pip branches: only: - main + - /v\d+.\d+.\d+/ notifications: email: true -before_install: -# create an .env file that is pulled in while executing the v2 integration tests -- echo "CODE_ENGINE_URL=https://$CE_API_HOST/v2" > code_engine_v2.env -- echo "CODE_ENGINE_AUTH_TYPE=iam" >> code_engine_v2.env -- echo "CODE_ENGINE_APIKEY=$CE_API_KEY" >> code_engine_v2.env -- echo "CODE_ENGINE_AUTH_URL=$IAM_ENDPOINT" >> code_engine_v2.env +matrix: + include: + - python: '3.7' + - python: '3.8' + - python: '3.9' + - python: '3.10' install: - sudo apt-get update @@ -30,17 +29,14 @@ install: script: - make ci -- make test-int - -before_deploy: -- nvm install 14 -- npm install -- pip install bump2version deploy: -# Use semantic release to create a tag and release on each commit to the main branch -- provider: script - script: npm run semantic-release +- provider: pypi + user: __token__ + password: + secure: H6pxBCHf26B/9qi/3I6W7NkXnSwbPq04GiD06/z6MfZZkM2QQhbwFvDE55BrLhDskbpSEDNH18JuHMlDKu/ihNjDGw7dVnMTjs1/Uf1QlbrZRRtMhQBp3OuVRmE1mPc1PfYyYZlfqDQZkV6oz7NHI69x6Nz68Ltq6S+FaTT/8C72MoF3E4+ea6i/m8FRrxL6XS4ak7eXP1sKWPg3Sf7uEFwYsAWI/gcpjw2mnrqNCJWXkQmbVwWawo1GbfvIAs7ykhWkyZL+heuagdTmE9XEnnXrInp+U9ean5TcS1RMtDHzfB1TndVDxzZQBPwpXR7CdJcBft/NI2h/qA9xQr2DeC5BVLe5UvlPjIQ8KPK6wy2HOi2XwvXJZ3AVRyXPhujr3eLe8wFW/g9k/RPqs1ptwMYSav62gaPzZQzt3fj4dqLblj+nlZE+pAPS1K4Yr+vDQ6JqPhvK4e3f/kg64BjgDdM5aHPWsAvRaMZ6elS3N1v3I5bDxcS0YkdHtbESJUyI/72BZL8svYFOiUi5kmYGM+/VizBE1Ld2nRFH4MpGAQn0AmoR/Wr0WViEQCNoSRHswZxqidudi/tNuMx/w/P/tx8b34s0A1YG/638jaNnIYyWseBSyY465GzgzLbKe4//qO4G38PCieWqP55aULPNDdddFrW02hzwQ/U/PznI8hg= + repository: https://upload.pypi.org/legacy skip_cleanup: true on: - branch: main \ No newline at end of file + python: '3.10' + tags: true \ No newline at end of file diff --git a/.travis_public.yml b/.travis_public.yml deleted file mode 100644 index a2cfab5..0000000 --- a/.travis_public.yml +++ /dev/null @@ -1,42 +0,0 @@ -dist: bionic - -language: python - -cache: pip - -# Only run on main (still tests PRs) -branches: - only: - - main - - /v\d+.\d+.\d+/ - -notifications: - email: true - -matrix: - include: - - python: '3.7' - - python: '3.8' - - python: '3.9' - - python: '3.10' - -install: -- sudo apt-get update -- sudo apt-get install pandoc -- pip install pypandoc -- echo -e "machine github.ibm.com\n login $GITHUB_OAUTH_TOKEN" > ~/.netrc -- pip install setuptools=="60.8.2" - -script: -- make ci - -deploy: -- provider: pypi - user: __token__ - password: - secure: H6pxBCHf26B/9qi/3I6W7NkXnSwbPq04GiD06/z6MfZZkM2QQhbwFvDE55BrLhDskbpSEDNH18JuHMlDKu/ihNjDGw7dVnMTjs1/Uf1QlbrZRRtMhQBp3OuVRmE1mPc1PfYyYZlfqDQZkV6oz7NHI69x6Nz68Ltq6S+FaTT/8C72MoF3E4+ea6i/m8FRrxL6XS4ak7eXP1sKWPg3Sf7uEFwYsAWI/gcpjw2mnrqNCJWXkQmbVwWawo1GbfvIAs7ykhWkyZL+heuagdTmE9XEnnXrInp+U9ean5TcS1RMtDHzfB1TndVDxzZQBPwpXR7CdJcBft/NI2h/qA9xQr2DeC5BVLe5UvlPjIQ8KPK6wy2HOi2XwvXJZ3AVRyXPhujr3eLe8wFW/g9k/RPqs1ptwMYSav62gaPzZQzt3fj4dqLblj+nlZE+pAPS1K4Yr+vDQ6JqPhvK4e3f/kg64BjgDdM5aHPWsAvRaMZ6elS3N1v3I5bDxcS0YkdHtbESJUyI/72BZL8svYFOiUi5kmYGM+/VizBE1Ld2nRFH4MpGAQn0AmoR/Wr0WViEQCNoSRHswZxqidudi/tNuMx/w/P/tx8b34s0A1YG/638jaNnIYyWseBSyY465GzgzLbKe4//qO4G38PCieWqP55aULPNDdddFrW02hzwQ/U/PznI8hg= - repository: https://upload.pypi.org/legacy - skip_cleanup: true - on: - python: '3.10' - tags: true \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index d6e1c17..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,93 +0,0 @@ -# [3.1.0](https://github.ibm.com/coligo/python-sdk/compare/v3.0.0...v3.1.0) (2023-03-24) - - -### Features - -* **api:** added support to retrieve egress ips ([dcc340f](https://github.ibm.com/coligo/python-sdk/commit/dcc340f4f177bb31faa2de3acff97304cf8bce1f)) - -# [3.0.0](https://github.ibm.com/coligo/python-sdk/compare/v2.0.3...v3.0.0) (2023-03-23) - - -### Features - -* **oneOf:** addeed type support for secret data types ([#9](https://github.ibm.com/coligo/python-sdk/issues/9)) ([6dd33d2](https://github.ibm.com/coligo/python-sdk/commit/6dd33d2dca8663d65d00c4e5694bfa11abbb5d22)) - - -### BREAKING CHANGES - -* **oneOf:** new classes for each secret data type added - -* test fix - -* test fix - -* added more secret examples - -* updated to latest openAPI, added oneOf for secret updates - -* udpated timeout on int test - -* increase timeout - -* adjust timeout - -* removed retries - -* set retries to 0 - -* udpated retry interval - -* sleep adjust - -* removed loop, depending on python retry - -* increased project sleep to 2 minutes before trying get - -* moved sleep - -* fixed timestamp name, will removed security alerts - -## [2.0.3](https://github.ibm.com/coligo/python-sdk/compare/v2.0.2...v2.0.3) (2023-01-25) - - -### Bug Fixes - -* **ci:** updated pypi token ([ecfc0ba](https://github.ibm.com/coligo/python-sdk/commit/ecfc0bad61bb7ae88bbbcfdf2326055715febd2f)) - -## [2.0.2](https://github.ibm.com/coligo/python-sdk/compare/v2.0.1...v2.0.2) (2023-01-25) - - -### Bug Fixes - -* **ci:** adjusted branch configuration of travis ([dc9e46e](https://github.ibm.com/coligo/python-sdk/commit/dc9e46e2eb4544f2af6e24d607309a422a801a66)) - -## [2.0.1](https://github.ibm.com/coligo/python-sdk/compare/v2.0.0...v2.0.1) (2023-01-25) - - -### Bug Fixes - -* **ci:** added encrypted pypi deploy key ([#8](https://github.ibm.com/coligo/python-sdk/issues/8)) ([729d82b](https://github.ibm.com/coligo/python-sdk/commit/729d82b3fb1bf8e0b550041451d05a3c1d78f80d)) - -# [2.0.0](https://github.ibm.com/coligo/python-sdk/compare/v1.0.0...v2.0.0) (2023-01-24) - - -### Features - -* **ci:** ready for v2 ([#7](https://github.ibm.com/coligo/python-sdk/issues/7)) ([b5eea13](https://github.ibm.com/coligo/python-sdk/commit/b5eea1399e835a3b913add7687e05ed376e87031)) - - -### BREAKING CHANGES - -* **ci:** v2.0.0 - -# [1.0.0](https://github.ibm.com/coligo/python-sdk/compare/v0.1.0...v1.0.0) (2023-01-21) - - -### Features - -* **build:** release v1 ([#6](https://github.ibm.com/coligo/python-sdk/issues/6)) ([160b7d1](https://github.ibm.com/coligo/python-sdk/commit/160b7d1ac4855a0eb7e6c534c2acb500fa65695f)) - - -### BREAKING CHANGES - -* **build:** marks v1.0.0 of this repository diff --git a/example/README.md b/example/README.md deleted file mode 100644 index 5c366b9..0000000 --- a/example/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# Code Engine Python SDK Example - -## Running example.py - -To run the example, create a Code Engine project from the Console or Code Engine CLI, and run the following commands from this directory: -1. `pip install kubernetes` -2. `export CE_API_KEY=` -3. `export CE_PROJECT_ID=` -4. `export CE_PROJECT_REGION=` -5. `python example.py` - -Note: Requires Python 3.6 or later. - -## How-to - -### Set up an authenticator -```python -authenticator = IAMAuthenticator( - apikey=os.environ.get('CE_API_KEY'), - client_id='bx', - client_secret='bx', -) -``` - -### Set up a Code Engine client -```python -ce_client = IbmCloudCodeEngineV1(authenticator=authenticator) -ce_client.set_service_url( - 'https://api.' + os.environ.get('CE_PROJECT_REGION') + '.codeengine.cloud.ibm.com/api/v1' -) -``` - -### Use an HTTP library to get a Delegated Refresh Token from IAM -```python -iam_response = requests.post('https://iam.cloud.ibm.com/identity/token', headers={ - 'Content-Type': 'application/x-www-form-urlencoded' -}, data={ - 'grant_type': 'urn:ibm:params:oauth:grant-type:apikey', - 'apikey': os.environ.get('CE_API_KEY'), - 'response_type': 'delegated_refresh_token', - 'receiver_client_ids': 'ce', - 'delegated_refresh_token_expiry': '3600' -}) -delegated_refresh_token = iam_response.json()['delegated_refresh_token'] -``` - -### Use the Code Engine client to get a Kubernetes config -```python -kubeconfig_response = ce_client.get_kubeconfig( - x_delegated_refresh_token=delegated_refresh_token, - id=os.environ.get('CE_PROJECT_ID'), -) -kubeconfig_string = kubeconfig_response.get_result().content -``` - -## Deprecated endpoint -The `/namespaces/{id}/config` endpoint function, `list_kubeconfig()`, is deprecated, and will be removed before Code Engine is out of Beta. Please use the `get_kubeconfig()` function, demonstrated in the example above. diff --git a/example/example.py b/example/example.py deleted file mode 100644 index 168a691..0000000 --- a/example/example.py +++ /dev/null @@ -1,65 +0,0 @@ -""" -Example of IBM Cloud Code Engine SDK usage -""" - -import os -import tempfile -import kubernetes -import requests -import json -from ibm_code_engine_sdk.ibm_cloud_code_engine_v1 import IbmCloudCodeEngineV1 -from ibm_cloud_sdk_core.authenticators import IAMAuthenticator - -if ( - os.environ.get('CE_API_KEY') == None - or os.environ.get('CE_PROJECT_REGION') == None - or os.environ.get('CE_PROJECT_ID') == None -): - print( - 'You must set the envrionment variables CE_API_KEY, CE_PROJECT_REGION and CE_PROJECT_ID ' - + 'before using the example.' - ) - -# Create an IAM authenticator. -authenticator = IAMAuthenticator( - apikey=os.environ.get('CE_API_KEY'), - client_id='bx', - client_secret='bx', -) - -# Construct the Code Engine client. -ce_client = IbmCloudCodeEngineV1(authenticator=authenticator) -ce_client.set_service_url('https://api.' + os.environ.get('CE_PROJECT_REGION') + '.codeengine.cloud.ibm.com/api/v1') - -# Get a Delegated Refresh Token from IAM -iam_response = requests.post( - 'https://iam.cloud.ibm.com/identity/token', - headers={'Content-Type': 'application/x-www-form-urlencoded'}, - data={ - 'grant_type': 'urn:ibm:params:oauth:grant-type:apikey', - 'apikey': os.environ.get('CE_API_KEY'), - 'response_type': 'delegated_refresh_token', - 'receiver_client_ids': 'ce', - 'delegated_refresh_token_expiry': '3600', - }, -) -delegated_refresh_token = iam_response.json()['delegated_refresh_token'] - -# Get Code Engine project config using the Code Engine client. -kubeconfig_response = ce_client.get_kubeconfig( - x_delegated_refresh_token=delegated_refresh_token, - id=os.environ.get('CE_PROJECT_ID'), -) -kubeconfig_string = kubeconfig_response.get_result().content - -# Setup Kubernetes client using project config -kubeconfig_file, kubeconfig_filename = tempfile.mkstemp() -os.write(kubeconfig_file, kubeconfig_string) -kubernetes.config.load_kube_config(config_file=kubeconfig_filename) -kube_client = kubernetes.client.CoreV1Api() - -# Get something from project. -contexts = kubernetes.config.list_kube_config_contexts(config_file=kubeconfig_filename)[0][0] -namespace = contexts.get('context').get('namespace') -configmaps = kube_client.list_namespaced_config_map(namespace) -print('Project ' + os.environ.get('CE_PROJECT_ID') + ' has ' + str(len(configmaps.items)) + ' configmaps.') diff --git a/example/example_deprecated.py b/example/example_deprecated.py deleted file mode 100644 index 36d78ea..0000000 --- a/example/example_deprecated.py +++ /dev/null @@ -1,52 +0,0 @@ -""" -Example of IBM Cloud Code Engine SDK usage -""" - -import os -import tempfile -import kubernetes -from ibm_code_engine_sdk.ibm_cloud_code_engine_v1 import IbmCloudCodeEngineV1 -from ibm_cloud_sdk_core.authenticators import IAMAuthenticator - -if ( - os.environ.get('CE_API_KEY') == None - or os.environ.get('CE_PROJECT_REGION') == None - or os.environ.get('CE_PROJECT_ID') == None -): - print( - 'You must set the envrionment variables CE_API_KEY, CE_PROJECT_REGION and CE_PROJECT_ID ' - + 'before using the example.' - ) - -# Create an IAM authenticator. -authenticator = IAMAuthenticator( - apikey=os.environ.get('CE_API_KEY'), - client_id='bx', - client_secret='bx', -) - -# Construct the Code Engine client. -ce_client = IbmCloudCodeEngineV1(authenticator=authenticator) -ce_client.set_service_url('https://api.' + os.environ.get('CE_PROJECT_REGION') + '.codeengine.cloud.ibm.com/api/v1') - -# Get IAM tokens using the authenticator -refresh_token = authenticator.token_manager.request_token().get('refresh_token') - -# Get Code Engine project config using the Code Engine client. -kubeconfig_response = ce_client.list_kubeconfig( - refresh_token=refresh_token, - id=os.environ.get('CE_PROJECT_ID'), -) -kubeconfig_string = kubeconfig_response.get_result().content - -# Setup Kubernetes client using project config -kubeconfig_file, kubeconfig_filename = tempfile.mkstemp() -os.write(kubeconfig_file, kubeconfig_string) -kubernetes.config.load_kube_config(config_file=kubeconfig_filename) -kube_client = kubernetes.client.CoreV1Api() - -# Get something from project. -contexts = kubernetes.config.list_kube_config_contexts(config_file=kubeconfig_filename)[0][0] -namespace = contexts.get('context').get('namespace') -configmaps = kube_client.list_namespaced_config_map(namespace) -print('Project ' + os.environ.get('CE_PROJECT_ID') + ' has ' + str(len(configmaps.items)) + ' configmaps.') diff --git a/package.json b/package.json deleted file mode 100644 index 86fc6e3..0000000 --- a/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "semantic-release-dependencies", - "version": "0.0.0", - "description": "This package.json is being used to manage semantic-release and its dependencies", - "license": "Apache-2.0", - "devDependencies": { - "semantic-release": "19.0.5", - "@semantic-release/changelog": "6.0.2", - "@semantic-release/exec": "6.0.3", - "@semantic-release/git": "10.0.1" - }, - "scripts": { - "semantic-release": "semantic-release" - } -} diff --git a/sdkgen_config.json b/sdkgen_config.json deleted file mode 100644 index 70dcdd3..0000000 --- a/sdkgen_config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "apiPackage": "ibm_code_engine_sdk", - "serviceClass": "CodeEngineV2", - "unitTestFolder": "test/unit/", - "intTestFolder": "test/integration" -} diff --git a/test-integration.sh b/test-integration.sh deleted file mode 100755 index a636808..0000000 --- a/test-integration.sh +++ /dev/null @@ -1,29 +0,0 @@ -# Code Engine Python SDK Integration tests -# Requires the following env. variables (provdied to TravisCI) -# - CE_API_KEY: IBM Cloud API Key -# - CE_PROJECT_ID: GUID of Code Engine project to target -# - CE_PROJECT_REGION: region for API URL - -echo "Running integration tests..." - -# Install dependencies -pip install kubernetes - -# Run example, get exit code -exampleoutput=$(python example/example.py) -exampleexit=$? -if [ $exampleexit -ne 0 ]; then - echo "Integration tests failed with exit code $exampleexit" - echo $exampleoutput - exit $exampleexit -fi - -# Check if output is expected -outputcheck="2 configmaps" -if [[ $exampleoutput != *$outputcheck* ]]; then - echo "Intergration test output is incorrect:" - echo "Expected '$exampleoutput' to contain '$outputcheck'" - exit 1 -fi - -echo "Success!" \ No newline at end of file