Skip to content

Commit 656f4ac

Browse files
author
SDKAuto
committed
CodeGen from PR 17880 in Azure/azure-rest-api-specs
Merge b0fb385f046f71dd9ff14456ebe540403ab7ae5c into e43e7725f1eb439f6dcece681ad7852c47a6a9ac
1 parent 849ac94 commit 656f4ac

File tree

59 files changed

+6621
-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.

59 files changed

+6621
-0
lines changed

eng/versioning/version_client.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ com.azure.resourcemanager:azure-resourcemanager-securityinsights;1.0.0-beta.2;1.
340340
com.azure.resourcemanager:azure-resourcemanager-oep;1.0.0-beta.1;1.0.0-beta.2
341341
com.azure.resourcemanager:azure-resourcemanager-dnsresolver;1.0.0-beta.1;1.0.0-beta.2
342342
com.azure.resourcemanager:azure-resourcemanager-mobilenetwork;1.0.0-beta.2;1.0.0-beta.3
343+
com.azure.resourcemanager:azure-resourcemanager-msi-generated;1.0.0-beta.1;1.0.0-beta.1
343344
com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0
344345
com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2
345346

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,7 @@
928928
<module>sdk/mobilenetwork</module>
929929
<module>sdk/modelsrepository</module>
930930
<module>sdk/monitor</module>
931+
<module>sdk/msi</module>
931932
<module>sdk/mysql</module>
932933
<module>sdk/mysqlflexibleserver</module>
933934
<module>sdk/netapp</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 (2022-03-30)
4+
5+
- Azure Resource Manager ManagedServiceIdentity client library for Java. This package contains Microsoft Azure SDK for ManagedServiceIdentity Management SDK. The Managed Service Identity Client. Package tag package-preview-2021-09. 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 ManagedServiceIdentity client library for Java
2+
3+
Azure Resource Manager ManagedServiceIdentity client library for Java.
4+
5+
This package contains Microsoft Azure SDK for ManagedServiceIdentity Management SDK. The Managed Service Identity Client. Package tag package-preview-2021-09. 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-msi-generated;current})
31+
```xml
32+
<dependency>
33+
<groupId>com.azure.resourcemanager</groupId>
34+
<artifactId>azure-resourcemanager-msi-generated</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+
ManagedServiceIdentityManager manager = ManagedServiceIdentityManager
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/msi/azure-resourcemanager-msi-generated/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: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
# Code snippets and samples
2+
3+
4+
## Operations
5+
6+
- [List](#operations_list)
7+
8+
## SystemAssignedIdentities
9+
10+
- [GetByScope](#systemassignedidentities_getbyscope)
11+
12+
## UserAssignedIdentities
13+
14+
- [CreateOrUpdate](#userassignedidentities_createorupdate)
15+
- [Delete](#userassignedidentities_delete)
16+
- [GetByResourceGroup](#userassignedidentities_getbyresourcegroup)
17+
- [List](#userassignedidentities_list)
18+
- [ListAssociatedResources](#userassignedidentities_listassociatedresources)
19+
- [ListByResourceGroup](#userassignedidentities_listbyresourcegroup)
20+
- [Update](#userassignedidentities_update)
21+
### Operations_List
22+
23+
```java
24+
import com.azure.core.util.Context;
25+
26+
/** Samples for Operations List. */
27+
public final class OperationsListSamples {
28+
/*
29+
* x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2021-09-30-preview/examples/MsiOperationsList.json
30+
*/
31+
/**
32+
* Sample code: MsiOperationsList.
33+
*
34+
* @param manager Entry point to ManagedServiceIdentityManager.
35+
*/
36+
public static void msiOperationsList(
37+
com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) {
38+
manager.operations().list(Context.NONE);
39+
}
40+
}
41+
```
42+
43+
### SystemAssignedIdentities_GetByScope
44+
45+
```java
46+
import com.azure.core.util.Context;
47+
48+
/** Samples for SystemAssignedIdentities GetByScope. */
49+
public final class SystemAssignedIdentitiesGetByScopeSamples {
50+
/*
51+
* x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2021-09-30-preview/examples/SystemAssignedIdentityGet.json
52+
*/
53+
/**
54+
* Sample code: MsiOperationsList.
55+
*
56+
* @param manager Entry point to ManagedServiceIdentityManager.
57+
*/
58+
public static void msiOperationsList(
59+
com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) {
60+
manager.systemAssignedIdentities().getByScopeWithResponse("scope", Context.NONE);
61+
}
62+
}
63+
```
64+
65+
### UserAssignedIdentities_CreateOrUpdate
66+
67+
```java
68+
import java.util.HashMap;
69+
import java.util.Map;
70+
71+
/** Samples for UserAssignedIdentities CreateOrUpdate. */
72+
public final class UserAssignedIdentitiesCreateOrUpdateSamples {
73+
/*
74+
* x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2021-09-30-preview/examples/IdentityCreate.json
75+
*/
76+
/**
77+
* Sample code: IdentityCreate.
78+
*
79+
* @param manager Entry point to ManagedServiceIdentityManager.
80+
*/
81+
public static void identityCreate(com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) {
82+
manager
83+
.userAssignedIdentities()
84+
.define("resourceName")
85+
.withRegion("eastus")
86+
.withExistingResourceGroup("rgName")
87+
.withTags(mapOf("key1", "value1", "key2", "value2"))
88+
.create();
89+
}
90+
91+
@SuppressWarnings("unchecked")
92+
private static <T> Map<String, T> mapOf(Object... inputs) {
93+
Map<String, T> map = new HashMap<>();
94+
for (int i = 0; i < inputs.length; i += 2) {
95+
String key = (String) inputs[i];
96+
T value = (T) inputs[i + 1];
97+
map.put(key, value);
98+
}
99+
return map;
100+
}
101+
}
102+
```
103+
104+
### UserAssignedIdentities_Delete
105+
106+
```java
107+
import com.azure.core.util.Context;
108+
109+
/** Samples for UserAssignedIdentities Delete. */
110+
public final class UserAssignedIdentitiesDeleteSamples {
111+
/*
112+
* x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2021-09-30-preview/examples/IdentityDelete.json
113+
*/
114+
/**
115+
* Sample code: IdentityDelete.
116+
*
117+
* @param manager Entry point to ManagedServiceIdentityManager.
118+
*/
119+
public static void identityDelete(com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) {
120+
manager.userAssignedIdentities().deleteWithResponse("rgName", "resourceName", Context.NONE);
121+
}
122+
}
123+
```
124+
125+
### UserAssignedIdentities_GetByResourceGroup
126+
127+
```java
128+
import com.azure.core.util.Context;
129+
130+
/** Samples for UserAssignedIdentities GetByResourceGroup. */
131+
public final class UserAssignedIdentitiesGetByResourceGroupSamples {
132+
/*
133+
* x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2021-09-30-preview/examples/IdentityGet.json
134+
*/
135+
/**
136+
* Sample code: IdentityGet.
137+
*
138+
* @param manager Entry point to ManagedServiceIdentityManager.
139+
*/
140+
public static void identityGet(com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) {
141+
manager.userAssignedIdentities().getByResourceGroupWithResponse("rgName", "resourceName", Context.NONE);
142+
}
143+
}
144+
```
145+
146+
### UserAssignedIdentities_List
147+
148+
```java
149+
import com.azure.core.util.Context;
150+
151+
/** Samples for UserAssignedIdentities List. */
152+
public final class UserAssignedIdentitiesListSamples {
153+
/*
154+
* x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2021-09-30-preview/examples/IdentityListBySubscription.json
155+
*/
156+
/**
157+
* Sample code: IdentityListBySubscription.
158+
*
159+
* @param manager Entry point to ManagedServiceIdentityManager.
160+
*/
161+
public static void identityListBySubscription(
162+
com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) {
163+
manager.userAssignedIdentities().list(Context.NONE);
164+
}
165+
}
166+
```
167+
168+
### UserAssignedIdentities_ListAssociatedResources
169+
170+
```java
171+
import com.azure.core.util.Context;
172+
173+
/** Samples for UserAssignedIdentities ListAssociatedResources. */
174+
public final class UserAssignedIdentitiesListAssociatedResourcesSamples {
175+
/*
176+
* x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2021-09-30-preview/examples/IdentityListAssociatedResources.json
177+
*/
178+
/**
179+
* Sample code: IdentityListAssociatedResources.
180+
*
181+
* @param manager Entry point to ManagedServiceIdentityManager.
182+
*/
183+
public static void identityListAssociatedResources(
184+
com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) {
185+
manager
186+
.userAssignedIdentities()
187+
.listAssociatedResources(
188+
"testrg", "testid", "contains(name, 'test')", "name asc", 10, 1, null, Context.NONE);
189+
}
190+
}
191+
```
192+
193+
### UserAssignedIdentities_ListByResourceGroup
194+
195+
```java
196+
import com.azure.core.util.Context;
197+
198+
/** Samples for UserAssignedIdentities ListByResourceGroup. */
199+
public final class UserAssignedIdentitiesListByResourceGroupSamples {
200+
/*
201+
* x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2021-09-30-preview/examples/IdentityListByResourceGroup.json
202+
*/
203+
/**
204+
* Sample code: IdentityListByResourceGroup.
205+
*
206+
* @param manager Entry point to ManagedServiceIdentityManager.
207+
*/
208+
public static void identityListByResourceGroup(
209+
com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) {
210+
manager.userAssignedIdentities().listByResourceGroup("rgName", Context.NONE);
211+
}
212+
}
213+
```
214+
215+
### UserAssignedIdentities_Update
216+
217+
```java
218+
import com.azure.core.util.Context;
219+
import com.azure.resourcemanager.msi.generated.models.Identity;
220+
import java.util.HashMap;
221+
import java.util.Map;
222+
223+
/** Samples for UserAssignedIdentities Update. */
224+
public final class UserAssignedIdentitiesUpdateSamples {
225+
/*
226+
* x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/preview/2021-09-30-preview/examples/IdentityUpdate.json
227+
*/
228+
/**
229+
* Sample code: IdentityUpdate.
230+
*
231+
* @param manager Entry point to ManagedServiceIdentityManager.
232+
*/
233+
public static void identityUpdate(com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) {
234+
Identity resource =
235+
manager
236+
.userAssignedIdentities()
237+
.getByResourceGroupWithResponse("rgName", "resourceName", Context.NONE)
238+
.getValue();
239+
resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).apply();
240+
}
241+
242+
@SuppressWarnings("unchecked")
243+
private static <T> Map<String, T> mapOf(Object... inputs) {
244+
Map<String, T> map = new HashMap<>();
245+
for (int i = 0; i < inputs.length; i += 2) {
246+
String key = (String) inputs[i];
247+
T value = (T) inputs[i + 1];
248+
map.put(key, value);
249+
}
250+
return map;
251+
}
252+
}
253+
```
254+

0 commit comments

Comments
 (0)