Skip to content
Merged
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
Expand Up @@ -686,7 +686,12 @@
"x-ms-client-flatten": true
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2020-08-20-preview has gone through the full deprecation announcement process and RP and ARM no longer accepts requests for this API Version

},
"identity": {
"$ref": "../../../../../common-types/resource-management/v5/managedidentity.json#/definitions/ManagedServiceIdentity"
"$ref": "../../../../../common-types/resource-management/v5/managedidentity.json#/definitions/ManagedServiceIdentity",
"x-ms-mutability": [
"create",
"read",
"update"
]
Comment on lines +690 to +694
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why you need this, as by default that's the 3 values...
https://github.com/Azure/autorest/blob/main/docs/extensions/readme.md#x-ms-mutability

But anyway I guess it won't hurt.

Copy link
Copy Markdown
Member

@Joeleniqs Joeleniqs Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's when readonly property is indicated, also autorest doesn't create builder methods for java to allow create or update when that isn't specified.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I didn't see anywhere in swagger stating that "identity" property is "readonly". The property is not in parrent "TrackedResource". And here it does not have "readOnly": true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a third option when it's just null considering it's a JSON object, the fact that readonly isn't specified doesn't mean false is applied by default. Either case , this gave us our expected behavior using autorest for generating java package.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emm, I am not sure about it. I actually works on Java codegen, and a quick run on the spec (without this change) works fine.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.communication.generated;

import com.azure.resourcemanager.communication.models.ManagedServiceIdentity;
import com.azure.resourcemanager.communication.models.ManagedServiceIdentityType;

/** Samples for CommunicationServices CreateOrUpdate. */
public final class CommunicationServicesCreateOrUpdateSamples {
    /*
     * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/createOrUpdate.json
     */
    /**
     * Sample code: Create or update resource.
     *
     * @param manager Entry point to CommunicationManager.
     */
    public static void createOrUpdateResource(com.azure.resourcemanager.communication.CommunicationManager manager) {
        manager
            .communicationServices()
            .define("MyCommunicationResource")
            .withRegion("Global")
            .withExistingResourceGroup("MyResourceGroup")
            .withDataLocation("United States")
            .create();
    }

    /*
     * x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/createOrUpdateWithSystemAssignedIdentity.json
     */
    /**
     * Sample code: Create or update resource with managed identity.
     *
     * @param manager Entry point to CommunicationManager.
     */
    public static void createOrUpdateResourceWithManagedIdentity(
        com.azure.resourcemanager.communication.CommunicationManager manager) {
        manager
            .communicationServices()
            .define("MyCommunicationResource")
            .withRegion("Global")
            .withExistingResourceGroup("MyResourceGroup")
            .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED))
            .withDataLocation("United States")
            .create();
    }
}

Copy link
Copy Markdown
Member

@weidongxu-microsoft weidongxu-microsoft Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The update sample seems not correct, but code should still work if one do withIdentity.
Azure/autorest.java#2214

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, this is worth investigating as 2 other people also don't have the withIdentity method generated.
What's your autorest version?

Copy link
Copy Markdown
Member

@weidongxu-microsoft weidongxu-microsoft Jul 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@autorest/java@4.1.17

Use --use=@autorest/java@4.1.17 to use this version.

The full command is pretty complicated.

See https://github.com/Azure/azure-sdk-for-java/wiki/%5BManagement%5D--OpenAPI-specs for automated codegen.

Copy link
Copy Markdown
Member

@weidongxu-microsoft weidongxu-microsoft Jul 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}
},
Expand Down
2 changes: 1 addition & 1 deletion specification/communication/resource-manager/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ These are the global settings for the Azure Communication Services API.
title: CommunicationServiceManagementClient
openapi-type: arm
openapi-subtype: rpaas
tag: package-2023-03
tag: package-preview-2023-04
```

### Tag: package-preview-2023-04
Expand Down