Skip to content

[AutoPR azure-resourcemanager-migrationdiscoverysap] Batch 7 sdk gen test #12167

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

Closed
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,6 +1,8 @@
# Release History

## 1.0.0-beta.2 (Unreleased)
## 1.0.0-beta.1 (2024-09-02)

- Azure Resource Manager MigrationDiscoverySap client library for Java. This package contains Microsoft Azure SDK for MigrationDiscoverySap Management SDK. Migration Discovery SAP Client. Package tag package-preview-2023-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

### Features Added

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-migrationdiscoverysap</artifactId>
<version>1.0.0-beta.1</version>
<version>1.0.0-beta.2</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen

### Authentication

By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables.
Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package.

- `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.
Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable.

In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable.

With above configuration, `azure` client can be authenticated using the following code:
Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code:

```java
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
Expand Down Expand Up @@ -97,6 +93,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/
[azure_subscription]: https://azure.microsoft.com/free/
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials
[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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ public final class SapDiscoverySitesCreateSamples {
*/
public static void createResourceForImportBasedInput(
com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager manager) {
manager.sapDiscoverySites().define("SampleSite").withRegion("eastus").withExistingResourceGroup("test-rg")
manager.sapDiscoverySites()
.define("SampleSite")
.withRegion("eastus")
.withExistingResourceGroup("test-rg")
.withTags(mapOf("property1", "value1", "property2", "value2"))
.withProperties(new SapDiscoverySiteProperties().withMasterSiteId("MasterSiteIdResourceId")
.withMigrateProjectId("MigrateProjectId"))
Expand Down Expand Up @@ -141,8 +144,8 @@ public final class SapDiscoverySitesGetByResourceGroupSamples {
*/
public static void gETASAPMigrationDiscoverySiteResource(
com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager manager) {
manager.sapDiscoverySites().getByResourceGroupWithResponse("test-rg", "SampleSite",
com.azure.core.util.Context.NONE);
manager.sapDiscoverySites()
.getByResourceGroupWithResponse("test-rg", "SampleSite", com.azure.core.util.Context.NONE);
}
}
```
Expand Down Expand Up @@ -243,7 +246,8 @@ public final class SapDiscoverySitesUpdateSamples {
public static void updatesASAPMigrationDiscoverySiteResource(
com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager manager) {
SapDiscoverySite resource = manager.sapDiscoverySites()
.getByResourceGroupWithResponse("test-rg", "SampleSite", com.azure.core.util.Context.NONE).getValue();
.getByResourceGroupWithResponse("test-rg", "SampleSite", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withTags(mapOf("tag1", "value1")).apply();
}

Expand Down Expand Up @@ -284,9 +288,12 @@ public final class SapInstancesCreateSamples {
*/
public static void createsTheSAPInstanceResource(
com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager manager) {
manager.sapInstances().define("MPP_MPP").withRegion("eastus")
manager.sapInstances()
.define("MPP_MPP")
.withRegion("eastus")
.withExistingSapDiscoverySite("test-rg", "SampleSite")
.withTags(mapOf("property1", "value1", "property2", "value2")).withProperties(new SapInstanceProperties())
.withTags(mapOf("property1", "value1", "property2", "value2"))
.withProperties(new SapInstanceProperties())
.create();
}

Expand Down Expand Up @@ -400,7 +407,8 @@ public final class SapInstancesUpdateSamples {
public static void updatesTheSAPInstanceResource(
com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager manager) {
SapInstance resource = manager.sapInstances()
.getWithResponse("test-rg", "SampleSite", "MPP_MPP", com.azure.core.util.Context.NONE).getValue();
.getWithResponse("test-rg", "SampleSite", "MPP_MPP", com.azure.core.util.Context.NONE)
.getValue();
resource.update().withTags(mapOf("tag1", "value1")).apply();
}

Expand Down Expand Up @@ -437,7 +445,9 @@ public final class ServerInstancesCreateSamples {
*/
public static void createsTheServerInstanceResource(
com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager manager) {
manager.serverInstances().define("APP_SapServer1").withExistingSapInstance("test-rg", "SampleSite", "MPP_MPP")
manager.serverInstances()
.define("APP_SapServer1")
.withExistingSapInstance("test-rg", "SampleSite", "MPP_MPP")
.create();
}
}
Expand All @@ -462,8 +472,8 @@ public final class ServerInstancesDeleteSamples {
*/
public static void deletesTheServerInstanceResource(
com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager manager) {
manager.serverInstances().delete("test-rg", "SampleSite", "MPP_MPP", "APP_SapServer1",
com.azure.core.util.Context.NONE);
manager.serverInstances()
.delete("test-rg", "SampleSite", "MPP_MPP", "APP_SapServer1", com.azure.core.util.Context.NONE);
}
}
```
Expand All @@ -487,8 +497,8 @@ public final class ServerInstancesGetSamples {
*/
public static void gETAServerInstanceResource(
com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager manager) {
manager.serverInstances().getWithResponse("test-rg", "SampleSite", "MPP_MPP", "APP_SapServer1",
com.azure.core.util.Context.NONE);
manager.serverInstances()
.getWithResponse("test-rg", "SampleSite", "MPP_MPP", "APP_SapServer1", com.azure.core.util.Context.NONE);
}
}
```
Expand All @@ -512,8 +522,8 @@ public final class ServerInstancesListBySapInstanceSamples {
*/
public static void listsTheServerInstanceResourcesForTheGivenSAPInstanceResource(
com.azure.resourcemanager.migrationdiscoverysap.MigrationDiscoverySapManager manager) {
manager.serverInstances().listBySapInstance("test-rg", "SampleSite", "MPP_MPP",
com.azure.core.util.Context.NONE);
manager.serverInstances()
.listBySapInstance("test-rg", "SampleSite", "MPP_MPP", com.azure.core.util.Context.NONE);
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
<revapi.skip>true</revapi.skip>
</properties>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-json</artifactId>
<version>1.2.0</version> <!-- {x-version-update;com.azure:azure-json;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import com.azure.core.http.HttpPipelinePosition;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.http.policy.HttpPolicyProviders;
import com.azure.core.http.policy.RequestIdPolicy;
Expand Down Expand Up @@ -60,8 +60,10 @@ private MigrationDiscoverySapManager(HttpPipeline httpPipeline, AzureProfile pro
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
this.clientObject = new MigrationDiscoverySapMgmtClientBuilder().pipeline(httpPipeline)
.endpoint(profile.getEnvironment().getResourceManagerEndpoint()).subscriptionId(profile.getSubscriptionId())
.defaultPollInterval(defaultPollInterval).buildClient();
.endpoint(profile.getEnvironment().getResourceManagerEndpoint())
.subscriptionId(profile.getSubscriptionId())
.defaultPollInterval(defaultPollInterval)
.buildClient();
}

/**
Expand Down Expand Up @@ -212,12 +214,19 @@ public MigrationDiscoverySapManager authenticate(TokenCredential credential, Azu
Objects.requireNonNull(profile, "'profile' cannot be null.");

StringBuilder userAgentBuilder = new StringBuilder();
userAgentBuilder.append("azsdk-java").append("-").append("com.azure.resourcemanager.migrationdiscoverysap")
.append("/").append("1.0.0-beta.1");
userAgentBuilder.append("azsdk-java")
.append("-")
.append("com.azure.resourcemanager.migrationdiscoverysap")
.append("/")
.append("1.0.0-beta.1");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (").append(Configuration.getGlobalConfiguration().get("java.version"))
.append("; ").append(Configuration.getGlobalConfiguration().get("os.name")).append("; ")
.append(Configuration.getGlobalConfiguration().get("os.version")).append("; auto-generated)");
userAgentBuilder.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
.append("; ")
.append(Configuration.getGlobalConfiguration().get("os.name"))
.append("; ")
.append(Configuration.getGlobalConfiguration().get("os.version"))
.append("; auto-generated)");
} else {
userAgentBuilder.append(" (auto-generated)");
}
Expand All @@ -236,18 +245,21 @@ public MigrationDiscoverySapManager authenticate(TokenCredential credential, Azu
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
policies.add(new AddHeadersFromContextPolicy());
policies.add(new RequestIdPolicy());
policies.addAll(this.policies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
policies.addAll(this.policies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
.collect(Collectors.toList()));
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
policies.add(new AddDatePolicy());
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.addAll(this.policies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY).collect(Collectors.toList()));
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
.collect(Collectors.toList()));
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));
HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient)
.policies(policies.toArray(new HttpPipelinePolicy[0])).build();
.policies(policies.toArray(new HttpPipelinePolicy[0]))
.build();
return new MigrationDiscoverySapManager(httpPipeline, profile, defaultPollInterval);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,48 @@
package com.azure.resourcemanager.migrationdiscoverysap.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.migrationdiscoverysap.models.ActionType;
import com.azure.resourcemanager.migrationdiscoverysap.models.OperationDisplay;
import com.azure.resourcemanager.migrationdiscoverysap.models.Origin;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;

/**
* REST API Operation
*
* Details of a REST API operation, returned from the Resource Provider Operations API.
*/
@Fluent
public final class OperationInner {
public final class OperationInner implements JsonSerializable<OperationInner> {
/*
* The name of the operation, as per Resource-Based Access Control (RBAC). Examples:
* "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action"
*/
@JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
private String name;

/*
* Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for
* ARM/control-plane operations.
*/
@JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY)
private Boolean isDataAction;

/*
* Localized display information for this particular operation.
*/
@JsonProperty(value = "display")
private OperationDisplay display;

/*
* The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default
* value is "user,system"
*/
@JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY)
private Origin origin;

/*
* Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
*/
@JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY)
private ActionType actionType;

/**
Expand Down Expand Up @@ -126,4 +125,48 @@ public void validate() {
display().validate();
}
}

/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("display", this.display);
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of OperationInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IOException If an error occurs while reading the OperationInner.
*/
public static OperationInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
OperationInner deserializedOperationInner = new OperationInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("name".equals(fieldName)) {
deserializedOperationInner.name = reader.getString();
} else if ("isDataAction".equals(fieldName)) {
deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean);
} else if ("display".equals(fieldName)) {
deserializedOperationInner.display = OperationDisplay.fromJson(reader);
} else if ("origin".equals(fieldName)) {
deserializedOperationInner.origin = Origin.fromString(reader.getString());
} else if ("actionType".equals(fieldName)) {
deserializedOperationInner.actionType = ActionType.fromString(reader.getString());
} else {
reader.skipChildren();
}
}

return deserializedOperationInner;
});
}
}
Loading