Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR azure-resourcemanager-hanaonazure] Rebasing dev-cognitiveservices-Language-2022-03-01-preview onto main #13763

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Release History

## 1.0.0-beta.2 (Unreleased)
## 1.0.0-beta.1 (2022-04-04)

- Azure Resource Manager Hana client library for Java. This package contains Microsoft Azure SDK for Hana Management SDK. HANA on Azure Client. Package tag package-2020-02-07-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

## 1.0.0-beta.1 (2021-04-15)

Expand Down
7 changes: 5 additions & 2 deletions sdk/hanaonazure/azure-resourcemanager-hanaonazure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Azure Resource Manager Hana client library for Java.

This package contains Microsoft Azure SDK for Hana Management SDK. HANA on Azure Client. Package tag package-2017-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
This package contains Microsoft Azure SDK for Hana Management SDK. HANA on Azure Client. Package tag package-2020-02-07-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

Expand Down Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-hanaonazure</artifactId>
<version>1.0.0-beta.1</version>
<version>1.0.0-beta.2</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down Expand Up @@ -74,6 +74,9 @@ See [API design][design] for general introduction on design and key concepts on

## Examples

[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/hanaonazure/azure-resourcemanager-hanaonazure/SAMPLE.md)


## Troubleshooting

## Next steps
Expand Down
302 changes: 302 additions & 0 deletions sdk/hanaonazure/azure-resourcemanager-hanaonazure/SAMPLE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,302 @@
# Code snippets and samples


## Operations

- [List](#operations_list)

## ProviderInstances

- [Create](#providerinstances_create)
- [Delete](#providerinstances_delete)
- [Get](#providerinstances_get)
- [List](#providerinstances_list)

## SapMonitors

- [Create](#sapmonitors_create)
- [Delete](#sapmonitors_delete)
- [GetByResourceGroup](#sapmonitors_getbyresourcegroup)
- [List](#sapmonitors_list)
- [Update](#sapmonitors_update)
### Operations_List

```java
import com.azure.core.util.Context;

/** Samples for Operations List. */
public final class OperationsListSamples {
/*
* x-ms-original-file: specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/HanaOperations_List.json
*/
/**
* Sample code: List all HANA management operations supported by HANA RP.
*
* @param manager Entry point to HanaManager.
*/
public static void listAllHANAManagementOperationsSupportedByHANARP(
com.azure.resourcemanager.hanaonazure.HanaManager manager) {
manager.operations().list(Context.NONE);
}
}
```

### ProviderInstances_Create

```java
/** Samples for ProviderInstances Create. */
public final class ProviderInstancesCreateSamples {
/*
* x-ms-original-file: specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/ProviderInstances_Create.json
*/
/**
* Sample code: Create a SAP Monitor.
*
* @param manager Entry point to HanaManager.
*/
public static void createASAPMonitor(com.azure.resourcemanager.hanaonazure.HanaManager manager) {
manager
.providerInstances()
.define("myProviderInstance")
.withExistingSapMonitor("myResourceGroup", "mySapMonitor")
.withTypePropertiesType("hana")
.withProperties(
"{\"hostname\":\"10.0.0.6\",\"dbName\":\"SYSTEMDB\",\"sqlPort\":30013,\"dbUsername\":\"SYSTEM\",\"dbPassword\":\"PASSWORD\"}")
.withMetadata("{\"key\":\"value\"}")
.create();
}
}
```

### ProviderInstances_Delete

```java
import com.azure.core.util.Context;

/** Samples for ProviderInstances Delete. */
public final class ProviderInstancesDeleteSamples {
/*
* x-ms-original-file: specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/ProviderInstances_Delete.json
*/
/**
* Sample code: Deletes a SAP monitor.
*
* @param manager Entry point to HanaManager.
*/
public static void deletesASAPMonitor(com.azure.resourcemanager.hanaonazure.HanaManager manager) {
manager.providerInstances().delete("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE);
}
}
```

### ProviderInstances_Get

```java
import com.azure.core.util.Context;

/** Samples for ProviderInstances Get. */
public final class ProviderInstancesGetSamples {
/*
* x-ms-original-file: specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/ProviderInstances_Get.json
*/
/**
* Sample code: Get properties of a SAP monitor.
*
* @param manager Entry point to HanaManager.
*/
public static void getPropertiesOfASAPMonitor(com.azure.resourcemanager.hanaonazure.HanaManager manager) {
manager
.providerInstances()
.getWithResponse("myResourceGroup", "mySapMonitor", "myProviderInstance", Context.NONE);
}
}
```

### ProviderInstances_List

```java
import com.azure.core.util.Context;

/** Samples for ProviderInstances List. */
public final class ProviderInstancesListSamples {
/*
* x-ms-original-file: specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/ProviderInstances_List.json
*/
/**
* Sample code: List all SAP Monitors in a subscription.
*
* @param manager Entry point to HanaManager.
*/
public static void listAllSAPMonitorsInASubscription(com.azure.resourcemanager.hanaonazure.HanaManager manager) {
manager.providerInstances().list("myResourceGroup", "mySapMonitor", Context.NONE);
}
}
```

### SapMonitors_Create

```java
import java.util.HashMap;
import java.util.Map;

/** Samples for SapMonitors Create. */
public final class SapMonitorsCreateSamples {
/*
* x-ms-original-file: specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/SapMonitors_Create.json
*/
/**
* Sample code: Create a SAP Monitor.
*
* @param manager Entry point to HanaManager.
*/
public static void createASAPMonitor(com.azure.resourcemanager.hanaonazure.HanaManager manager) {
manager
.sapMonitors()
.define("mySapMonitor")
.withRegion("westus")
.withExistingResourceGroup("myResourceGroup")
.withTags(mapOf("key", "value"))
.withLogAnalyticsWorkspaceArmId(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace")
.withEnableCustomerAnalytics(true)
.withLogAnalyticsWorkspaceId("00000000-0000-0000-0000-000000000000")
.withLogAnalyticsWorkspaceSharedKey(
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000==")
.withMonitorSubnet(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet")
.create();
}

@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;
}
}
```

### SapMonitors_Delete

```java
import com.azure.core.util.Context;

/** Samples for SapMonitors Delete. */
public final class SapMonitorsDeleteSamples {
/*
* x-ms-original-file: specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/SapMonitors_Delete.json
*/
/**
* Sample code: Deletes a SAP monitor.
*
* @param manager Entry point to HanaManager.
*/
public static void deletesASAPMonitor(com.azure.resourcemanager.hanaonazure.HanaManager manager) {
manager.sapMonitors().delete("myResourceGroup", "mySapMonitor", Context.NONE);
}
}
```

### SapMonitors_GetByResourceGroup

```java
import com.azure.core.util.Context;

/** Samples for SapMonitors GetByResourceGroup. */
public final class SapMonitorsGetByResourceGroupSamples {
/*
* x-ms-original-file: specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/SapMonitors_Get.json
*/
/**
* Sample code: Get properties of a SAP monitor.
*
* @param manager Entry point to HanaManager.
*/
public static void getPropertiesOfASAPMonitor(com.azure.resourcemanager.hanaonazure.HanaManager manager) {
manager.sapMonitors().getByResourceGroupWithResponse("myResourceGroup", "mySapMonitor", Context.NONE);
}
}
```

### SapMonitors_List

```java
import com.azure.core.util.Context;

/** Samples for SapMonitors List. */
public final class SapMonitorsListSamples {
/*
* x-ms-original-file: specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/SapMonitors_List.json
*/
/**
* Sample code: List all SAP Monitors in a subscription.
*
* @param manager Entry point to HanaManager.
*/
public static void listAllSAPMonitorsInASubscription(com.azure.resourcemanager.hanaonazure.HanaManager manager) {
manager.sapMonitors().list(Context.NONE);
}
}
```

### SapMonitors_Update

```java
import com.azure.core.util.Context;
import com.azure.resourcemanager.hanaonazure.models.SapMonitor;
import java.util.HashMap;
import java.util.Map;

/** Samples for SapMonitors Update. */
public final class SapMonitorsUpdateSamples {
/*
* x-ms-original-file: specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/SapMonitors_PatchTags_Delete.json
*/
/**
* Sample code: Delete Tags field of a SAP monitor.
*
* @param manager Entry point to HanaManager.
*/
public static void deleteTagsFieldOfASAPMonitor(com.azure.resourcemanager.hanaonazure.HanaManager manager) {
SapMonitor resource =
manager
.sapMonitors()
.getByResourceGroupWithResponse("myResourceGroup", "mySapMonitor", Context.NONE)
.getValue();
resource.update().withTags(mapOf()).apply();
}

/*
* x-ms-original-file: specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/SapMonitors_PatchTags.json
*/
/**
* Sample code: Update Tags field of a SAP monitor.
*
* @param manager Entry point to HanaManager.
*/
public static void updateTagsFieldOfASAPMonitor(com.azure.resourcemanager.hanaonazure.HanaManager manager) {
SapMonitor resource =
manager
.sapMonitors()
.getByResourceGroupWithResponse("myResourceGroup", "mySapMonitor", Context.NONE)
.getValue();
resource.update().withTags(mapOf("testkey", "testvalue")).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;
}
}
```

Loading