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-workloadssapvirtualinstance] Changes due to problem in SDK Generation from typespec #12980

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,5 +1,9 @@
# Release History

## 1.0.0-beta.1 (2024-11-13)

- Azure Resource Manager Workloads Sap Virtual Instance client library for Java. This package contains Microsoft Azure SDK for Workloads Sap Virtual Instance Management SDK. Workloads client provides access to various workload operations. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

## 1.0.0 (2024-10-23)

- Azure Resource Manager Workloads Sap Virtual Instance client library for Java. This package contains Microsoft Azure SDK for Workloads Sap Virtual Instance Management SDK. Workloads client provides access to various workload operations. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3497,8 +3497,8 @@ public final class SapVirtualInstancesStopSamples {

```java
import com.azure.resourcemanager.workloadssapvirtualinstance.models.ManagedResourcesNetworkAccessType;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.ManagedServiceIdentity;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.ManagedServiceIdentityType;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.SAPVirtualInstanceIdentity;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.SAPVirtualInstanceIdentityType;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.SapVirtualInstance;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.UpdateSapVirtualInstanceProperties;
import java.util.HashMap;
Expand All @@ -3523,7 +3523,7 @@ public final class SapVirtualInstancesUpdateSamples {
.getValue();
resource.update()
.withTags(mapOf("key1", "fakeTokenPlaceholder"))
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE))
.withIdentity(new SAPVirtualInstanceIdentity().withType(SAPVirtualInstanceIdentityType.NONE))
.withProperties(new UpdateSapVirtualInstanceProperties())
.apply();
}
Expand All @@ -3543,7 +3543,7 @@ public final class SapVirtualInstancesUpdateSamples {
.getValue();
resource.update()
.withTags(mapOf("key1", "fakeTokenPlaceholder"))
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE))
.withIdentity(new SAPVirtualInstanceIdentity().withType(SAPVirtualInstanceIdentityType.NONE))
.withProperties(new UpdateSapVirtualInstanceProperties()
.withManagedResourcesNetworkAccessType(ManagedResourcesNetworkAccessType.PRIVATE))
.apply();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<jacoco.min.linecoverage>0</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0</jacoco.min.branchcoverage>
<revapi.skip>true</revapi.skip>
<spotless.skip>false</spotless.skip>
</properties>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.ManagedServiceIdentity;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.SAPVirtualInstanceIdentity;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.SapVirtualInstanceProperties;
import java.io.IOException;
import java.util.Map;
Expand All @@ -28,7 +28,7 @@ public final class SapVirtualInstanceInner extends Resource {
/*
* The managed service identities assigned to this resource.
*/
private ManagedServiceIdentity identity;
private SAPVirtualInstanceIdentity identity;

/*
* Azure Resource Manager metadata containing createdBy and modifiedBy information.
Expand Down Expand Up @@ -81,7 +81,7 @@ public SapVirtualInstanceInner withProperties(SapVirtualInstanceProperties prope
*
* @return the identity value.
*/
public ManagedServiceIdentity identity() {
public SAPVirtualInstanceIdentity identity() {
return this.identity;
}

Expand All @@ -91,7 +91,7 @@ public ManagedServiceIdentity identity() {
* @param identity the identity value to set.
* @return the SapVirtualInstanceInner object itself.
*/
public SapVirtualInstanceInner withIdentity(ManagedServiceIdentity identity) {
public SapVirtualInstanceInner withIdentity(SAPVirtualInstanceIdentity identity) {
this.identity = identity;
return this;
}
Expand Down Expand Up @@ -210,7 +210,7 @@ public static SapVirtualInstanceInner fromJson(JsonReader jsonReader) throws IOE
} else if ("properties".equals(fieldName)) {
deserializedSapVirtualInstanceInner.properties = SapVirtualInstanceProperties.fromJson(reader);
} else if ("identity".equals(fieldName)) {
deserializedSapVirtualInstanceInner.identity = ManagedServiceIdentity.fromJson(reader);
deserializedSapVirtualInstanceInner.identity = SAPVirtualInstanceIdentity.fromJson(reader);
} else if ("systemData".equals(fieldName)) {
deserializedSapVirtualInstanceInner.systemData = SystemData.fromJson(reader);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.workloadssapvirtualinstance.fluent.models.SapVirtualInstanceInner;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.ManagedServiceIdentity;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.OperationStatusResult;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.SAPVirtualInstanceIdentity;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.SapVirtualInstance;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.SapVirtualInstanceProperties;
import com.azure.resourcemanager.workloadssapvirtualinstance.models.StartRequest;
Expand Down Expand Up @@ -54,7 +54,7 @@ public SapVirtualInstanceProperties properties() {
return this.innerModel().properties();
}

public ManagedServiceIdentity identity() {
public SAPVirtualInstanceIdentity identity() {
return this.innerModel().identity();
}

Expand Down Expand Up @@ -199,7 +199,7 @@ public SapVirtualInstanceImpl withProperties(SapVirtualInstanceProperties proper
return this;
}

public SapVirtualInstanceImpl withIdentity(ManagedServiceIdentity identity) {
public SapVirtualInstanceImpl withIdentity(SAPVirtualInstanceIdentity identity) {
if (isInCreateMode()) {
this.innerModel().withIdentity(identity);
return this;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,74 +14,42 @@
import java.util.Map;

/**
* Managed service identity (system assigned and/or user assigned identities).
* Managed service identity (user assigned identities).
*/
@Fluent
public final class ManagedServiceIdentity implements JsonSerializable<ManagedServiceIdentity> {
/*
* The service principal ID of the system assigned identity. This property will only be provided for a system
* assigned identity.
*/
private String principalId;

/*
* The tenant ID of the system assigned identity. This property will only be provided for a system assigned
* identity.
*/
private String tenantId;

public final class SAPVirtualInstanceIdentity implements JsonSerializable<SAPVirtualInstanceIdentity> {
/*
* The type of managed identity assigned to this resource.
*/
private ManagedServiceIdentityType type;
private SAPVirtualInstanceIdentityType type;

/*
* The identities assigned to this resource by the user.
*/
private Map<String, UserAssignedIdentity> userAssignedIdentities;

/**
* Creates an instance of ManagedServiceIdentity class.
*/
public ManagedServiceIdentity() {
}

/**
* Get the principalId property: The service principal ID of the system assigned identity. This property will only
* be provided for a system assigned identity.
*
* @return the principalId value.
*/
public String principalId() {
return this.principalId;
}

/**
* Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for
* a system assigned identity.
*
* @return the tenantId value.
* Creates an instance of SAPVirtualInstanceIdentity class.
*/
public String tenantId() {
return this.tenantId;
public SAPVirtualInstanceIdentity() {
}

/**
* Get the type property: The type of managed identity assigned to this resource.
*
* @return the type value.
*/
public ManagedServiceIdentityType type() {
public SAPVirtualInstanceIdentityType type() {
return this.type;
}

/**
* Set the type property: The type of managed identity assigned to this resource.
*
* @param type the type value to set.
* @return the ManagedServiceIdentity object itself.
* @return the SAPVirtualInstanceIdentity object itself.
*/
public ManagedServiceIdentity withType(ManagedServiceIdentityType type) {
public SAPVirtualInstanceIdentity withType(SAPVirtualInstanceIdentityType type) {
this.type = type;
return this;
}
Expand All @@ -99,9 +67,10 @@ public Map<String, UserAssignedIdentity> userAssignedIdentities() {
* Set the userAssignedIdentities property: The identities assigned to this resource by the user.
*
* @param userAssignedIdentities the userAssignedIdentities value to set.
* @return the ManagedServiceIdentity object itself.
* @return the SAPVirtualInstanceIdentity object itself.
*/
public ManagedServiceIdentity withUserAssignedIdentities(Map<String, UserAssignedIdentity> userAssignedIdentities) {
public SAPVirtualInstanceIdentity
withUserAssignedIdentities(Map<String, UserAssignedIdentity> userAssignedIdentities) {
this.userAssignedIdentities = userAssignedIdentities;
return this;
}
Expand All @@ -114,7 +83,8 @@ public ManagedServiceIdentity withUserAssignedIdentities(Map<String, UserAssigne
public void validate() {
if (type() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity"));
.log(
new IllegalArgumentException("Missing required property type in model SAPVirtualInstanceIdentity"));
}
if (userAssignedIdentities() != null) {
userAssignedIdentities().values().forEach(e -> {
Expand All @@ -125,7 +95,7 @@ public void validate() {
}
}

private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class);
private static final ClientLogger LOGGER = new ClientLogger(SAPVirtualInstanceIdentity.class);

/**
* {@inheritDoc}
Expand All @@ -140,37 +110,34 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
}

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

if ("type".equals(fieldName)) {
deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString());
} else if ("principalId".equals(fieldName)) {
deserializedManagedServiceIdentity.principalId = reader.getString();
} else if ("tenantId".equals(fieldName)) {
deserializedManagedServiceIdentity.tenantId = reader.getString();
deserializedSAPVirtualInstanceIdentity.type
= SAPVirtualInstanceIdentityType.fromString(reader.getString());
} else if ("userAssignedIdentities".equals(fieldName)) {
Map<String, UserAssignedIdentity> userAssignedIdentities
= reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1));
deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities;
deserializedSAPVirtualInstanceIdentity.userAssignedIdentities = userAssignedIdentities;
} else {
reader.skipChildren();
}
}

return deserializedManagedServiceIdentity;
return deserializedSAPVirtualInstanceIdentity;
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.azure.resourcemanager.workloadssapvirtualinstance.models;

import com.azure.core.util.ExpandableStringEnum;
import java.util.Collection;

/**
* Type of managed service identity (where only None and UserAssigned types are allowed).
*/
public final class SAPVirtualInstanceIdentityType extends ExpandableStringEnum<SAPVirtualInstanceIdentityType> {
/**
* No managed identity.
*/
public static final SAPVirtualInstanceIdentityType NONE = fromString("None");

/**
* User assigned managed identity.
*/
public static final SAPVirtualInstanceIdentityType USER_ASSIGNED = fromString("UserAssigned");

/**
* Creates a new instance of SAPVirtualInstanceIdentityType value.
*
* @deprecated Use the {@link #fromString(String)} factory method.
*/
@Deprecated
public SAPVirtualInstanceIdentityType() {
}

/**
* Creates or finds a SAPVirtualInstanceIdentityType from its string representation.
*
* @param name a name to look for.
* @return the corresponding SAPVirtualInstanceIdentityType.
*/
public static SAPVirtualInstanceIdentityType fromString(String name) {
return fromString(name, SAPVirtualInstanceIdentityType.class);
}

/**
* Gets known SAPVirtualInstanceIdentityType values.
*
* @return known SAPVirtualInstanceIdentityType values.
*/
public static Collection<SAPVirtualInstanceIdentityType> values() {
return values(SAPVirtualInstanceIdentityType.class);
}
}
Loading