Skip to content

Commit

Permalink
Updating .gitignore and pushing the released files, adding git clients
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Nechvátal committed Apr 25, 2023
1 parent c61b832 commit 0650fba
Show file tree
Hide file tree
Showing 12 changed files with 9,799 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,7 @@ __pycache__/
vsts/build/bdist.win32/

# don't ignore release management client
!azure-devops/azure/devops/released/release
!azure-devops/azure/devops/v5_1/release
!azure-devops/azure/devops/v6_0/release
!azure-devops/azure/devops/*/release

# ignore private folder for testing reported issues
issues/
39 changes: 39 additions & 0 deletions azure-devops/azure/devops/released/git/git_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# coding=utf-8

from msrest.universal_http import ClientRequest
from .git_client_base import GitClientBase


class GitClient(GitClientBase):
"""Git
:param str base_url: Service URL
:param Authentication creds: Authenticated credentials.
"""

def __init__(self, base_url=None, creds=None):
super(GitClient, self).__init__(base_url, creds)

def get_vsts_info(self, relative_remote_url):
url = self._client.format_url(relative_remote_url.rstrip('/') + '/vsts/info')
request = ClientRequest(method='GET', url=url)
headers = {'Accept': 'application/json'}
if self._suppress_fedauth_redirect:
headers['X-TFS-FedAuthRedirect'] = 'Suppress'
if self._force_msa_pass_through:
headers['X-VSS-ForceMsaPassThrough'] = 'true'
response = self._send_request(request, headers)
return self._deserialize('VstsInfo', response)

@staticmethod
def get_vsts_info_by_remote_url(remote_url, credentials,
suppress_fedauth_redirect=True,
force_msa_pass_through=True):
request = ClientRequest(method='GET', url=remote_url.rstrip('/') + '/vsts/info')
headers = {'Accept': 'application/json'}
if suppress_fedauth_redirect:
headers['X-TFS-FedAuthRedirect'] = 'Suppress'
if force_msa_pass_through:
headers['X-VSS-ForceMsaPassThrough'] = 'true'
git_client = GitClient(base_url=remote_url, creds=credentials)
response = git_client._send_request(request, headers)
return git_client._deserialize('VstsInfo', response)
39 changes: 39 additions & 0 deletions azure-devops/azure/devops/v7_0/git/git_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# coding=utf-8

from msrest.universal_http import ClientRequest
from .git_client_base import GitClientBase


class GitClient(GitClientBase):
"""Git
:param str base_url: Service URL
:param Authentication creds: Authenticated credentials.
"""

def __init__(self, base_url=None, creds=None):
super(GitClient, self).__init__(base_url, creds)

def get_vsts_info(self, relative_remote_url):
url = self._client.format_url(relative_remote_url.rstrip('/') + '/vsts/info')
request = ClientRequest(method='GET', url=url)
headers = {'Accept': 'application/json'}
if self._suppress_fedauth_redirect:
headers['X-TFS-FedAuthRedirect'] = 'Suppress'
if self._force_msa_pass_through:
headers['X-VSS-ForceMsaPassThrough'] = 'true'
response = self._send_request(request, headers)
return self._deserialize('VstsInfo', response)

@staticmethod
def get_vsts_info_by_remote_url(remote_url, credentials,
suppress_fedauth_redirect=True,
force_msa_pass_through=True):
request = ClientRequest(method='GET', url=remote_url.rstrip('/') + '/vsts/info')
headers = {'Accept': 'application/json'}
if suppress_fedauth_redirect:
headers['X-TFS-FedAuthRedirect'] = 'Suppress'
if force_msa_pass_through:
headers['X-VSS-ForceMsaPassThrough'] = 'true'
git_client = GitClient(base_url=remote_url, creds=credentials)
response = git_client._send_request(request, headers)
return git_client._deserialize('VstsInfo', response)
115 changes: 115 additions & 0 deletions azure-devops/azure/devops/v7_0/release/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Generated file, DO NOT EDIT
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------------------------

from .models import *
from .release_client import ReleaseClient

__all__ = [
'AgentArtifactDefinition',
'ApprovalOptions',
'Artifact',
'ArtifactMetadata',
'ArtifactSourceReference',
'ArtifactTriggerConfiguration',
'ArtifactTypeDefinition',
'ArtifactVersion',
'ArtifactVersionQueryResult',
'AuthorizationHeader',
'AutoTriggerIssue',
'BuildVersion',
'ComplianceSettings',
'Condition',
'ConfigurationVariableValue',
'DataSourceBindingBase',
'DefinitionEnvironmentReference',
'Deployment',
'DeploymentAttempt',
'DeploymentJob',
'DeploymentQueryParameters',
'EmailRecipients',
'EnvironmentExecutionPolicy',
'EnvironmentOptions',
'EnvironmentRetentionPolicy',
'EnvironmentTrigger',
'FavoriteItem',
'Folder',
'GateUpdateMetadata',
'GraphSubjectBase',
'Change',
'IdentityRef',
'IgnoredGate',
'InputDescriptor',
'InputValidation',
'InputValue',
'InputValues',
'InputValuesError',
'InputValuesQuery',
'Issue',
'MailMessage',
'ManualIntervention',
'ManualInterventionUpdateMetadata',
'Metric',
'OrgPipelineReleaseSettings',
'OrgPipelineReleaseSettingsUpdateParameters',
'PipelineProcess',
'ProcessParameters',
'ProjectPipelineReleaseSettings',
'ProjectPipelineReleaseSettingsUpdateParameters',
'ProjectReference',
'QueuedReleaseData',
'ReferenceLinks',
'Release',
'ReleaseApproval',
'ReleaseApprovalHistory',
'ReleaseCondition',
'ReleaseDefinition',
'ReleaseDefinitionApprovals',
'ReleaseDefinitionApprovalStep',
'ReleaseDefinitionDeployStep',
'ReleaseDefinitionEnvironment',
'ReleaseDefinitionEnvironmentStep',
'ReleaseDefinitionEnvironmentSummary',
'ReleaseDefinitionEnvironmentTemplate',
'ReleaseDefinitionGate',
'ReleaseDefinitionGatesOptions',
'ReleaseDefinitionGatesStep',
'ReleaseDefinitionRevision',
'ReleaseDefinitionShallowReference',
'ReleaseDefinitionSummary',
'ReleaseDefinitionUndeleteParameter',
'ReleaseDeployPhase',
'ReleaseEnvironment',
'ReleaseEnvironmentShallowReference',
'ReleaseEnvironmentUpdateMetadata',
'ReleaseGates',
'ReleaseReference',
'ReleaseRevision',
'ReleaseSettings',
'ReleaseShallowReference',
'ReleaseSchedule',
'ReleaseStartEnvironmentMetadata',
'ReleaseStartMetadata',
'ReleaseTask',
'ReleaseTaskAttachment',
'ReleaseUpdateMetadata',
'ReleaseWorkItemRef',
'RetentionPolicy',
'RetentionSettings',
'SourcePullRequestVersion',
'SummaryMailSection',
'TaskInputDefinitionBase',
'TaskInputValidation',
'TaskSourceDefinitionBase',
'VariableGroup',
'VariableGroupProjectReference',
'VariableGroupProviderData',
'VariableValue',
'WorkflowTask',
'WorkflowTaskReference',
'ReleaseClient'
]
Loading

0 comments on commit 0650fba

Please sign in to comment.