Skip to content

Commit 404fa14

Browse files
author
SDKAuto
committed
CodeGen from PR 16902 in Azure/azure-rest-api-specs
Merge c7144760e2fddd0b9328f113cff6a03b2a8c8987 into b22180c6a1bed2d181e0b9e846e1f935cfcdb38d
1 parent fac68b7 commit 404fa14

File tree

65 files changed

+6988
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+6988
-0
lines changed

eng/versioning/version_client.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ com.azure.resourcemanager:azure-resourcemanager-logz;1.0.0-beta.1;1.0.0-beta.2
323323
com.azure.resourcemanager:azure-resourcemanager-storagepool;1.0.0-beta.1;1.0.0-beta.2
324324
com.azure.resourcemanager:azure-resourcemanager-dataprotection;1.0.0-beta.1;1.0.0-beta.2
325325
com.azure.resourcemanager:azure-resourcemanager-desktopvirtualization;1.0.0-beta.1;1.0.0-beta.2
326+
com.azure.resourcemanager:azure-resourcemanager-devops;1.0.0-beta.1;1.0.0-beta.1
326327
com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0
327328

328329
# Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,7 @@
756756
<module>sdk/desktopvirtualization</module>
757757
<module>sdk/deviceprovisioningservices</module>
758758
<module>sdk/deviceupdate</module>
759+
<module>sdk/devops</module>
759760
<module>sdk/devspaces</module>
760761
<module>sdk/devtestlabs</module>
761762
<module>sdk/digitaltwins</module>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 1.0.0-beta.1 (2021-11-30)
4+
5+
- Azure Resource Manager devops client library for Java. This package contains Microsoft Azure SDK for devops Management SDK. Azure DevOps Resource Provider. Package tag package-2019-07-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Azure Resource Manager devops client library for Java
2+
3+
Azure Resource Manager devops client library for Java.
4+
5+
This package contains Microsoft Azure SDK for devops Management SDK. Azure DevOps Resource Provider. Package tag package-2019-07-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
6+
7+
## We'd love to hear your feedback
8+
9+
We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better.
10+
11+
If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together.
12+
13+
Thank you in advance for your collaboration. We really appreciate your time!
14+
15+
## Documentation
16+
17+
Various documentation is available to help you get started
18+
19+
- [API reference documentation][docs]
20+
21+
## Getting started
22+
23+
### Prerequisites
24+
25+
- [Java Development Kit (JDK)][jdk] with version 8 or above
26+
- [Azure Subscription][azure_subscription]
27+
28+
### Adding the package to your product
29+
30+
[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-devops;current})
31+
```xml
32+
<dependency>
33+
<groupId>com.azure.resourcemanager</groupId>
34+
<artifactId>azure-resourcemanager-devops</artifactId>
35+
<version>1.0.0-beta.1</version>
36+
</dependency>
37+
```
38+
[//]: # ({x-version-update-end})
39+
40+
### Include the recommended packages
41+
42+
Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client.
43+
44+
[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation.
45+
46+
### Authentication
47+
48+
By default, Azure Active Directory token authentication depends on correct configure of following environment variables.
49+
50+
- `AZURE_CLIENT_ID` for Azure client ID.
51+
- `AZURE_TENANT_ID` for Azure tenant ID.
52+
- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate.
53+
54+
In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
55+
56+
With above configuration, `azure` client can be authenticated by following code:
57+
58+
```java
59+
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
60+
TokenCredential credential = new DefaultAzureCredentialBuilder()
61+
.authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
62+
.build();
63+
DevopsManager manager = DevopsManager
64+
.authenticate(credential, profile);
65+
```
66+
67+
The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise.
68+
69+
See [Authentication][authenticate] for more options.
70+
71+
## Key concepts
72+
73+
See [API design][design] for general introduction on design and key concepts on Azure Management Libraries.
74+
75+
## Examples
76+
77+
[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/devops/azure-resourcemanager-devops/SAMPLE.md)
78+
79+
80+
## Troubleshooting
81+
82+
## Next steps
83+
84+
## Contributing
85+
86+
For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md).
87+
88+
1. Fork it
89+
1. Create your feature branch (`git checkout -b my-new-feature`)
90+
1. Commit your changes (`git commit -am 'Add some feature'`)
91+
1. Push to the branch (`git push origin my-new-feature`)
92+
1. Create new Pull Request
93+
94+
<!-- LINKS -->
95+
[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS
96+
[docs]: https://azure.github.io/azure-sdk-for-java/
97+
[jdk]: https://docs.microsoft.com/java/azure/jdk/
98+
[azure_subscription]: https://azure.microsoft.com/free/
99+
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
100+
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty
101+
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md
102+
[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md
Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
# Code snippets and samples
2+
3+
4+
## Operations
5+
6+
- [List](#operations_list)
7+
8+
## PipelineTemplateDefinitions
9+
10+
- [List](#pipelinetemplatedefinitions_list)
11+
12+
## Pipelines
13+
14+
- [CreateOrUpdate](#pipelines_createorupdate)
15+
- [Delete](#pipelines_delete)
16+
- [GetByResourceGroup](#pipelines_getbyresourcegroup)
17+
- [List](#pipelines_list)
18+
- [ListByResourceGroup](#pipelines_listbyresourcegroup)
19+
- [Update](#pipelines_update)
20+
### Operations_List
21+
22+
```java
23+
import com.azure.core.util.Context;
24+
25+
/** Samples for Operations List. */
26+
public final class OperationsListSamples {
27+
/*
28+
* x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/ListOperations.json
29+
*/
30+
/**
31+
* Sample code: Get a list of operations supported by Microsoft.DevOps resource provider.
32+
*
33+
* @param manager Entry point to DevopsManager.
34+
*/
35+
public static void getAListOfOperationsSupportedByMicrosoftDevOpsResourceProvider(
36+
com.azure.resourcemanager.devops.DevopsManager manager) {
37+
manager.operations().list(Context.NONE);
38+
}
39+
}
40+
```
41+
42+
### PipelineTemplateDefinitions_List
43+
44+
```java
45+
import com.azure.core.util.Context;
46+
47+
/** Samples for PipelineTemplateDefinitions List. */
48+
public final class PipelineTemplateDefinitionsListSamples {
49+
/*
50+
* x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/ListPipelineTemplateDefinitions.json
51+
*/
52+
/**
53+
* Sample code: Get the list of pipeline template definitions.
54+
*
55+
* @param manager Entry point to DevopsManager.
56+
*/
57+
public static void getTheListOfPipelineTemplateDefinitions(com.azure.resourcemanager.devops.DevopsManager manager) {
58+
manager.pipelineTemplateDefinitions().list(Context.NONE);
59+
}
60+
}
61+
```
62+
63+
### Pipelines_CreateOrUpdate
64+
65+
```java
66+
import com.azure.resourcemanager.devops.models.BootstrapConfiguration;
67+
import com.azure.resourcemanager.devops.models.OrganizationReference;
68+
import com.azure.resourcemanager.devops.models.PipelineTemplate;
69+
import com.azure.resourcemanager.devops.models.ProjectReference;
70+
import java.util.HashMap;
71+
import java.util.Map;
72+
73+
/** Samples for Pipelines CreateOrUpdate. */
74+
public final class PipelinesCreateOrUpdateSamples {
75+
/*
76+
* x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/CreateAzurePipeline-Sample-AspNet-WindowsWebApp.json
77+
*/
78+
/**
79+
* Sample code: Create an Azure pipeline to deploy a sample ASP.Net application to Azure web-app.
80+
*
81+
* @param manager Entry point to DevopsManager.
82+
*/
83+
public static void createAnAzurePipelineToDeployASampleASPNetApplicationToAzureWebApp(
84+
com.azure.resourcemanager.devops.DevopsManager manager) {
85+
manager
86+
.pipelines()
87+
.define("myAspNetWebAppPipeline")
88+
.withRegion("South India")
89+
.withExistingResourceGroup("myAspNetWebAppPipeline-rg")
90+
.withOrganization(new OrganizationReference().withName("myAspNetWebAppPipeline-org"))
91+
.withProject(new ProjectReference().withName("myAspNetWebAppPipeline-project"))
92+
.withBootstrapConfiguration(
93+
new BootstrapConfiguration()
94+
.withTemplate(
95+
new PipelineTemplate()
96+
.withId("ms.vss-continuous-delivery-pipeline-templates.aspnet-windowswebapp")
97+
.withParameters(
98+
mapOf(
99+
"appInsightLocation",
100+
"South India",
101+
"appServicePlan",
102+
"S1 Standard",
103+
"azureAuth",
104+
"{\"scheme\":\"ServicePrincipal\",\"parameters\":{\"tenantid\":\"{subscriptionTenantId}\",\"objectid\":\"{appObjectId}\",\"serviceprincipalid\":\"{appId}\",\"serviceprincipalkey\":\"{appSecret}\"}}",
105+
"location",
106+
"South India",
107+
"resourceGroup",
108+
"myAspNetWebAppPipeline-rg",
109+
"subscriptionId",
110+
"{subscriptionId}",
111+
"webAppName",
112+
"myAspNetWebApp"))))
113+
.withTags(mapOf())
114+
.create();
115+
}
116+
117+
@SuppressWarnings("unchecked")
118+
private static <T> Map<String, T> mapOf(Object... inputs) {
119+
Map<String, T> map = new HashMap<>();
120+
for (int i = 0; i < inputs.length; i += 2) {
121+
String key = (String) inputs[i];
122+
T value = (T) inputs[i + 1];
123+
map.put(key, value);
124+
}
125+
return map;
126+
}
127+
}
128+
```
129+
130+
### Pipelines_Delete
131+
132+
```java
133+
import com.azure.core.util.Context;
134+
135+
/** Samples for Pipelines Delete. */
136+
public final class PipelinesDeleteSamples {
137+
/*
138+
* x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/DeleteAzurePipeline.json
139+
*/
140+
/**
141+
* Sample code: Get an existing Azure pipeline.
142+
*
143+
* @param manager Entry point to DevopsManager.
144+
*/
145+
public static void getAnExistingAzurePipeline(com.azure.resourcemanager.devops.DevopsManager manager) {
146+
manager.pipelines().deleteWithResponse("myAspNetWebAppPipeline-rg", "myAspNetWebAppPipeline", Context.NONE);
147+
}
148+
}
149+
```
150+
151+
### Pipelines_GetByResourceGroup
152+
153+
```java
154+
import com.azure.core.util.Context;
155+
156+
/** Samples for Pipelines GetByResourceGroup. */
157+
public final class PipelinesGetByResourceGroupSamples {
158+
/*
159+
* x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/GetAzurePipeline.json
160+
*/
161+
/**
162+
* Sample code: Get an existing Azure pipeline.
163+
*
164+
* @param manager Entry point to DevopsManager.
165+
*/
166+
public static void getAnExistingAzurePipeline(com.azure.resourcemanager.devops.DevopsManager manager) {
167+
manager
168+
.pipelines()
169+
.getByResourceGroupWithResponse("myAspNetWebAppPipeline-rg", "myAspNetWebAppPipeline", Context.NONE);
170+
}
171+
}
172+
```
173+
174+
### Pipelines_List
175+
176+
```java
177+
import com.azure.core.util.Context;
178+
179+
/** Samples for Pipelines List. */
180+
public final class PipelinesListSamples {
181+
/*
182+
* x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/ListAzurePipelinesBySubscription.json
183+
*/
184+
/**
185+
* Sample code: List all Azure pipelines under the specified subscription.
186+
*
187+
* @param manager Entry point to DevopsManager.
188+
*/
189+
public static void listAllAzurePipelinesUnderTheSpecifiedSubscription(
190+
com.azure.resourcemanager.devops.DevopsManager manager) {
191+
manager.pipelines().list(Context.NONE);
192+
}
193+
}
194+
```
195+
196+
### Pipelines_ListByResourceGroup
197+
198+
```java
199+
import com.azure.core.util.Context;
200+
201+
/** Samples for Pipelines ListByResourceGroup. */
202+
public final class PipelinesListByResourceGroupSamples {
203+
/*
204+
* x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/ListAzurePipelinesByResourceGroup.json
205+
*/
206+
/**
207+
* Sample code: List all Azure Pipelines under the specified resource group.
208+
*
209+
* @param manager Entry point to DevopsManager.
210+
*/
211+
public static void listAllAzurePipelinesUnderTheSpecifiedResourceGroup(
212+
com.azure.resourcemanager.devops.DevopsManager manager) {
213+
manager.pipelines().listByResourceGroup("myAspNetWebAppPipeline-rg", Context.NONE);
214+
}
215+
}
216+
```
217+
218+
### Pipelines_Update
219+
220+
```java
221+
import com.azure.core.util.Context;
222+
import com.azure.resourcemanager.devops.models.Pipeline;
223+
import java.util.HashMap;
224+
import java.util.Map;
225+
226+
/** Samples for Pipelines Update. */
227+
public final class PipelinesUpdateSamples {
228+
/*
229+
* x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/UpdateAzurePipeline.json
230+
*/
231+
/**
232+
* Sample code: Get an existing Azure pipeline.
233+
*
234+
* @param manager Entry point to DevopsManager.
235+
*/
236+
public static void getAnExistingAzurePipeline(com.azure.resourcemanager.devops.DevopsManager manager) {
237+
Pipeline resource =
238+
manager
239+
.pipelines()
240+
.getByResourceGroupWithResponse("myAspNetWebAppPipeline-rg", "myAspNetWebAppPipeline", Context.NONE)
241+
.getValue();
242+
resource.update().withTags(mapOf("tagKey", "tagvalue")).apply();
243+
}
244+
245+
@SuppressWarnings("unchecked")
246+
private static <T> Map<String, T> mapOf(Object... inputs) {
247+
Map<String, T> map = new HashMap<>();
248+
for (int i = 0; i < inputs.length; i += 2) {
249+
String key = (String) inputs[i];
250+
T value = (T) inputs[i + 1];
251+
map.put(key, value);
252+
}
253+
return map;
254+
}
255+
}
256+
```
257+

0 commit comments

Comments
 (0)