-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathenvironments.http
119 lines (95 loc) · 3.61 KB
/
environments.http
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#####################
#
# This contains api samples for Environments, Environment Checks, and Environment Resources.
#
#####################
###
@organization = xyz
@project = myproj
@basic_auth = Basic user:pass
###
# GET LIST OF ENVIRONMENTS
GET https://dev.azure.com/{{organization}}/{{project}}/_apis/distributedtask/environments?api-version=6.0-preview.1
Authorization: {{basic_auth}}
###
# CREATE ENVIRONMENT
POST https://dev.azure.com/{{organization}}/{{project}}/_apis/distributedtask/environments?api-version=5.0-preview
Authorization: {{basic_auth}}
Content-Type: application/json
{
"description": "my new environment",
"name": "MyEnv1"
}
###
# GET ENVIRONMENT DETAILS
@environment_id = 14176
@environment_name = MyEnv1
GET https://dev.azure.com/{{organization}}/{{project}}/_apis/distributedtask/environments/{{environment_id}}?expands=resourceReferences&api-version=6.0-preview.1
Authorization: {{basic_auth}}
###
# ADD ENVIRONMENT CHECK (APPROVAL)
@azure_group_or_user_name = mygroup1
@azure_group_or_user_id = be82d22b-c03d-4f4b-bda4-0eca8263861d
POST https://dev.azure.com/{{organization}}/{{project}}/_apis/pipelines/checks/configurations?api-version=5.2-preview.1
Authorization: {{basic_auth}}
Content-Type: application/json
{
"type": {
"name": "Approval"
},
"settings": {
"approvers": [
{
"displayName": "{{azure_group_or_user_name}}",
"id": "{{azure_group_or_user_id}}",
}
],
"executionOrder": 1,
"instructions": "",
"blockedApprovers": [],
"minRequiredApprovers": 0,
"requesterCannotBeApprover": false
},
"resource": {
"type": "environment",
"id": "{{environment_id}}",
"name": "{{environment_name}}"
},
"timeout": 43200
}
###
# GET ENVIRONMENT CHECKS (stored under .fps.dataProviders.data['ms.vss-pipelinechecks.checks-data-provider'].checkConfigurationDataList)
GET https://dev.azure.com/{{organization}}/{{project}}/_environments/{{environment_id}}/checks?__rt=fps&__ver=2
Authorization: {{basic_auth}}
###
# DELETE AN ENVIRONMENT CHECK
@environment_check_id = 13637
DELETE https://dev.azure.com/{{organization}}/{{project}}/_apis/pipelines/checks/configurations/{{environment_check_id}}?api-version=5.2-preview.1
Authorization: {{basic_auth}}
###
# ADD KUBERNETES SERVICE CONNECTION AS A RESOURCE IN ENVIRONMENT
@service_connection_id = 1cc3c68b-ad46-4584-9b99-d04a852ae227
POST https://dev.azure.com/{{organization}}/{{project}}/_apis/distributedtask/environments/{{environment_id}}/providers/kubernetes?api-version=5.0-preview
Authorization: {{basic_auth}}
Content-Type: application/json
{
"name": "ResourceName",
"namespace": "myns1",
"clusterName": "https://clusterurl.com",
"serviceEndpointId": "{{service_connection_id}}"
}
###
# GET ALL RESOURCES IN AN ENVIRONMENT (results under .resources[])
GET https://dev.azure.com/{{organization}}/{{project}}/_apis/distributedtask/environments/{{environment_id}}?expands=resourceReferences&api-version=6.0-preview.1
Authorization: {{basic_auth}}
###
# GET RESOURCE DETAILS
@resource_id = 10015
@resource_type = kubernetes
# @resource_type = virtualmachinegroups
GET https://dev.azure.com/{{organization}}/{{project}}/_apis/distributedtask/environments/{{environment_id}}/providers/{{resource_type}}/{{resource_id}}?api-version=6.0-preview.1
Authorization: {{basic_auth}}
###
# DELETE RESOURCE
DELETE https://dev.azure.com/{{organization}}/{{project}}/_apis/distributedtask/environments/{{environment_id}}/providers/{{resource_type}}/{{resource_id}}?api-version=6.0-preview.1
Authorization: {{basic_auth}}