-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pipeline variables and variable group management commands (#711)
* Variable group management commands * Pipeline Variable commands
- Loading branch information
Showing
13 changed files
with
9,644 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
from azext_devops.dev.common.services import get_build_client | ||
from azext_devops.devops_sdk.v5_0.build.models import DefinitionResourceReference | ||
|
||
|
||
def set_authorize_resource(authorized, res_id, name, res_type, organization, project): | ||
""" | ||
param authorized: Boolean value set to authorize or unauthorize resource | ||
param id: Id of the resource to authorize | ||
param name: Name of the resource to authorize | ||
param type: Type of the resource to authorize | ||
param organization: Organization URL | ||
param project: Project Id | ||
""" | ||
client = get_build_client(organization=organization) | ||
resources = [DefinitionResourceReference(authorized=authorized, id=res_id, name=name, type=res_type)] | ||
client.authorize_project_resources(resources=resources, project=project) | ||
|
||
|
||
def get_authorize_resource(res_id, res_type, organization, project): | ||
""" | ||
param id: Id of the resource to authorize | ||
param name: Name of the resource to authorize | ||
param type: Type of the resource to authorize | ||
param organization: Organization URL | ||
param project: Project Id | ||
""" | ||
client = get_build_client(organization=organization) | ||
resource = client.get_project_resources(project=project, id=res_id, type=res_type) | ||
if resource: | ||
return resource[0].authorized | ||
return None |
Oops, something went wrong.