From e1b40d1cc36558a4c0d0e51d7571a51438a7a843 Mon Sep 17 00:00:00 2001 From: Matthew Myers Date: Wed, 6 Sep 2023 12:38:34 -0500 Subject: [PATCH 1/2] Add host attribute to the Agent object For a local project, we found that the host attribute is being returned from the TeamCity server, but we are unable to access it in the Agent object. According to the online docs, this is an official attribute so likely it was added since the last time the swagger.json was pulled. Ideally we would pull the new swagger.json and re-generate everything based on the new swagger.json, but I found an enormous number of differences, including breaking changes if we do that. For now, just adding this attribute is sufficient to make forward progress --- docs-sphinx/swagger/api/BuildApi.rst | 2 +- docs-sphinx/swagger/models/Agent.rst | 3 +++ dohq_teamcity/models/agent.py | 28 +++++++++++++++++++++++++++- swagger/swagger.json | 6 ++++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/docs-sphinx/swagger/api/BuildApi.rst b/docs-sphinx/swagger/api/BuildApi.rst index 5ccf3ec..06cff15 100644 --- a/docs-sphinx/swagger/api/BuildApi.rst +++ b/docs-sphinx/swagger/api/BuildApi.rst @@ -819,7 +819,7 @@ get_content try: api_response = tc.build_api.get_content(path, build_locator, response_builder=response_builder, resolve_parameters=resolve_parameters, log_build_usage=log_build_usage) - pprint(api_response) + pprint(api_response) except ApiException as e: print("Exception when calling BuildApi->get_content: %s\n" % e) diff --git a/docs-sphinx/swagger/models/Agent.rst b/docs-sphinx/swagger/models/Agent.rst index 68888da..ae62e30 100644 --- a/docs-sphinx/swagger/models/Agent.rst +++ b/docs-sphinx/swagger/models/Agent.rst @@ -51,6 +51,9 @@ Properties * - **disconnection_comment** - **str** - `optional` + * - **host** + - **str** + - `optional` * - **href** - **str** - `optional` diff --git a/dohq_teamcity/models/agent.py b/dohq_teamcity/models/agent.py index 1bb1949..54e9df3 100644 --- a/dohq_teamcity/models/agent.py +++ b/dohq_teamcity/models/agent.py @@ -40,6 +40,7 @@ class Agent(TeamCityObject): 'version': 'str', 'last_activity_time': 'str', 'disconnection_comment': 'str', + 'host': 'str', 'href': 'str', 'web_url': 'str', 'build': 'Build', @@ -67,6 +68,7 @@ class Agent(TeamCityObject): 'version': 'version', 'last_activity_time': 'lastActivityTime', 'disconnection_comment': 'disconnectionComment', + 'host': 'host', 'href': 'href', 'web_url': 'webUrl', 'build': 'build', @@ -81,7 +83,7 @@ class Agent(TeamCityObject): 'locator': 'locator' } - def __init__(self, id=None, name=None, type_id=None, connected=False, enabled=False, authorized=False, uptodate=False, ip=None, protocol=None, version=None, last_activity_time=None, disconnection_comment=None, href=None, web_url=None, build=None, links=None, enabled_info=None, authorized_info=None, properties=None, environment=None, pool=None, compatible_build_types=None, incompatible_build_types=None, locator=None, teamcity=None): # noqa: E501 + def __init__(self, id=None, name=None, type_id=None, connected=False, enabled=False, authorized=False, uptodate=False, ip=None, protocol=None, version=None, last_activity_time=None, disconnection_comment=None, host=None, href=None, web_url=None, build=None, links=None, enabled_info=None, authorized_info=None, properties=None, environment=None, pool=None, compatible_build_types=None, incompatible_build_types=None, locator=None, teamcity=None): # noqa: E501 """Agent - a model defined in Swagger""" # noqa: E501 self._id = None @@ -96,6 +98,7 @@ def __init__(self, id=None, name=None, type_id=None, connected=False, enabled=Fa self._version = None self._last_activity_time = None self._disconnection_comment = None + self._host = None self._href = None self._web_url = None self._build = None @@ -134,6 +137,8 @@ def __init__(self, id=None, name=None, type_id=None, connected=False, enabled=Fa self.last_activity_time = last_activity_time if disconnection_comment is not None: self.disconnection_comment = disconnection_comment + if host is not None: + self.host = host if href is not None: self.href = href if web_url is not None: @@ -412,6 +417,27 @@ def disconnection_comment(self, disconnection_comment): self._disconnection_comment = disconnection_comment + @property + def host(self): + """Gets the host of this Agent. # noqa: E501 + + + :return: The host of this Agent. # noqa: E501 + :rtype: str + """ + return self._host + + @host.setter + def host(self, host): + """Sets the host of this Agent. + + + :param host: The host of this Agent. # noqa: E501 + :type: str + """ + + self._host = host + @property def href(self): """Gets the href of this Agent. # noqa: E501 diff --git a/swagger/swagger.json b/swagger/swagger.json index 35a218d..73f53a8 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -15569,6 +15569,12 @@ "attribute": true } }, + "host": { + "type": "string", + "xml": { + "attribute": true + } + }, "href": { "type": "string", "xml": { From c722eab242b9121295c3541e99949bf40fd5e10e Mon Sep 17 00:00:00 2001 From: Filipe Pina Date: Mon, 30 Oct 2023 15:18:00 +0000 Subject: [PATCH 2/2] add pauseComment to BuildType definition --- docs-sphinx/swagger/models/BuildType.rst | 3 +++ dohq_teamcity/models/build_type.py | 29 +++++++++++++++++++++++- swagger/swagger.json | 3 +++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/docs-sphinx/swagger/models/BuildType.rst b/docs-sphinx/swagger/models/BuildType.rst index 09c0ad1..344aa70 100644 --- a/docs-sphinx/swagger/models/BuildType.rst +++ b/docs-sphinx/swagger/models/BuildType.rst @@ -33,6 +33,9 @@ Properties * - **paused** - **bool** - `optional` [default to ``False``] + * - **pause_comment** + - `Comment <./Comment.html>`_ + - `optional` * - **uuid** - **str** - `optional` diff --git a/dohq_teamcity/models/build_type.py b/dohq_teamcity/models/build_type.py index a9ca3d8..8be880f 100644 --- a/dohq_teamcity/models/build_type.py +++ b/dohq_teamcity/models/build_type.py @@ -10,6 +10,7 @@ # from dohq_teamcity.models.build_type import BuildType # noqa: F401,E501 # from dohq_teamcity.models.build_types import BuildTypes # noqa: F401,E501 # from dohq_teamcity.models.builds import Builds # noqa: F401,E501 +# from dohq_teamcity.models.comment import Comment # noqa: F401,E501 # from dohq_teamcity.models.features import Features # noqa: F401,E501 # from dohq_teamcity.models.investigations import Investigations # noqa: F401,E501 # from dohq_teamcity.models.links import Links # noqa: F401,E501 @@ -42,6 +43,7 @@ class BuildType(TeamCityObject): 'template_flag': 'bool', 'type': 'str', 'paused': 'bool', + 'pause_comment': 'Comment', 'uuid': 'str', 'description': 'str', 'project_name': 'str', @@ -78,6 +80,7 @@ class BuildType(TeamCityObject): 'template_flag': 'templateFlag', 'type': 'type', 'paused': 'paused', + 'pause_comment': 'pauseComment', 'uuid': 'uuid', 'description': 'description', 'project_name': 'projectName', @@ -107,7 +110,7 @@ class BuildType(TeamCityObject): 'locator': 'locator' } - def __init__(self, id=None, internal_id=None, name=None, template_flag=False, type=None, paused=False, uuid=None, description=None, project_name=None, project_id=None, project_internal_id=None, href=None, web_url=None, inherited=False, links=None, project=None, templates=None, template=None, vcs_root_entries=None, settings=None, parameters=None, steps=None, features=None, triggers=None, snapshot_dependencies=None, artifact_dependencies=None, agent_requirements=None, branches=None, builds=None, investigations=None, compatible_agents=None, vcs_root_instances=None, locator=None, teamcity=None): # noqa: E501 + def __init__(self, id=None, internal_id=None, name=None, template_flag=False, type=None, paused=False, pause_comment=None, uuid=None, description=None, project_name=None, project_id=None, project_internal_id=None, href=None, web_url=None, inherited=False, links=None, project=None, templates=None, template=None, vcs_root_entries=None, settings=None, parameters=None, steps=None, features=None, triggers=None, snapshot_dependencies=None, artifact_dependencies=None, agent_requirements=None, branches=None, builds=None, investigations=None, compatible_agents=None, vcs_root_instances=None, locator=None, teamcity=None): # noqa: E501 """BuildType - a model defined in Swagger""" # noqa: E501 self._id = None @@ -116,6 +119,7 @@ def __init__(self, id=None, internal_id=None, name=None, template_flag=False, ty self._template_flag = None self._type = None self._paused = None + self._pause_comment = None self._uuid = None self._description = None self._project_name = None @@ -157,6 +161,8 @@ def __init__(self, id=None, internal_id=None, name=None, template_flag=False, ty self.type = type if paused is not None: self.paused = paused + if pause_comment is not None: + self.pause_comment = pause_comment if uuid is not None: self.uuid = uuid if description is not None: @@ -339,6 +345,27 @@ def paused(self, paused): self._paused = paused + @property + def pause_comment(self): + """Gets the pause_comment of this BuildType. # noqa: E501 + + + :return: The pause_comment of this BuildType. # noqa: E501 + :rtype: Comment + """ + return self._pause_comment + + @pause_comment.setter + def pause_comment(self, pause_comment): + """Sets the pause_comment of this BuildType. + + + :param pause_comment: The pause_comment of this BuildType. # noqa: E501 + :type: Comment + """ + + self._pause_comment = pause_comment + @property def uuid(self): """Gets the uuid of this BuildType. # noqa: E501 diff --git a/swagger/swagger.json b/swagger/swagger.json index 73f53a8..e7dd1dd 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -16491,6 +16491,9 @@ }, "default": false }, + "pauseComment": { + "$ref": "#/definitions/comment" + }, "uuid": { "type": "string", "xml": {