forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CodeGen from PR 19491 in Azure/azure-rest-api-specs
Merge 55df9893c8ccddbea7a1dc1fd05620ef9e89fc64 into c537f5a7853766a7946863dd9b0303773b488eff
- Loading branch information
SDKAuto
committed
Jun 22, 2022
1 parent
bca6088
commit 78b0d3a
Showing
68 changed files
with
7,618 additions
and
0 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
5 changes: 5 additions & 0 deletions
5
sdk/resourceconnector/azure-resourcemanager-resourceconnector/CHANGELOG.md
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,5 @@ | ||
# Release History | ||
|
||
## 1.0.0-beta.1 (2022-06-22) | ||
|
||
- Azure Resource Manager Appliances client library for Java. This package contains Microsoft Azure SDK for Appliances Management SDK. The appliances Rest API spec. Package tag package-2022-04-15-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). |
102 changes: 102 additions & 0 deletions
102
sdk/resourceconnector/azure-resourcemanager-resourceconnector/README.md
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,102 @@ | ||
# Azure Resource Manager Appliances client library for Java | ||
|
||
Azure Resource Manager Appliances client library for Java. | ||
|
||
This package contains Microsoft Azure SDK for Appliances Management SDK. The appliances Rest API spec. Package tag package-2022-04-15-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). | ||
|
||
## We'd love to hear your feedback | ||
|
||
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. | ||
|
||
If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. | ||
|
||
Thank you in advance for your collaboration. We really appreciate your time! | ||
|
||
## Documentation | ||
|
||
Various documentation is available to help you get started | ||
|
||
- [API reference documentation][docs] | ||
|
||
## Getting started | ||
|
||
### Prerequisites | ||
|
||
- [Java Development Kit (JDK)][jdk] with version 8 or above | ||
- [Azure Subscription][azure_subscription] | ||
|
||
### Adding the package to your product | ||
|
||
[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-resourceconnector;current}) | ||
```xml | ||
<dependency> | ||
<groupId>com.azure.resourcemanager</groupId> | ||
<artifactId>azure-resourcemanager-resourceconnector</artifactId> | ||
<version>1.0.0-beta.1</version> | ||
</dependency> | ||
``` | ||
[//]: # ({x-version-update-end}) | ||
|
||
### Include the recommended packages | ||
|
||
Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. | ||
|
||
[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. | ||
|
||
### Authentication | ||
|
||
By default, Azure Active Directory token authentication depends on correct configure of following environment variables. | ||
|
||
- `AZURE_CLIENT_ID` for Azure client ID. | ||
- `AZURE_TENANT_ID` for Azure tenant ID. | ||
- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. | ||
|
||
In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. | ||
|
||
With above configuration, `azure` client can be authenticated by following code: | ||
|
||
```java | ||
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); | ||
TokenCredential credential = new DefaultAzureCredentialBuilder() | ||
.authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) | ||
.build(); | ||
AppliancesManager manager = AppliancesManager | ||
.authenticate(credential, profile); | ||
``` | ||
|
||
The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. | ||
|
||
See [Authentication][authenticate] for more options. | ||
|
||
## Key concepts | ||
|
||
See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. | ||
|
||
## Examples | ||
|
||
[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourceconnector/azure-resourcemanager-resourceconnector/SAMPLE.md) | ||
|
||
|
||
## Troubleshooting | ||
|
||
## Next steps | ||
|
||
## Contributing | ||
|
||
For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). | ||
|
||
1. Fork it | ||
1. Create your feature branch (`git checkout -b my-new-feature`) | ||
1. Commit your changes (`git commit -am 'Add some feature'`) | ||
1. Push to the branch (`git push origin my-new-feature`) | ||
1. Create new Pull Request | ||
|
||
<!-- LINKS --> | ||
[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS | ||
[docs]: https://azure.github.io/azure-sdk-for-java/ | ||
[jdk]: https://docs.microsoft.com/java/azure/jdk/ | ||
[azure_subscription]: https://azure.microsoft.com/free/ | ||
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity | ||
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty | ||
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md | ||
[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md |
259 changes: 259 additions & 0 deletions
259
sdk/resourceconnector/azure-resourcemanager-resourceconnector/SAMPLE.md
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,259 @@ | ||
# Code snippets and samples | ||
|
||
|
||
## Appliances | ||
|
||
- [CreateOrUpdate](#appliances_createorupdate) | ||
- [Delete](#appliances_delete) | ||
- [GetByResourceGroup](#appliances_getbyresourcegroup) | ||
- [GetUpgradeGraph](#appliances_getupgradegraph) | ||
- [List](#appliances_list) | ||
- [ListByResourceGroup](#appliances_listbyresourcegroup) | ||
- [ListClusterCustomerUserCredential](#appliances_listclustercustomerusercredential) | ||
- [ListClusterUserCredential](#appliances_listclusterusercredential) | ||
- [ListOperations](#appliances_listoperations) | ||
- [Update](#appliances_update) | ||
### Appliances_CreateOrUpdate | ||
|
||
```java | ||
import com.azure.resourcemanager.resourceconnector.models.AppliancePropertiesInfrastructureConfig; | ||
import com.azure.resourcemanager.resourceconnector.models.Distro; | ||
import com.azure.resourcemanager.resourceconnector.models.Provider; | ||
|
||
/** Samples for Appliances CreateOrUpdate. */ | ||
public final class AppliancesCreateOrUpdateSamples { | ||
/* | ||
* x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2022-04-15-preview/examples/AppliancesCreate_Update.json | ||
*/ | ||
/** | ||
* Sample code: Create/Update Appliance. | ||
* | ||
* @param manager Entry point to AppliancesManager. | ||
*/ | ||
public static void createUpdateAppliance(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { | ||
manager | ||
.appliances() | ||
.define("appliance01") | ||
.withRegion("West US") | ||
.withExistingResourceGroup("testresourcegroup") | ||
.withDistro(Distro.AKSEDGE) | ||
.withInfrastructureConfig(new AppliancePropertiesInfrastructureConfig().withProvider(Provider.VMWARE)) | ||
.create(); | ||
} | ||
} | ||
``` | ||
|
||
### Appliances_Delete | ||
|
||
```java | ||
import com.azure.core.util.Context; | ||
|
||
/** Samples for Appliances Delete. */ | ||
public final class AppliancesDeleteSamples { | ||
/* | ||
* x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2022-04-15-preview/examples/AppliancesDelete.json | ||
*/ | ||
/** | ||
* Sample code: Delete Appliance. | ||
* | ||
* @param manager Entry point to AppliancesManager. | ||
*/ | ||
public static void deleteAppliance(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { | ||
manager.appliances().delete("testresourcegroup", "appliance01", Context.NONE); | ||
} | ||
} | ||
``` | ||
|
||
### Appliances_GetByResourceGroup | ||
|
||
```java | ||
import com.azure.core.util.Context; | ||
|
||
/** Samples for Appliances GetByResourceGroup. */ | ||
public final class AppliancesGetByResourceGroupSamples { | ||
/* | ||
* x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2022-04-15-preview/examples/AppliancesGet.json | ||
*/ | ||
/** | ||
* Sample code: Get Appliance. | ||
* | ||
* @param manager Entry point to AppliancesManager. | ||
*/ | ||
public static void getAppliance(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { | ||
manager.appliances().getByResourceGroupWithResponse("testresourcegroup", "appliance01", Context.NONE); | ||
} | ||
} | ||
``` | ||
|
||
### Appliances_GetUpgradeGraph | ||
|
||
```java | ||
import com.azure.core.util.Context; | ||
|
||
/** Samples for Appliances GetUpgradeGraph. */ | ||
public final class AppliancesGetUpgradeGraphSamples { | ||
/* | ||
* x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2022-04-15-preview/examples/UpgradeGraph.json | ||
*/ | ||
/** | ||
* Sample code: Get Appliance Upgrade Graph. | ||
* | ||
* @param manager Entry point to AppliancesManager. | ||
*/ | ||
public static void getApplianceUpgradeGraph(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { | ||
manager.appliances().getUpgradeGraphWithResponse("testresourcegroup", "appliance01", "stable", Context.NONE); | ||
} | ||
} | ||
``` | ||
|
||
### Appliances_List | ||
|
||
```java | ||
import com.azure.core.util.Context; | ||
|
||
/** Samples for Appliances List. */ | ||
public final class AppliancesListSamples { | ||
/* | ||
* x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2022-04-15-preview/examples/AppliancesListBySubscription.json | ||
*/ | ||
/** | ||
* Sample code: List Appliances by subscription. | ||
* | ||
* @param manager Entry point to AppliancesManager. | ||
*/ | ||
public static void listAppliancesBySubscription( | ||
com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { | ||
manager.appliances().list(Context.NONE); | ||
} | ||
} | ||
``` | ||
|
||
### Appliances_ListByResourceGroup | ||
|
||
```java | ||
import com.azure.core.util.Context; | ||
|
||
/** Samples for Appliances ListByResourceGroup. */ | ||
public final class AppliancesListByResourceGroupSamples { | ||
/* | ||
* x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2022-04-15-preview/examples/AppliancesListByResourceGroup.json | ||
*/ | ||
/** | ||
* Sample code: List Appliances by resource group. | ||
* | ||
* @param manager Entry point to AppliancesManager. | ||
*/ | ||
public static void listAppliancesByResourceGroup( | ||
com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { | ||
manager.appliances().listByResourceGroup("testresourcegroup", Context.NONE); | ||
} | ||
} | ||
``` | ||
|
||
### Appliances_ListClusterCustomerUserCredential | ||
|
||
```java | ||
import com.azure.core.util.Context; | ||
|
||
/** Samples for Appliances ListClusterCustomerUserCredential. */ | ||
public final class AppliancesListClusterCustomerUserCredentialSamples { | ||
/* | ||
* x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2022-04-15-preview/examples/AppliancesListClusterCustomerUserCredential.json | ||
*/ | ||
/** | ||
* Sample code: ListClusterCustomerUserCredentialAppliance. | ||
* | ||
* @param manager Entry point to AppliancesManager. | ||
*/ | ||
public static void listClusterCustomerUserCredentialAppliance( | ||
com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { | ||
manager | ||
.appliances() | ||
.listClusterCustomerUserCredentialWithResponse("testresourcegroup", "appliance01", Context.NONE); | ||
} | ||
} | ||
``` | ||
|
||
### Appliances_ListClusterUserCredential | ||
|
||
```java | ||
import com.azure.core.util.Context; | ||
|
||
/** Samples for Appliances ListClusterUserCredential. */ | ||
public final class AppliancesListClusterUserCredentialSamples { | ||
/* | ||
* x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2022-04-15-preview/examples/AppliancesListClusterUserCredential.json | ||
*/ | ||
/** | ||
* Sample code: ListClusterUserCredentialAppliance. | ||
* | ||
* @param manager Entry point to AppliancesManager. | ||
*/ | ||
public static void listClusterUserCredentialAppliance( | ||
com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { | ||
manager.appliances().listClusterUserCredentialWithResponse("testresourcegroup", "appliance01", Context.NONE); | ||
} | ||
} | ||
``` | ||
|
||
### Appliances_ListOperations | ||
|
||
```java | ||
import com.azure.core.util.Context; | ||
|
||
/** Samples for Appliances ListOperations. */ | ||
public final class AppliancesListOperationsSamples { | ||
/* | ||
* x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2022-04-15-preview/examples/AppliancesListOperations.json | ||
*/ | ||
/** | ||
* Sample code: List Appliances operations. | ||
* | ||
* @param manager Entry point to AppliancesManager. | ||
*/ | ||
public static void listAppliancesOperations(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { | ||
manager.appliances().listOperations(Context.NONE); | ||
} | ||
} | ||
``` | ||
|
||
### Appliances_Update | ||
|
||
```java | ||
import com.azure.core.util.Context; | ||
import com.azure.resourcemanager.resourceconnector.models.Appliance; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** Samples for Appliances Update. */ | ||
public final class AppliancesUpdateSamples { | ||
/* | ||
* x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2022-04-15-preview/examples/AppliancesPatch.json | ||
*/ | ||
/** | ||
* Sample code: Update Appliance. | ||
* | ||
* @param manager Entry point to AppliancesManager. | ||
*/ | ||
public static void updateAppliance(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { | ||
Appliance resource = | ||
manager | ||
.appliances() | ||
.getByResourceGroupWithResponse("testresourcegroup", "appliance01", Context.NONE) | ||
.getValue(); | ||
resource.update().withTags(mapOf("key", "value")).apply(); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
private static <T> Map<String, T> mapOf(Object... inputs) { | ||
Map<String, T> map = new HashMap<>(); | ||
for (int i = 0; i < inputs.length; i += 2) { | ||
String key = (String) inputs[i]; | ||
T value = (T) inputs[i + 1]; | ||
map.put(key, value); | ||
} | ||
return map; | ||
} | ||
} | ||
``` | ||
|
Oops, something went wrong.