diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 7432f8d493b8..95bf0ce612c0 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -374,7 +374,7 @@ com.azure.resourcemanager:azure-resourcemanager-vmwarecloudsimple;1.0.0-beta.3;1 com.azure.resourcemanager:azure-resourcemanager-managedapplications;1.0.0-beta.4;1.0.0-beta.5 com.azure.resourcemanager:azure-resourcemanager-videoanalyzer;1.0.0-beta.5;1.0.0-beta.6 com.azure.resourcemanager:azure-resourcemanager-imagebuilder;1.1.0;1.2.0-beta.1 -com.azure.resourcemanager:azure-resourcemanager-maps;1.0.0;1.1.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-maps;1.0.0;1.1.0 com.azure.resourcemanager:azure-resourcemanager-botservice;1.0.0-beta.6;1.0.0-beta.7 com.azure.resourcemanager:azure-resourcemanager-recoveryservicesbackup;1.4.0;1.5.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;1.0.0;1.1.0-beta.3 diff --git a/sdk/maps/azure-resourcemanager-maps/CHANGELOG.md b/sdk/maps/azure-resourcemanager-maps/CHANGELOG.md index 3616ae16aa30..623093595df5 100644 --- a/sdk/maps/azure-resourcemanager-maps/CHANGELOG.md +++ b/sdk/maps/azure-resourcemanager-maps/CHANGELOG.md @@ -1,14 +1,21 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.1.0 (2024-12-11) -### Features Added +- Azure Resource Manager AzureMaps client library for Java. This package contains Microsoft Azure SDK for AzureMaps Management SDK. Azure Maps. Package tag package-2023-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### Serialization/Deserialization change + +- `Jackson` is removed from dependency and no longer supported. + +##### Migration Guide -### Other Changes +If you are using `Jackson`/`ObjectMapper` for manual serialization/deserialization, configure your `ObjectMapper` for backward compatibility: +```java +objectMapper.registerModule(com.azure.core.serializer.json.jackson.JacksonJsonProvider.getJsonSerializableDatabindModule()); +``` ## 1.0.0 (2023-08-22) diff --git a/sdk/maps/azure-resourcemanager-maps/README.md b/sdk/maps/azure-resourcemanager-maps/README.md index 4d987d46b86f..25de5da35778 100644 --- a/sdk/maps/azure-resourcemanager-maps/README.md +++ b/sdk/maps/azure-resourcemanager-maps/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-maps - 1.0.0 + 1.1.0 ``` [//]: # ({x-version-update-end}) @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen ### Authentication -By default, Azure Active Directory 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); @@ -94,9 +90,10 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [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/ +[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 diff --git a/sdk/maps/azure-resourcemanager-maps/SAMPLE.md b/sdk/maps/azure-resourcemanager-maps/SAMPLE.md index e83e89f2c1e2..8132de480b80 100644 --- a/sdk/maps/azure-resourcemanager-maps/SAMPLE.md +++ b/sdk/maps/azure-resourcemanager-maps/SAMPLE.md @@ -46,146 +46,115 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; -/** Samples for Accounts CreateOrUpdate. */ +/** + * Samples for Accounts CreateOrUpdate. + */ public final class AccountsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccountGen2.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccountGen2.json */ /** * Sample code: Create Gen2 Account. - * + * * @param manager Entry point to AzureMapsManager. */ public static void createGen2Account(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() + manager.accounts() .define("myMapsAccount") .withRegion("eastus") .withExistingResourceGroup("myResourceGroup") .withSku(new Sku().withName(Name.G2)) .withTags(mapOf("test", "true")) .withKind(Kind.GEN2) - .withProperties( - new MapsAccountProperties() - .withDisableLocalAuth(true) - .withCors( - new CorsRules() - .withCorsRules( - Arrays - .asList( - new CorsRule() - .withAllowedOrigins( - Arrays.asList("http://www.contoso.com", "http://www.fabrikam.com")))))) + .withProperties(new MapsAccountProperties().withDisableLocalAuth(true) + .withCors(new CorsRules().withCorsRules(Arrays.asList(new CorsRule() + .withAllowedOrigins(Arrays.asList("http://www.contoso.com", "http://www.fabrikam.com")))))) .create(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccountEncryption.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccountEncryption.json */ /** * Sample code: Create Account with Encryption. - * + * * @param manager Entry point to AzureMapsManager. */ public static void createAccountWithEncryption(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() + manager.accounts() .define("myMapsAccount") .withRegion("eastus") .withExistingResourceGroup("myResourceGroup") .withSku(new Sku().withName(Name.G2)) .withKind(Kind.GEN2) - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", - new UserAssignedIdentity()))) - .withProperties( - new MapsAccountProperties() - .withEncryption( - new Encryption() - .withCustomerManagedKeyEncryption( - new CustomerManagedKeyEncryption() - .withKeyEncryptionKeyIdentity( - new CustomerManagedKeyEncryptionKeyIdentity() - .withIdentityType(IdentityType.USER_ASSIGNED_IDENTITY) - .withUserAssignedIdentityResourceId( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName")) - .withKeyEncryptionKeyUrl("fakeTokenPlaceholder")))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", + new UserAssignedIdentity()))) + .withProperties(new MapsAccountProperties() + .withEncryption(new Encryption().withCustomerManagedKeyEncryption(new CustomerManagedKeyEncryption() + .withKeyEncryptionKeyIdentity(new CustomerManagedKeyEncryptionKeyIdentity() + .withIdentityType(IdentityType.USER_ASSIGNED_IDENTITY) + .withUserAssignedIdentityResourceId( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName")) + .withKeyEncryptionKeyUrl("fakeTokenPlaceholder")))) .create(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccount.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccount.json */ /** * Sample code: Create Gen1 Account. - * + * * @param manager Entry point to AzureMapsManager. */ public static void createGen1Account(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() + manager.accounts() .define("myMapsAccount") .withRegion("eastus") .withExistingResourceGroup("myResourceGroup") .withSku(new Sku().withName(Name.S0)) .withTags(mapOf("test", "true")) .withKind(Kind.GEN1) - .withProperties( - new MapsAccountProperties() - .withDisableLocalAuth(false) - .withCors( - new CorsRules() - .withCorsRules( - Arrays - .asList( - new CorsRule() - .withAllowedOrigins( - Arrays.asList("http://www.contoso.com", "http://www.fabrikam.com")))))) + .withProperties(new MapsAccountProperties().withDisableLocalAuth(false) + .withCors(new CorsRules().withCorsRules(Arrays.asList(new CorsRule() + .withAllowedOrigins(Arrays.asList("http://www.contoso.com", "http://www.fabrikam.com")))))) .create(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccountManagedIdentity.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccountManagedIdentity.json */ /** * Sample code: Create Account with Managed Identities. - * + * * @param manager Entry point to AzureMapsManager. */ public static void createAccountWithManagedIdentities(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() + manager.accounts() .define("myMapsAccount") .withRegion("eastus") .withExistingResourceGroup("myResourceGroup") .withSku(new Sku().withName(Name.G2)) .withTags(mapOf("test", "true")) .withKind(Kind.GEN2) - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", - new UserAssignedIdentity()))) - .withProperties( - new MapsAccountProperties() - .withDisableLocalAuth(false) - .withLinkedResources( - Arrays - .asList( - new LinkedResource() - .withUniqueName("myBatchStorageAccount") - .withId( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.Storage/accounts/mystorageacc"), - new LinkedResource() - .withUniqueName("myBlobDataSource") - .withId( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.Storage/accounts/mystorageacc")))) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", + new UserAssignedIdentity()))) + .withProperties(new MapsAccountProperties().withDisableLocalAuth(false) + .withLinkedResources(Arrays.asList(new LinkedResource().withUniqueName("myBatchStorageAccount") + .withId( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.Storage/accounts/mystorageacc"), + new LinkedResource().withUniqueName("myBlobDataSource") + .withId( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.Storage/accounts/mystorageacc")))) .create(); } @@ -206,19 +175,21 @@ public final class AccountsCreateOrUpdateSamples { ### Accounts_Delete ```java -/** Samples for Accounts Delete. */ +/** + * Samples for Accounts Delete. + */ public final class AccountsDeleteSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/DeleteAccount.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/DeleteAccount.json */ /** * Sample code: DeleteAccount. - * + * * @param manager Entry point to AzureMapsManager. */ public static void deleteAccount(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() + manager.accounts() .deleteByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE); } } @@ -227,19 +198,20 @@ public final class AccountsDeleteSamples { ### Accounts_GetByResourceGroup ```java -/** Samples for Accounts GetByResourceGroup. */ +/** + * Samples for Accounts GetByResourceGroup. + */ public final class AccountsGetByResourceGroupSamples { /* * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetAccount.json */ /** * Sample code: GetAccount. - * + * * @param manager Entry point to AzureMapsManager. */ public static void getAccount(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() + manager.accounts() .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE); } } @@ -248,14 +220,17 @@ public final class AccountsGetByResourceGroupSamples { ### Accounts_List ```java -/** Samples for Accounts List. */ +/** + * Samples for Accounts List. + */ public final class AccountsListSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListAccountsBySubscription.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListAccountsBySubscription.json */ /** * Sample code: List Accounts By Subscription. - * + * * @param manager Entry point to AzureMapsManager. */ public static void listAccountsBySubscription(com.azure.resourcemanager.maps.AzureMapsManager manager) { @@ -267,14 +242,17 @@ public final class AccountsListSamples { ### Accounts_ListByResourceGroup ```java -/** Samples for Accounts ListByResourceGroup. */ +/** + * Samples for Accounts ListByResourceGroup. + */ public final class AccountsListByResourceGroupSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListAccountsByResourceGroup.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListAccountsByResourceGroup.json */ /** * Sample code: List Accounts By Resource Group. - * + * * @param manager Entry point to AzureMapsManager. */ public static void listAccountsByResourceGroup(com.azure.resourcemanager.maps.AzureMapsManager manager) { @@ -286,14 +264,16 @@ public final class AccountsListByResourceGroupSamples { ### Accounts_ListKeys ```java -/** Samples for Accounts ListKeys. */ +/** + * Samples for Accounts ListKeys. + */ public final class AccountsListKeysSamples { /* * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListKeys.json */ /** * Sample code: List Keys. - * + * * @param manager Entry point to AzureMapsManager. */ public static void listKeys(com.azure.resourcemanager.maps.AzureMapsManager manager) { @@ -309,24 +289,23 @@ import com.azure.resourcemanager.maps.models.AccountSasParameters; import com.azure.resourcemanager.maps.models.SigningKey; import java.util.Arrays; -/** Samples for Accounts ListSas. */ +/** + * Samples for Accounts ListSas. + */ public final class AccountsListSasSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/AccountListSAS.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/AccountListSAS.json */ /** * Sample code: List Account Sas. - * + * * @param manager Entry point to AzureMapsManager. */ public static void listAccountSas(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() - .listSasWithResponse( - "myResourceGroup", - "myMapsAccount", - new AccountSasParameters() - .withSigningKey(SigningKey.PRIMARY_KEY) + manager.accounts() + .listSasWithResponse("myResourceGroup", "myMapsAccount", + new AccountSasParameters().withSigningKey(SigningKey.PRIMARY_KEY) .withPrincipalId("e917f87b-324d-4728-98ed-e31d311a7d65") .withRegions(Arrays.asList("eastus")) .withMaxRatePerSecond(500) @@ -343,24 +322,23 @@ public final class AccountsListSasSamples { import com.azure.resourcemanager.maps.models.KeyType; import com.azure.resourcemanager.maps.models.MapsKeySpecification; -/** Samples for Accounts RegenerateKeys. */ +/** + * Samples for Accounts RegenerateKeys. + */ public final class AccountsRegenerateKeysSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/RegenerateKey.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/RegenerateKey.json */ /** * Sample code: Regenerate Key. - * + * * @param manager Entry point to AzureMapsManager. */ public static void regenerateKey(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() - .regenerateKeysWithResponse( - "myResourceGroup", - "myMapsAccount", - new MapsKeySpecification().withKeyType(KeyType.PRIMARY), - com.azure.core.util.Context.NONE); + manager.accounts() + .regenerateKeysWithResponse("myResourceGroup", "myMapsAccount", + new MapsKeySpecification().withKeyType(KeyType.PRIMARY), com.azure.core.util.Context.NONE); } } ``` @@ -384,125 +362,107 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; -/** Samples for Accounts Update. */ +/** + * Samples for Accounts Update. + */ public final class AccountsUpdateSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountGen2.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountGen2.json */ /** * Sample code: Update to Gen2 Account. - * + * * @param manager Entry point to AzureMapsManager. */ public static void updateToGen2Account(com.azure.resourcemanager.maps.AzureMapsManager manager) { - MapsAccount resource = - manager - .accounts() - .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) - .getValue(); + MapsAccount resource = manager.accounts() + .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withKind(Kind.GEN2).withSku(new Sku().withName(Name.G2)).apply(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccount.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccount.json */ /** * Sample code: Update Account Tags. - * + * * @param manager Entry point to AzureMapsManager. */ public static void updateAccountTags(com.azure.resourcemanager.maps.AzureMapsManager manager) { - MapsAccount resource = - manager - .accounts() - .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) - .getValue(); + MapsAccount resource = manager.accounts() + .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("specialTag", "true")).apply(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountManagedIdentity.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountManagedIdentity.json */ /** * Sample code: Update Account Managed Identities. - * + * * @param manager Entry point to AzureMapsManager. */ public static void updateAccountManagedIdentities(com.azure.resourcemanager.maps.AzureMapsManager manager) { - MapsAccount resource = - manager - .accounts() - .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) - .getValue(); - resource - .update() + MapsAccount resource = manager.accounts() + .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() .withKind(Kind.GEN2) .withSku(new Sku().withName(Name.G2)) - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", - new UserAssignedIdentity()))) - .withLinkedResources( - Arrays - .asList( - new LinkedResource() - .withUniqueName("myBatchStorageAccount") - .withId( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{storageName}"))) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", + new UserAssignedIdentity()))) + .withLinkedResources(Arrays.asList(new LinkedResource().withUniqueName("myBatchStorageAccount") + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{storageName}"))) .apply(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountGen1.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountGen1.json */ /** * Sample code: Update to Gen1 Account. - * + * * @param manager Entry point to AzureMapsManager. */ public static void updateToGen1Account(com.azure.resourcemanager.maps.AzureMapsManager manager) { - MapsAccount resource = - manager - .accounts() - .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) - .getValue(); + MapsAccount resource = manager.accounts() + .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withKind(Kind.GEN1).withSku(new Sku().withName(Name.S1)).apply(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountEncryption.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountEncryption.json */ /** * Sample code: Update Account Encryption. - * + * * @param manager Entry point to AzureMapsManager. */ public static void updateAccountEncryption(com.azure.resourcemanager.maps.AzureMapsManager manager) { - MapsAccount resource = - manager - .accounts() - .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) - .getValue(); - resource - .update() - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", - null))) - .withEncryption( - new Encryption() - .withCustomerManagedKeyEncryption( - new CustomerManagedKeyEncryption() - .withKeyEncryptionKeyIdentity( - new CustomerManagedKeyEncryptionKeyIdentity() - .withIdentityType(IdentityType.SYSTEM_ASSIGNED_IDENTITY)) - .withKeyEncryptionKeyUrl("fakeTokenPlaceholder"))) + MapsAccount resource = manager.accounts() + .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", + null))) + .withEncryption(new Encryption().withCustomerManagedKeyEncryption(new CustomerManagedKeyEncryption() + .withKeyEncryptionKeyIdentity(new CustomerManagedKeyEncryptionKeyIdentity() + .withIdentityType(IdentityType.SYSTEM_ASSIGNED_IDENTITY)) + .withKeyEncryptionKeyUrl("fakeTokenPlaceholder"))) .apply(); } @@ -527,19 +487,21 @@ import com.azure.resourcemanager.maps.fluent.models.CreatorProperties; import java.util.HashMap; import java.util.Map; -/** Samples for Creators CreateOrUpdate. */ +/** + * Samples for Creators CreateOrUpdate. + */ public final class CreatorsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateMapsCreator.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateMapsCreator.json */ /** * Sample code: Create Creator Resource. - * + * * @param manager Entry point to AzureMapsManager. */ public static void createCreatorResource(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .creators() + manager.creators() .define("myCreator") .withRegion("eastus2") .withExistingAccount("myResourceGroup", "myMapsAccount") @@ -565,19 +527,21 @@ public final class CreatorsCreateOrUpdateSamples { ### Creators_Delete ```java -/** Samples for Creators Delete. */ +/** + * Samples for Creators Delete. + */ public final class CreatorsDeleteSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/DeleteMapsCreator.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/DeleteMapsCreator.json */ /** * Sample code: Delete Creator Resource. - * + * * @param manager Entry point to AzureMapsManager. */ public static void deleteCreatorResource(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .creators() + manager.creators() .deleteWithResponse("myResourceGroup", "myMapsAccount", "myCreator", com.azure.core.util.Context.NONE); } } @@ -586,19 +550,21 @@ public final class CreatorsDeleteSamples { ### Creators_Get ```java -/** Samples for Creators Get. */ +/** + * Samples for Creators Get. + */ public final class CreatorsGetSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetMapsCreator.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetMapsCreator.json */ /** * Sample code: Get Creator Resource. - * + * * @param manager Entry point to AzureMapsManager. */ public static void getCreatorResource(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .creators() + manager.creators() .getWithResponse("myResourceGroup", "myMapsAccount", "myCreator", com.azure.core.util.Context.NONE); } } @@ -607,14 +573,17 @@ public final class CreatorsGetSamples { ### Creators_ListByAccount ```java -/** Samples for Creators ListByAccount. */ +/** + * Samples for Creators ListByAccount. + */ public final class CreatorsListByAccountSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListMapsCreatorsByAccount.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListMapsCreatorsByAccount.json */ /** * Sample code: List Creator Resources By Account. - * + * * @param manager Entry point to AzureMapsManager. */ public static void listCreatorResourcesByAccount(com.azure.resourcemanager.maps.AzureMapsManager manager) { @@ -630,22 +599,23 @@ import com.azure.resourcemanager.maps.models.Creator; import java.util.HashMap; import java.util.Map; -/** Samples for Creators Update. */ +/** + * Samples for Creators Update. + */ public final class CreatorsUpdateSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateMapsCreator.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateMapsCreator.json */ /** * Sample code: Update Creator Resource. - * + * * @param manager Entry point to AzureMapsManager. */ public static void updateCreatorResource(com.azure.resourcemanager.maps.AzureMapsManager manager) { - Creator resource = - manager - .creators() - .getWithResponse("myResourceGroup", "myMapsAccount", "myCreator", com.azure.core.util.Context.NONE) - .getValue(); + Creator resource = manager.creators() + .getWithResponse("myResourceGroup", "myMapsAccount", "myCreator", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("specialTag", "true")).withStorageUnits(10).apply(); } @@ -666,14 +636,17 @@ public final class CreatorsUpdateSamples { ### Maps_List ```java -/** Samples for Maps List. */ +/** + * Samples for Maps List. + */ public final class MapsListSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetOperationsSubscription.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetOperationsSubscription.json */ /** * Sample code: Get Operations by Subscription. - * + * * @param manager Entry point to AzureMapsManager. */ public static void getOperationsBySubscription(com.azure.resourcemanager.maps.AzureMapsManager manager) { @@ -685,14 +658,17 @@ public final class MapsListSamples { ### Maps_ListOperations ```java -/** Samples for Maps ListOperations. */ +/** + * Samples for Maps ListOperations. + */ public final class MapsListOperationsSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetOperations.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetOperations.json */ /** * Sample code: Get Operations. - * + * * @param manager Entry point to AzureMapsManager. */ public static void getOperations(com.azure.resourcemanager.maps.AzureMapsManager manager) { diff --git a/sdk/maps/azure-resourcemanager-maps/pom.xml b/sdk/maps/azure-resourcemanager-maps/pom.xml index 5e9cfc569574..75670d59c60b 100644 --- a/sdk/maps/azure-resourcemanager-maps/pom.xml +++ b/sdk/maps/azure-resourcemanager-maps/pom.xml @@ -14,7 +14,7 @@ com.azure.resourcemanager azure-resourcemanager-maps - 1.1.0-beta.1 + 1.1.0 jar Microsoft Azure SDK for AzureMaps Management @@ -45,6 +45,7 @@ UTF-8 0 0 + false @@ -75,8 +76,6 @@ 4.11.0 test - - net.bytebuddy byte-buddy diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/AzureMapsManager.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/AzureMapsManager.java index c5d5411ee244..98dac9a54aa2 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/AzureMapsManager.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/AzureMapsManager.java @@ -11,6 +11,7 @@ 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.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -19,7 +20,6 @@ import com.azure.core.http.policy.RetryOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -38,7 +38,10 @@ import java.util.Objects; import java.util.stream.Collectors; -/** Entry point to AzureMapsManager. Azure Maps. */ +/** + * Entry point to AzureMapsManager. + * Azure Maps. + */ public final class AzureMapsManager { private Accounts accounts; @@ -60,7 +63,7 @@ private AzureMapsManager(HttpPipeline httpPipeline, AzureProfile profile, Durati /** * Creates an instance of AzureMaps service API entry point. - * + * * @param credential the credential to use. * @param profile the Azure profile for client. * @return the AzureMaps service API instance. @@ -73,7 +76,7 @@ public static AzureMapsManager authenticate(TokenCredential credential, AzurePro /** * Creates an instance of AzureMaps service API entry point. - * + * * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. * @param profile the Azure profile for client. * @return the AzureMaps service API instance. @@ -86,14 +89,16 @@ public static AzureMapsManager authenticate(HttpPipeline httpPipeline, AzureProf /** * Gets a Configurable instance that can be used to create AzureMapsManager with optional configuration. - * + * * @return the Configurable instance allowing configurations. */ public static Configurable configure() { return new AzureMapsManager.Configurable(); } - /** The Configurable allowing configurations to be set. */ + /** + * The Configurable allowing configurations to be set. + */ public static final class Configurable { private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); @@ -165,8 +170,8 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { /** * Sets the retry options for the HTTP pipeline retry policy. - * - *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. * * @param retryOptions the retry options for the HTTP pipeline retry policy. * @return the configurable object itself. @@ -208,7 +213,7 @@ public AzureMapsManager authenticate(TokenCredential credential, AzureProfile pr .append("-") .append("com.azure.resourcemanager.maps") .append("/") - .append("1.0.0"); + .append("1.1.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -241,7 +246,7 @@ public AzureMapsManager authenticate(TokenCredential credential, AzureProfile pr HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies.stream() .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .collect(Collectors.toList())); @@ -256,7 +261,7 @@ public AzureMapsManager authenticate(TokenCredential credential, AzureProfile pr /** * Gets the resource collection API of Accounts. It manages MapsAccount. - * + * * @return Resource collection API of Accounts. */ public Accounts accounts() { @@ -268,7 +273,7 @@ public Accounts accounts() { /** * Gets the resource collection API of Maps. - * + * * @return Resource collection API of Maps. */ public Maps maps() { @@ -280,7 +285,7 @@ public Maps maps() { /** * Gets the resource collection API of Creators. It manages Creator. - * + * * @return Resource collection API of Creators. */ public Creators creators() { @@ -293,7 +298,7 @@ public Creators creators() { /** * Gets wrapped service client AzureMapsManagementClient providing direct access to the underlying auto-generated * API implementation, based on Azure REST API. - * + * * @return Wrapped service client AzureMapsManagementClient. */ public AzureMapsManagementClient serviceClient() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/AccountsClient.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/AccountsClient.java index c652eec716d6..7bfd3fdc1962 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/AccountsClient.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/AccountsClient.java @@ -16,11 +16,13 @@ import com.azure.resourcemanager.maps.models.MapsAccountUpdateParameters; import com.azure.resourcemanager.maps.models.MapsKeySpecification; -/** An instance of this class provides access to all the operations defined in AccountsClient. */ +/** + * An instance of this class provides access to all the operations defined in AccountsClient. + */ public interface AccountsClient { /** * Create or update a Maps Account. A Maps Account holds the keys which allow access to the Maps REST APIs. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccount The new or updated parameters for the Maps Account. @@ -36,7 +38,7 @@ Response createOrUpdateWithResponse(String resourceGroupName, /** * Create or update a Maps Account. A Maps Account holds the keys which allow access to the Maps REST APIs. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccount The new or updated parameters for the Maps Account. @@ -51,7 +53,7 @@ Response createOrUpdateWithResponse(String resourceGroupName, /** * Updates a Maps Account. Only a subset of the parameters may be updated after creation, such as Sku, Tags, * Properties. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountUpdateParameters The updated parameters for the Maps Account. @@ -68,7 +70,7 @@ Response updateWithResponse(String resourceGroupName, String a /** * Updates a Maps Account. Only a subset of the parameters may be updated after creation, such as Sku, Tags, * Properties. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountUpdateParameters The updated parameters for the Maps Account. @@ -83,7 +85,7 @@ MapsAccountInner update(String resourceGroupName, String accountName, /** * Delete a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -97,7 +99,7 @@ MapsAccountInner update(String resourceGroupName, String accountName, /** * Delete a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -109,7 +111,7 @@ MapsAccountInner update(String resourceGroupName, String accountName, /** * Get a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -124,7 +126,7 @@ Response getByResourceGroupWithResponse(String resourceGroupNa /** * Get a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -137,7 +139,7 @@ Response getByResourceGroupWithResponse(String resourceGroupNa /** * Get all Maps Accounts in a Resource Group. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -149,7 +151,7 @@ Response getByResourceGroupWithResponse(String resourceGroupNa /** * Get all Maps Accounts in a Resource Group. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -162,7 +164,7 @@ Response getByResourceGroupWithResponse(String resourceGroupNa /** * Get all Maps Accounts in a Subscription. - * + * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all Maps Accounts in a Subscription as paginated response with {@link PagedIterable}. @@ -172,7 +174,7 @@ Response getByResourceGroupWithResponse(String resourceGroupNa /** * Get all Maps Accounts in a Subscription. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -185,11 +187,12 @@ Response getByResourceGroupWithResponse(String resourceGroupNa /** * Create and list an account shared access signature token. Use this SAS token for authentication to Azure Maps * REST APIs through various Azure Maps SDKs. As prerequisite to create a SAS Token. - * - *

Prerequisites: 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the - * account. 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed - * Identity is placed. - * + * + * Prerequisites: + * 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the account. + * 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed Identity is + * placed. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountSasParameters The updated parameters for the Maps Account. @@ -198,7 +201,7 @@ Response getByResourceGroupWithResponse(String resourceGroupNa * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed - * identity permissions on Azure (IAM) Role Based Access Control along with {@link Response}. + * identity permissions on Azure (IAM) Role Based Access Control along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response listSasWithResponse(String resourceGroupName, String accountName, @@ -207,11 +210,12 @@ Response listSasWithResponse(String resourceGroupName, /** * Create and list an account shared access signature token. Use this SAS token for authentication to Azure Maps * REST APIs through various Azure Maps SDKs. As prerequisite to create a SAS Token. - * - *

Prerequisites: 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the - * account. 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed - * Identity is placed. - * + * + * Prerequisites: + * 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the account. + * 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed Identity is + * placed. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountSasParameters The updated parameters for the Maps Account. @@ -219,7 +223,7 @@ Response listSasWithResponse(String resourceGroupName, * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed - * identity permissions on Azure (IAM) Role Based Access Control. + * identity permissions on Azure (IAM) Role Based Access Control. */ @ServiceMethod(returns = ReturnType.SINGLE) MapsAccountSasTokenInner listSas(String resourceGroupName, String accountName, @@ -228,7 +232,7 @@ MapsAccountSasTokenInner listSas(String resourceGroupName, String accountName, /** * Get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to the Maps REST APIs. * Only one key is needed at a time; two are given to provide seamless key regeneration. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -243,7 +247,7 @@ MapsAccountSasTokenInner listSas(String resourceGroupName, String accountName, /** * Get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to the Maps REST APIs. * Only one key is needed at a time; two are given to provide seamless key regeneration. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -257,7 +261,7 @@ MapsAccountSasTokenInner listSas(String resourceGroupName, String accountName, /** * Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working * immediately. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param keySpecification Which key to regenerate: primary or secondary. @@ -274,7 +278,7 @@ Response regenerateKeysWithResponse(String resourceGroupNa /** * Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working * immediately. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param keySpecification Which key to regenerate: primary or secondary. diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/AzureMapsManagementClient.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/AzureMapsManagementClient.java index 8dd537b53b23..08ef00f9288f 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/AzureMapsManagementClient.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/AzureMapsManagementClient.java @@ -7,60 +7,62 @@ import com.azure.core.http.HttpPipeline; import java.time.Duration; -/** The interface for AzureMapsManagementClient class. */ +/** + * The interface for AzureMapsManagementClient class. + */ public interface AzureMapsManagementClient { /** * Gets The ID of the target subscription. - * + * * @return the subscriptionId value. */ String getSubscriptionId(); /** * Gets server parameter. - * + * * @return the endpoint value. */ String getEndpoint(); /** * Gets Api Version. - * + * * @return the apiVersion value. */ String getApiVersion(); /** * Gets The HTTP pipeline to send requests through. - * + * * @return the httpPipeline value. */ HttpPipeline getHttpPipeline(); /** * Gets The default poll interval for long-running operation. - * + * * @return the defaultPollInterval value. */ Duration getDefaultPollInterval(); /** * Gets the AccountsClient object to access its operations. - * + * * @return the AccountsClient object. */ AccountsClient getAccounts(); /** * Gets the MapsClient object to access its operations. - * + * * @return the MapsClient object. */ MapsClient getMaps(); /** * Gets the CreatorsClient object to access its operations. - * + * * @return the CreatorsClient object. */ CreatorsClient getCreators(); diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/CreatorsClient.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/CreatorsClient.java index 0f9ca5fa2dc3..e97786aebce9 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/CreatorsClient.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/CreatorsClient.java @@ -12,11 +12,13 @@ import com.azure.resourcemanager.maps.fluent.models.CreatorInner; import com.azure.resourcemanager.maps.models.CreatorUpdateParameters; -/** An instance of this class provides access to all the operations defined in CreatorsClient. */ +/** + * An instance of this class provides access to all the operations defined in CreatorsClient. + */ public interface CreatorsClient { /** * Get all Creator instances for an Azure Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -29,7 +31,7 @@ public interface CreatorsClient { /** * Get all Creator instances for an Azure Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -44,7 +46,7 @@ public interface CreatorsClient { /** * Create or update a Maps Creator resource. Creator resource will manage Azure resources required to populate a * custom set of mapping data. It requires an account to exist before it can be created. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -54,7 +56,7 @@ public interface CreatorsClient { * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data along with {@link Response}. + * data along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response createOrUpdateWithResponse(String resourceGroupName, String accountName, String creatorName, @@ -63,7 +65,7 @@ Response createOrUpdateWithResponse(String resourceGroupName, Stri /** * Create or update a Maps Creator resource. Creator resource will manage Azure resources required to populate a * custom set of mapping data. It requires an account to exist before it can be created. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -72,7 +74,7 @@ Response createOrUpdateWithResponse(String resourceGroupName, Stri * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data. + * data. */ @ServiceMethod(returns = ReturnType.SINGLE) CreatorInner createOrUpdate(String resourceGroupName, String accountName, String creatorName, @@ -80,7 +82,7 @@ CreatorInner createOrUpdate(String resourceGroupName, String accountName, String /** * Updates the Maps Creator resource. Only a subset of the parameters may be updated after creation, such as Tags. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -90,7 +92,7 @@ CreatorInner createOrUpdate(String resourceGroupName, String accountName, String * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data along with {@link Response}. + * data along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response updateWithResponse(String resourceGroupName, String accountName, String creatorName, @@ -98,7 +100,7 @@ Response updateWithResponse(String resourceGroupName, String accou /** * Updates the Maps Creator resource. Only a subset of the parameters may be updated after creation, such as Tags. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -107,7 +109,7 @@ Response updateWithResponse(String resourceGroupName, String accou * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data. + * data. */ @ServiceMethod(returns = ReturnType.SINGLE) CreatorInner update(String resourceGroupName, String accountName, String creatorName, @@ -115,7 +117,7 @@ CreatorInner update(String resourceGroupName, String accountName, String creator /** * Delete a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -131,7 +133,7 @@ Response deleteWithResponse(String resourceGroupName, String accountName, /** * Delete a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -144,7 +146,7 @@ Response deleteWithResponse(String resourceGroupName, String accountName, /** * Get a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -160,7 +162,7 @@ Response getWithResponse(String resourceGroupName, String accountN /** * Get a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/MapsClient.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/MapsClient.java index ff97e4b3c640..03dea6a57d5d 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/MapsClient.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/MapsClient.java @@ -10,11 +10,13 @@ import com.azure.core.util.Context; import com.azure.resourcemanager.maps.fluent.models.OperationDetailInner; -/** An instance of this class provides access to all the operations defined in MapsClient. */ +/** + * An instance of this class provides access to all the operations defined in MapsClient. + */ public interface MapsClient { /** * List operations available for the Maps Resource Provider. - * + * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps as paginated response with {@link PagedIterable}. @@ -24,7 +26,7 @@ public interface MapsClient { /** * List operations available for the Maps Resource Provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -36,7 +38,7 @@ public interface MapsClient { /** * List operations available for the Maps Resource Provider. - * + * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps as paginated response with {@link PagedIterable}. @@ -46,7 +48,7 @@ public interface MapsClient { /** * List operations available for the Maps Resource Provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/CreatorInner.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/CreatorInner.java index 82a52e7ce799..08970b1efb2c 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/CreatorInner.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/CreatorInner.java @@ -8,31 +8,51 @@ import com.azure.core.management.Resource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; -/** An Azure resource which represents Maps Creator product and provides ability to manage private location data. */ +/** + * An Azure resource which represents Maps Creator product and provides ability to manage private location data. + */ @Fluent public final class CreatorInner extends Resource { /* * The Creator resource properties. */ - @JsonProperty(value = "properties", required = true) private CreatorProperties properties; /* * The system meta data relating to this resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; - /** Creates an instance of CreatorInner class. */ + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CreatorInner class. + */ public CreatorInner() { } /** * Get the properties property: The Creator resource properties. - * + * * @return the properties value. */ public CreatorProperties properties() { @@ -41,7 +61,7 @@ public CreatorProperties properties() { /** * Set the properties property: The Creator resource properties. - * + * * @param properties the properties value to set. * @return the CreatorInner object itself. */ @@ -52,21 +72,55 @@ public CreatorInner withProperties(CreatorProperties properties) { /** * Get the systemData property: The system meta data relating to this resource. - * + * * @return the systemData value. */ public SystemData systemData() { return this.systemData; } - /** {@inheritDoc} */ + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ @Override public CreatorInner withLocation(String location) { super.withLocation(location); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public CreatorInner withTags(Map tags) { super.withTags(tags); @@ -75,17 +129,69 @@ public CreatorInner withTags(Map tags) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (properties() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property properties in model CreatorInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property properties in model CreatorInner")); } else { properties().validate(); } } private static final ClientLogger LOGGER = new ClientLogger(CreatorInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreatorInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreatorInner 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 CreatorInner. + */ + public static CreatorInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CreatorInner deserializedCreatorInner = new CreatorInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCreatorInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCreatorInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCreatorInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCreatorInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCreatorInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCreatorInner.properties = CreatorProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCreatorInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCreatorInner; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/CreatorProperties.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/CreatorProperties.java index 3a914ab081b9..ba3473ec1f55 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/CreatorProperties.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/CreatorProperties.java @@ -5,31 +5,37 @@ package com.azure.resourcemanager.maps.fluent.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** Creator resource properties. */ +/** + * Creator resource properties. + */ @Fluent -public final class CreatorProperties { +public final class CreatorProperties implements JsonSerializable { /* * The state of the resource provisioning, terminal states: Succeeded, Failed, Canceled */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private String provisioningState; /* * The storage units to be allocated. Integer values from 1 to 100, inclusive. */ - @JsonProperty(value = "storageUnits", required = true) private int storageUnits; - /** Creates an instance of CreatorProperties class. */ + /** + * Creates an instance of CreatorProperties class. + */ public CreatorProperties() { } /** * Get the provisioningState property: The state of the resource provisioning, terminal states: Succeeded, Failed, * Canceled. - * + * * @return the provisioningState value. */ public String provisioningState() { @@ -38,7 +44,7 @@ public String provisioningState() { /** * Get the storageUnits property: The storage units to be allocated. Integer values from 1 to 100, inclusive. - * + * * @return the storageUnits value. */ public int storageUnits() { @@ -47,7 +53,7 @@ public int storageUnits() { /** * Set the storageUnits property: The storage units to be allocated. Integer values from 1 to 100, inclusive. - * + * * @param storageUnits the storageUnits value to set. * @return the CreatorProperties object itself. */ @@ -58,9 +64,48 @@ public CreatorProperties withStorageUnits(int storageUnits) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("storageUnits", this.storageUnits); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreatorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreatorProperties 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 CreatorProperties. + */ + public static CreatorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CreatorProperties deserializedCreatorProperties = new CreatorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageUnits".equals(fieldName)) { + deserializedCreatorProperties.storageUnits = reader.getInt(); + } else if ("provisioningState".equals(fieldName)) { + deserializedCreatorProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCreatorProperties; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountInner.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountInner.java index a9c1f354f4f0..71a0bcc4289b 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountInner.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountInner.java @@ -8,52 +8,69 @@ import com.azure.core.management.Resource; import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.maps.models.Kind; import com.azure.resourcemanager.maps.models.ManagedServiceIdentity; import com.azure.resourcemanager.maps.models.Sku; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; -/** An Azure resource which represents access to a suite of Maps REST APIs. */ +/** + * An Azure resource which represents access to a suite of Maps REST APIs. + */ @Fluent public final class MapsAccountInner extends Resource { /* * The SKU of this account. */ - @JsonProperty(value = "sku", required = true) private Sku sku; /* * Get or Set Kind property. */ - @JsonProperty(value = "kind") private Kind kind; /* * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) private SystemData systemData; /* * Managed service identity (system assigned and/or user assigned identities) */ - @JsonProperty(value = "identity") private ManagedServiceIdentity identity; /* * The map account properties. */ - @JsonProperty(value = "properties") private MapsAccountProperties properties; - /** Creates an instance of MapsAccountInner class. */ + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of MapsAccountInner class. + */ public MapsAccountInner() { } /** * Get the sku property: The SKU of this account. - * + * * @return the sku value. */ public Sku sku() { @@ -62,7 +79,7 @@ public Sku sku() { /** * Set the sku property: The SKU of this account. - * + * * @param sku the sku value to set. * @return the MapsAccountInner object itself. */ @@ -73,7 +90,7 @@ public MapsAccountInner withSku(Sku sku) { /** * Get the kind property: Get or Set Kind property. - * + * * @return the kind value. */ public Kind kind() { @@ -82,7 +99,7 @@ public Kind kind() { /** * Set the kind property: Get or Set Kind property. - * + * * @param kind the kind value to set. * @return the MapsAccountInner object itself. */ @@ -93,7 +110,7 @@ public MapsAccountInner withKind(Kind kind) { /** * Get the systemData property: Metadata pertaining to creation and last modification of the resource. - * + * * @return the systemData value. */ public SystemData systemData() { @@ -102,7 +119,7 @@ public SystemData systemData() { /** * Get the identity property: Managed service identity (system assigned and/or user assigned identities). - * + * * @return the identity value. */ public ManagedServiceIdentity identity() { @@ -111,7 +128,7 @@ public ManagedServiceIdentity identity() { /** * Set the identity property: Managed service identity (system assigned and/or user assigned identities). - * + * * @param identity the identity value to set. * @return the MapsAccountInner object itself. */ @@ -122,7 +139,7 @@ public MapsAccountInner withIdentity(ManagedServiceIdentity identity) { /** * Get the properties property: The map account properties. - * + * * @return the properties value. */ public MapsAccountProperties properties() { @@ -131,7 +148,7 @@ public MapsAccountProperties properties() { /** * Set the properties property: The map account properties. - * + * * @param properties the properties value to set. * @return the MapsAccountInner object itself. */ @@ -140,14 +157,48 @@ public MapsAccountInner withProperties(MapsAccountProperties properties) { return this; } - /** {@inheritDoc} */ + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ @Override public MapsAccountInner withLocation(String location) { super.withLocation(location); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public MapsAccountInner withTags(Map tags) { super.withTags(tags); @@ -156,13 +207,13 @@ public MapsAccountInner withTags(Map tags) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (sku() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property sku in model MapsAccountInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property sku in model MapsAccountInner")); } else { sku().validate(); } @@ -175,4 +226,65 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(MapsAccountInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MapsAccountInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MapsAccountInner 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 MapsAccountInner. + */ + public static MapsAccountInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MapsAccountInner deserializedMapsAccountInner = new MapsAccountInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMapsAccountInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMapsAccountInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMapsAccountInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedMapsAccountInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMapsAccountInner.withTags(tags); + } else if ("sku".equals(fieldName)) { + deserializedMapsAccountInner.sku = Sku.fromJson(reader); + } else if ("kind".equals(fieldName)) { + deserializedMapsAccountInner.kind = Kind.fromString(reader.getString()); + } else if ("systemData".equals(fieldName)) { + deserializedMapsAccountInner.systemData = SystemData.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedMapsAccountInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedMapsAccountInner.properties = MapsAccountProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMapsAccountInner; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountKeysInner.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountKeysInner.java index f29a3b7dbe0c..65e5ceadbf8a 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountKeysInner.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountKeysInner.java @@ -5,45 +5,47 @@ package com.azure.resourcemanager.maps.fluent.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * The set of keys which can be used to access the Maps REST APIs. Two keys are provided for key rotation without * interruption. */ @Immutable -public final class MapsAccountKeysInner { +public final class MapsAccountKeysInner implements JsonSerializable { /* * The last updated date and time of the primary key. */ - @JsonProperty(value = "primaryKeyLastUpdated", access = JsonProperty.Access.WRITE_ONLY) private String primaryKeyLastUpdated; /* * The primary key for accessing the Maps REST APIs. */ - @JsonProperty(value = "primaryKey", access = JsonProperty.Access.WRITE_ONLY) private String primaryKey; /* * The secondary key for accessing the Maps REST APIs. */ - @JsonProperty(value = "secondaryKey", access = JsonProperty.Access.WRITE_ONLY) private String secondaryKey; /* * The last updated date and time of the secondary key. */ - @JsonProperty(value = "secondaryKeyLastUpdated", access = JsonProperty.Access.WRITE_ONLY) private String secondaryKeyLastUpdated; - /** Creates an instance of MapsAccountKeysInner class. */ + /** + * Creates an instance of MapsAccountKeysInner class. + */ public MapsAccountKeysInner() { } /** * Get the primaryKeyLastUpdated property: The last updated date and time of the primary key. - * + * * @return the primaryKeyLastUpdated value. */ public String primaryKeyLastUpdated() { @@ -52,7 +54,7 @@ public String primaryKeyLastUpdated() { /** * Get the primaryKey property: The primary key for accessing the Maps REST APIs. - * + * * @return the primaryKey value. */ public String primaryKey() { @@ -61,7 +63,7 @@ public String primaryKey() { /** * Get the secondaryKey property: The secondary key for accessing the Maps REST APIs. - * + * * @return the secondaryKey value. */ public String secondaryKey() { @@ -70,7 +72,7 @@ public String secondaryKey() { /** * Get the secondaryKeyLastUpdated property: The last updated date and time of the secondary key. - * + * * @return the secondaryKeyLastUpdated value. */ public String secondaryKeyLastUpdated() { @@ -79,9 +81,50 @@ public String secondaryKeyLastUpdated() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MapsAccountKeysInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MapsAccountKeysInner 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 MapsAccountKeysInner. + */ + public static MapsAccountKeysInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MapsAccountKeysInner deserializedMapsAccountKeysInner = new MapsAccountKeysInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("primaryKeyLastUpdated".equals(fieldName)) { + deserializedMapsAccountKeysInner.primaryKeyLastUpdated = reader.getString(); + } else if ("primaryKey".equals(fieldName)) { + deserializedMapsAccountKeysInner.primaryKey = reader.getString(); + } else if ("secondaryKey".equals(fieldName)) { + deserializedMapsAccountKeysInner.secondaryKey = reader.getString(); + } else if ("secondaryKeyLastUpdated".equals(fieldName)) { + deserializedMapsAccountKeysInner.secondaryKeyLastUpdated = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMapsAccountKeysInner; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountProperties.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountProperties.java index e41d0c37bd70..b91186c677d8 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountProperties.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountProperties.java @@ -5,33 +5,36 @@ package com.azure.resourcemanager.maps.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.maps.models.CorsRules; import com.azure.resourcemanager.maps.models.Encryption; import com.azure.resourcemanager.maps.models.LinkedResource; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** Additional Map account properties. */ +/** + * Additional Map account properties. + */ @Fluent -public final class MapsAccountProperties { +public final class MapsAccountProperties implements JsonSerializable { /* * A unique identifier for the maps account */ - @JsonProperty(value = "uniqueId", access = JsonProperty.Access.WRITE_ONLY) private String uniqueId; /* - * Allows toggle functionality on Azure Policy to disable Azure Maps local authentication support. This will - * disable Shared Keys and Shared Access Signature Token authentication from any usage. + * Allows toggle functionality on Azure Policy to disable Azure Maps local authentication support. This will disable + * Shared Keys and Shared Access Signature Token authentication from any usage. */ - @JsonProperty(value = "disableLocalAuth") private Boolean disableLocalAuth; /* * The provisioning state of the Map account resource, Account updates can only be performed on terminal states. * Terminal states: `Succeeded` and `Failed` */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private String provisioningState; /* @@ -40,31 +43,30 @@ public final class MapsAccountProperties { * Azure Maps REST API. Access is controlled by the Map Account Managed Identity(s) permissions to those * resource(s). */ - @JsonProperty(value = "linkedResources") private List linkedResources; /* * Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in the request. If no - * CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled - * for the Blob service. + * CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS will be disabled for + * the Blob service. */ - @JsonProperty(value = "cors") private CorsRules cors; /* * (Optional) Discouraged to include in resource definition. Only needed where it is possible to disable platform * (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are enabled and disabled. */ - @JsonProperty(value = "encryption") private Encryption encryption; - /** Creates an instance of MapsAccountProperties class. */ + /** + * Creates an instance of MapsAccountProperties class. + */ public MapsAccountProperties() { } /** * Get the uniqueId property: A unique identifier for the maps account. - * + * * @return the uniqueId value. */ public String uniqueId() { @@ -75,7 +77,7 @@ public String uniqueId() { * Get the disableLocalAuth property: Allows toggle functionality on Azure Policy to disable Azure Maps local * authentication support. This will disable Shared Keys and Shared Access Signature Token authentication from any * usage. - * + * * @return the disableLocalAuth value. */ public Boolean disableLocalAuth() { @@ -86,7 +88,7 @@ public Boolean disableLocalAuth() { * Set the disableLocalAuth property: Allows toggle functionality on Azure Policy to disable Azure Maps local * authentication support. This will disable Shared Keys and Shared Access Signature Token authentication from any * usage. - * + * * @param disableLocalAuth the disableLocalAuth value to set. * @return the MapsAccountProperties object itself. */ @@ -98,7 +100,7 @@ public MapsAccountProperties withDisableLocalAuth(Boolean disableLocalAuth) { /** * Get the provisioningState property: The provisioning state of the Map account resource, Account updates can only * be performed on terminal states. Terminal states: `Succeeded` and `Failed`. - * + * * @return the provisioningState value. */ public String provisioningState() { @@ -110,7 +112,7 @@ public String provisioningState() { * array cannot individually update, you must update all linked resources in the array together. These resources may * be used on operations on the Azure Maps REST API. Access is controlled by the Map Account Managed Identity(s) * permissions to those resource(s). - * + * * @return the linkedResources value. */ public List linkedResources() { @@ -122,7 +124,7 @@ public List linkedResources() { * array cannot individually update, you must update all linked resources in the array together. These resources may * be used on operations on the Azure Maps REST API. Access is controlled by the Map Account Managed Identity(s) * permissions to those resource(s). - * + * * @param linkedResources the linkedResources value to set. * @return the MapsAccountProperties object itself. */ @@ -135,7 +137,7 @@ public MapsAccountProperties withLinkedResources(List linkedReso * Get the cors property: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in * the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS * will be disabled for the Blob service. - * + * * @return the cors value. */ public CorsRules cors() { @@ -146,7 +148,7 @@ public CorsRules cors() { * Set the cors property: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in * the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS * will be disabled for the Blob service. - * + * * @param cors the cors value to set. * @return the MapsAccountProperties object itself. */ @@ -159,7 +161,7 @@ public MapsAccountProperties withCors(CorsRules cors) { * Get the encryption property: (Optional) Discouraged to include in resource definition. Only needed where it is * possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are * enabled and disabled. - * + * * @return the encryption value. */ public Encryption encryption() { @@ -170,7 +172,7 @@ public Encryption encryption() { * Set the encryption property: (Optional) Discouraged to include in resource definition. Only needed where it is * possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are * enabled and disabled. - * + * * @param encryption the encryption value to set. * @return the MapsAccountProperties object itself. */ @@ -181,7 +183,7 @@ public MapsAccountProperties withEncryption(Encryption encryption) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -195,4 +197,56 @@ public void validate() { encryption().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("disableLocalAuth", this.disableLocalAuth); + jsonWriter.writeArrayField("linkedResources", this.linkedResources, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("cors", this.cors); + jsonWriter.writeJsonField("encryption", this.encryption); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MapsAccountProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MapsAccountProperties 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 MapsAccountProperties. + */ + public static MapsAccountProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MapsAccountProperties deserializedMapsAccountProperties = new MapsAccountProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("uniqueId".equals(fieldName)) { + deserializedMapsAccountProperties.uniqueId = reader.getString(); + } else if ("disableLocalAuth".equals(fieldName)) { + deserializedMapsAccountProperties.disableLocalAuth = reader.getNullable(JsonReader::getBoolean); + } else if ("provisioningState".equals(fieldName)) { + deserializedMapsAccountProperties.provisioningState = reader.getString(); + } else if ("linkedResources".equals(fieldName)) { + List linkedResources + = reader.readArray(reader1 -> LinkedResource.fromJson(reader1)); + deserializedMapsAccountProperties.linkedResources = linkedResources; + } else if ("cors".equals(fieldName)) { + deserializedMapsAccountProperties.cors = CorsRules.fromJson(reader); + } else if ("encryption".equals(fieldName)) { + deserializedMapsAccountProperties.encryption = Encryption.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMapsAccountProperties; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountSasTokenInner.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountSasTokenInner.java index fd996172f214..1dffca2d916b 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountSasTokenInner.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/MapsAccountSasTokenInner.java @@ -5,27 +5,32 @@ package com.azure.resourcemanager.maps.fluent.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * A new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed identity * permissions on Azure (IAM) Role Based Access Control. */ @Immutable -public final class MapsAccountSasTokenInner { +public final class MapsAccountSasTokenInner implements JsonSerializable { /* * The shared access signature access token. */ - @JsonProperty(value = "accountSasToken", access = JsonProperty.Access.WRITE_ONLY) private String accountSasToken; - /** Creates an instance of MapsAccountSasTokenInner class. */ + /** + * Creates an instance of MapsAccountSasTokenInner class. + */ public MapsAccountSasTokenInner() { } /** * Get the accountSasToken property: The shared access signature access token. - * + * * @return the accountSasToken value. */ public String accountSasToken() { @@ -34,9 +39,44 @@ public String accountSasToken() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MapsAccountSasTokenInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MapsAccountSasTokenInner 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 MapsAccountSasTokenInner. + */ + public static MapsAccountSasTokenInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MapsAccountSasTokenInner deserializedMapsAccountSasTokenInner = new MapsAccountSasTokenInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("accountSasToken".equals(fieldName)) { + deserializedMapsAccountSasTokenInner.accountSasToken = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMapsAccountSasTokenInner; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/OperationDetailInner.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/OperationDetailInner.java index b6c2d845fff7..8e4af2c54a74 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/OperationDetailInner.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/OperationDetailInner.java @@ -5,50 +5,53 @@ package com.azure.resourcemanager.maps.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.maps.models.OperationDisplay; import com.azure.resourcemanager.maps.models.ServiceSpecification; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; -/** Operation detail payload. */ +/** + * Operation detail payload. + */ @Fluent -public final class OperationDetailInner { +public final class OperationDetailInner implements JsonSerializable { /* * Name of the operation */ - @JsonProperty(value = "name") private String name; /* * Indicates whether the operation is a data action */ - @JsonProperty(value = "isDataAction") private Boolean isDataAction; /* * Display of the operation */ - @JsonProperty(value = "display") private OperationDisplay display; /* * Origin of the operation */ - @JsonProperty(value = "origin") private String origin; /* * Properties of the operation */ - @JsonProperty(value = "properties") private OperationProperties innerProperties; - /** Creates an instance of OperationDetailInner class. */ + /** + * Creates an instance of OperationDetailInner class. + */ public OperationDetailInner() { } /** * Get the name property: Name of the operation. - * + * * @return the name value. */ public String name() { @@ -57,7 +60,7 @@ public String name() { /** * Set the name property: Name of the operation. - * + * * @param name the name value to set. * @return the OperationDetailInner object itself. */ @@ -68,7 +71,7 @@ public OperationDetailInner withName(String name) { /** * Get the isDataAction property: Indicates whether the operation is a data action. - * + * * @return the isDataAction value. */ public Boolean isDataAction() { @@ -77,7 +80,7 @@ public Boolean isDataAction() { /** * Set the isDataAction property: Indicates whether the operation is a data action. - * + * * @param isDataAction the isDataAction value to set. * @return the OperationDetailInner object itself. */ @@ -88,7 +91,7 @@ public OperationDetailInner withIsDataAction(Boolean isDataAction) { /** * Get the display property: Display of the operation. - * + * * @return the display value. */ public OperationDisplay display() { @@ -97,7 +100,7 @@ public OperationDisplay display() { /** * Set the display property: Display of the operation. - * + * * @param display the display value to set. * @return the OperationDetailInner object itself. */ @@ -108,7 +111,7 @@ public OperationDetailInner withDisplay(OperationDisplay display) { /** * Get the origin property: Origin of the operation. - * + * * @return the origin value. */ public String origin() { @@ -117,7 +120,7 @@ public String origin() { /** * Set the origin property: Origin of the operation. - * + * * @param origin the origin value to set. * @return the OperationDetailInner object itself. */ @@ -128,7 +131,7 @@ public OperationDetailInner withOrigin(String origin) { /** * Get the innerProperties property: Properties of the operation. - * + * * @return the innerProperties value. */ private OperationProperties innerProperties() { @@ -137,7 +140,7 @@ private OperationProperties innerProperties() { /** * Get the serviceSpecification property: One property of operation, include metric specifications. - * + * * @return the serviceSpecification value. */ public ServiceSpecification serviceSpecification() { @@ -146,7 +149,7 @@ public ServiceSpecification serviceSpecification() { /** * Set the serviceSpecification property: One property of operation, include metric specifications. - * + * * @param serviceSpecification the serviceSpecification value to set. * @return the OperationDetailInner object itself. */ @@ -160,7 +163,7 @@ public OperationDetailInner withServiceSpecification(ServiceSpecification servic /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -171,4 +174,52 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeBooleanField("isDataAction", this.isDataAction); + jsonWriter.writeJsonField("display", this.display); + jsonWriter.writeStringField("origin", this.origin); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDetailInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDetailInner 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 OperationDetailInner. + */ + public static OperationDetailInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDetailInner deserializedOperationDetailInner = new OperationDetailInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationDetailInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationDetailInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationDetailInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationDetailInner.origin = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedOperationDetailInner.innerProperties = OperationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDetailInner; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/OperationProperties.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/OperationProperties.java index 44e669bbc6ac..5dd4b2610ee5 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/OperationProperties.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/OperationProperties.java @@ -5,25 +5,32 @@ package com.azure.resourcemanager.maps.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.maps.models.ServiceSpecification; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; -/** Properties of operation, include metric specifications. */ +/** + * Properties of operation, include metric specifications. + */ @Fluent -public final class OperationProperties { +public final class OperationProperties implements JsonSerializable { /* * One property of operation, include metric specifications. */ - @JsonProperty(value = "serviceSpecification") private ServiceSpecification serviceSpecification; - /** Creates an instance of OperationProperties class. */ + /** + * Creates an instance of OperationProperties class. + */ public OperationProperties() { } /** * Get the serviceSpecification property: One property of operation, include metric specifications. - * + * * @return the serviceSpecification value. */ public ServiceSpecification serviceSpecification() { @@ -32,7 +39,7 @@ public ServiceSpecification serviceSpecification() { /** * Set the serviceSpecification property: One property of operation, include metric specifications. - * + * * @param serviceSpecification the serviceSpecification value to set. * @return the OperationProperties object itself. */ @@ -43,7 +50,7 @@ public OperationProperties withServiceSpecification(ServiceSpecification service /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -51,4 +58,40 @@ public void validate() { serviceSpecification().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("serviceSpecification", this.serviceSpecification); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationProperties 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 OperationProperties. + */ + public static OperationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationProperties deserializedOperationProperties = new OperationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceSpecification".equals(fieldName)) { + deserializedOperationProperties.serviceSpecification = ServiceSpecification.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationProperties; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/package-info.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/package-info.java index 39562128a8d4..3eba93c76259 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/package-info.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/models/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the inner data models for AzureMapsManagementClient. Azure Maps. */ +/** + * Package containing the inner data models for AzureMapsManagementClient. + * Azure Maps. + */ package com.azure.resourcemanager.maps.fluent.models; diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/package-info.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/package-info.java index fa3d0cfe03ff..343c3b383b75 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/package-info.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/fluent/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the service clients for AzureMapsManagementClient. Azure Maps. */ +/** + * Package containing the service clients for AzureMapsManagementClient. + * Azure Maps. + */ package com.azure.resourcemanager.maps.fluent; diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AccountsClientImpl.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AccountsClientImpl.java index 1c7df5bec573..291f8ccdff49 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AccountsClientImpl.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AccountsClientImpl.java @@ -40,17 +40,23 @@ import com.azure.resourcemanager.maps.models.MapsKeySpecification; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in AccountsClient. */ +/** + * An instance of this class provides access to all the operations defined in AccountsClient. + */ public final class AccountsClientImpl implements AccountsClient { - /** The proxy service used to perform REST calls. */ + /** + * The proxy service used to perform REST calls. + */ private final AccountsService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final AzureMapsManagementClientImpl client; /** * Initializes an instance of AccountsClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ AccountsClientImpl(AzureMapsManagementClientImpl client) { @@ -168,7 +174,7 @@ Mono> listBySubscriptionNext( /** * Create or update a Maps Account. A Maps Account holds the keys which allow access to the Maps REST APIs. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccount The new or updated parameters for the Maps Account. @@ -176,7 +182,7 @@ Mono> listBySubscriptionNext( * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents access to a suite of Maps REST APIs along with {@link Response} on - * successful completion of {@link Mono}. + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, @@ -210,7 +216,7 @@ private Mono> createOrUpdateWithResponseAsync(String /** * Create or update a Maps Account. A Maps Account holds the keys which allow access to the Maps REST APIs. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccount The new or updated parameters for the Maps Account. @@ -219,7 +225,7 @@ private Mono> createOrUpdateWithResponseAsync(String * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents access to a suite of Maps REST APIs along with {@link Response} on - * successful completion of {@link Mono}. + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, @@ -252,15 +258,15 @@ private Mono> createOrUpdateWithResponseAsync(String /** * Create or update a Maps Account. A Maps Account holds the keys which allow access to the Maps REST APIs. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccount The new or updated parameters for the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an Azure resource which represents access to a suite of Maps REST APIs on successful completion of {@link - * Mono}. + * @return an Azure resource which represents access to a suite of Maps REST APIs on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync(String resourceGroupName, String accountName, @@ -271,7 +277,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, Str /** * Create or update a Maps Account. A Maps Account holds the keys which allow access to the Maps REST APIs. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccount The new or updated parameters for the Maps Account. @@ -289,7 +295,7 @@ public Response createOrUpdateWithResponse(String resourceGrou /** * Create or update a Maps Account. A Maps Account holds the keys which allow access to the Maps REST APIs. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccount The new or updated parameters for the Maps Account. @@ -306,7 +312,7 @@ public MapsAccountInner createOrUpdate(String resourceGroupName, String accountN /** * Updates a Maps Account. Only a subset of the parameters may be updated after creation, such as Sku, Tags, * Properties. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountUpdateParameters The updated parameters for the Maps Account. @@ -314,7 +320,7 @@ public MapsAccountInner createOrUpdate(String resourceGroupName, String accountN * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents access to a suite of Maps REST APIs along with {@link Response} on - * successful completion of {@link Mono}. + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> updateWithResponseAsync(String resourceGroupName, String accountName, @@ -351,7 +357,7 @@ private Mono> updateWithResponseAsync(String resource /** * Updates a Maps Account. Only a subset of the parameters may be updated after creation, such as Sku, Tags, * Properties. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountUpdateParameters The updated parameters for the Maps Account. @@ -360,7 +366,7 @@ private Mono> updateWithResponseAsync(String resource * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents access to a suite of Maps REST APIs along with {@link Response} on - * successful completion of {@link Mono}. + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> updateWithResponseAsync(String resourceGroupName, String accountName, @@ -395,15 +401,15 @@ private Mono> updateWithResponseAsync(String resource /** * Updates a Maps Account. Only a subset of the parameters may be updated after creation, such as Sku, Tags, * Properties. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountUpdateParameters The updated parameters for the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return an Azure resource which represents access to a suite of Maps REST APIs on successful completion of {@link - * Mono}. + * @return an Azure resource which represents access to a suite of Maps REST APIs on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync(String resourceGroupName, String accountName, @@ -415,7 +421,7 @@ private Mono updateAsync(String resourceGroupName, String acco /** * Updates a Maps Account. Only a subset of the parameters may be updated after creation, such as Sku, Tags, * Properties. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountUpdateParameters The updated parameters for the Maps Account. @@ -434,7 +440,7 @@ public Response updateWithResponse(String resourceGroupName, S /** * Updates a Maps Account. Only a subset of the parameters may be updated after creation, such as Sku, Tags, * Properties. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountUpdateParameters The updated parameters for the Maps Account. @@ -451,7 +457,7 @@ public MapsAccountInner update(String resourceGroupName, String accountName, /** * Delete a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -485,7 +491,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S /** * Delete a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -520,7 +526,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S /** * Delete a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -535,7 +541,7 @@ private Mono deleteAsync(String resourceGroupName, String accountName) { /** * Delete a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -551,7 +557,7 @@ public Response deleteWithResponse(String resourceGroupName, String accoun /** * Delete a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -565,7 +571,7 @@ public void delete(String resourceGroupName, String accountName) { /** * Get a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -600,7 +606,7 @@ private Mono> getByResourceGroupWithResponseAsync(Str /** * Get a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -635,7 +641,7 @@ private Mono> getByResourceGroupWithResponseAsync(Str /** * Get a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -651,7 +657,7 @@ private Mono getByResourceGroupAsync(String resourceGroupName, /** * Get a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -668,7 +674,7 @@ public Response getByResourceGroupWithResponse(String resource /** * Get a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -683,13 +689,13 @@ public MapsAccountInner getByResourceGroup(String resourceGroupName, String acco /** * Get all Maps Accounts in a Resource Group. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all Maps Accounts in a Resource Group along with {@link PagedResponse} on successful completion of {@link - * Mono}. + * @return all Maps Accounts in a Resource Group along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { @@ -716,14 +722,14 @@ private Mono> listByResourceGroupSinglePageAsync /** * Get all Maps Accounts in a Resource Group. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all Maps Accounts in a Resource Group along with {@link PagedResponse} on successful completion of {@link - * Mono}. + * @return all Maps Accounts in a Resource Group along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, @@ -751,7 +757,7 @@ private Mono> listByResourceGroupSinglePageAsync /** * Get all Maps Accounts in a Resource Group. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -766,7 +772,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGrou /** * Get all Maps Accounts in a Resource Group. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -782,7 +788,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGrou /** * Get all Maps Accounts in a Resource Group. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -796,7 +802,7 @@ public PagedIterable listByResourceGroup(String resourceGroupN /** * Get all Maps Accounts in a Resource Group. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -811,11 +817,11 @@ public PagedIterable listByResourceGroup(String resourceGroupN /** * Get all Maps Accounts in a Subscription. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all Maps Accounts in a Subscription along with {@link PagedResponse} on successful completion of {@link - * Mono}. + * @return all Maps Accounts in a Subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { @@ -838,13 +844,13 @@ private Mono> listSinglePageAsync() { /** * Get all Maps Accounts in a Subscription. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return all Maps Accounts in a Subscription along with {@link PagedResponse} on successful completion of {@link - * Mono}. + * @return all Maps Accounts in a Subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(Context context) { @@ -867,7 +873,7 @@ private Mono> listSinglePageAsync(Context contex /** * Get all Maps Accounts in a Subscription. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all Maps Accounts in a Subscription as paginated response with {@link PagedFlux}. @@ -880,7 +886,7 @@ private PagedFlux listAsync() { /** * Get all Maps Accounts in a Subscription. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -895,7 +901,7 @@ private PagedFlux listAsync(Context context) { /** * Get all Maps Accounts in a Subscription. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all Maps Accounts in a Subscription as paginated response with {@link PagedIterable}. @@ -907,7 +913,7 @@ public PagedIterable list() { /** * Get all Maps Accounts in a Subscription. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -922,11 +928,12 @@ public PagedIterable list(Context context) { /** * Create and list an account shared access signature token. Use this SAS token for authentication to Azure Maps * REST APIs through various Azure Maps SDKs. As prerequisite to create a SAS Token. - * - *

Prerequisites: 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the - * account. 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed - * Identity is placed. - * + * + * Prerequisites: + * 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the account. + * 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed Identity is + * placed. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountSasParameters The updated parameters for the Maps Account. @@ -934,8 +941,8 @@ public PagedIterable list(Context context) { * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed - * identity permissions on Azure (IAM) Role Based Access Control along with {@link Response} on successful - * completion of {@link Mono}. + * identity permissions on Azure (IAM) Role Based Access Control along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSasWithResponseAsync(String resourceGroupName, @@ -970,11 +977,12 @@ private Mono> listSasWithResponseAsync(String /** * Create and list an account shared access signature token. Use this SAS token for authentication to Azure Maps * REST APIs through various Azure Maps SDKs. As prerequisite to create a SAS Token. - * - *

Prerequisites: 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the - * account. 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed - * Identity is placed. - * + * + * Prerequisites: + * 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the account. + * 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed Identity is + * placed. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountSasParameters The updated parameters for the Maps Account. @@ -983,8 +991,8 @@ private Mono> listSasWithResponseAsync(String * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed - * identity permissions on Azure (IAM) Role Based Access Control along with {@link Response} on successful - * completion of {@link Mono}. + * identity permissions on Azure (IAM) Role Based Access Control along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSasWithResponseAsync(String resourceGroupName, @@ -1019,11 +1027,12 @@ private Mono> listSasWithResponseAsync(String /** * Create and list an account shared access signature token. Use this SAS token for authentication to Azure Maps * REST APIs through various Azure Maps SDKs. As prerequisite to create a SAS Token. - * - *

Prerequisites: 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the - * account. 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed - * Identity is placed. - * + * + * Prerequisites: + * 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the account. + * 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed Identity is + * placed. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountSasParameters The updated parameters for the Maps Account. @@ -1031,7 +1040,7 @@ private Mono> listSasWithResponseAsync(String * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed - * identity permissions on Azure (IAM) Role Based Access Control on successful completion of {@link Mono}. + * identity permissions on Azure (IAM) Role Based Access Control on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono listSasAsync(String resourceGroupName, String accountName, @@ -1043,11 +1052,12 @@ private Mono listSasAsync(String resourceGroupName, St /** * Create and list an account shared access signature token. Use this SAS token for authentication to Azure Maps * REST APIs through various Azure Maps SDKs. As prerequisite to create a SAS Token. - * - *

Prerequisites: 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the - * account. 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed - * Identity is placed. - * + * + * Prerequisites: + * 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the account. + * 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed Identity is + * placed. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountSasParameters The updated parameters for the Maps Account. @@ -1056,7 +1066,7 @@ private Mono listSasAsync(String resourceGroupName, St * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed - * identity permissions on Azure (IAM) Role Based Access Control along with {@link Response}. + * identity permissions on Azure (IAM) Role Based Access Control along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response listSasWithResponse(String resourceGroupName, String accountName, @@ -1067,11 +1077,12 @@ public Response listSasWithResponse(String resourceGro /** * Create and list an account shared access signature token. Use this SAS token for authentication to Azure Maps * REST APIs through various Azure Maps SDKs. As prerequisite to create a SAS Token. - * - *

Prerequisites: 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the - * account. 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed - * Identity is placed. - * + * + * Prerequisites: + * 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the account. + * 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed Identity is + * placed. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountSasParameters The updated parameters for the Maps Account. @@ -1079,7 +1090,7 @@ public Response listSasWithResponse(String resourceGro * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed - * identity permissions on Azure (IAM) Role Based Access Control. + * identity permissions on Azure (IAM) Role Based Access Control. */ @ServiceMethod(returns = ReturnType.SINGLE) public MapsAccountSasTokenInner listSas(String resourceGroupName, String accountName, @@ -1090,7 +1101,7 @@ public MapsAccountSasTokenInner listSas(String resourceGroupName, String account /** * Get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to the Maps REST APIs. * Only one key is needed at a time; two are given to provide seamless key regeneration. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1126,7 +1137,7 @@ private Mono> listKeysWithResponseAsync(String re /** * Get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to the Maps REST APIs. * Only one key is needed at a time; two are given to provide seamless key regeneration. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -1162,7 +1173,7 @@ private Mono> listKeysWithResponseAsync(String re /** * Get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to the Maps REST APIs. * Only one key is needed at a time; two are given to provide seamless key regeneration. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1179,7 +1190,7 @@ private Mono listKeysAsync(String resourceGroupName, Strin /** * Get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to the Maps REST APIs. * Only one key is needed at a time; two are given to provide seamless key regeneration. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -1197,7 +1208,7 @@ public Response listKeysWithResponse(String resourceGroupN /** * Get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to the Maps REST APIs. * Only one key is needed at a time; two are given to provide seamless key regeneration. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -1213,7 +1224,7 @@ public MapsAccountKeysInner listKeys(String resourceGroupName, String accountNam /** * Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working * immediately. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param keySpecification Which key to regenerate: primary or secondary. @@ -1221,7 +1232,7 @@ public MapsAccountKeysInner listKeys(String resourceGroupName, String accountNam * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of keys which can be used to access the Maps REST APIs along with {@link Response} on successful - * completion of {@link Mono}. + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> regenerateKeysWithResponseAsync(String resourceGroupName, @@ -1257,7 +1268,7 @@ private Mono> regenerateKeysWithResponseAsync(Str /** * Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working * immediately. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param keySpecification Which key to regenerate: primary or secondary. @@ -1266,7 +1277,7 @@ private Mono> regenerateKeysWithResponseAsync(Str * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of keys which can be used to access the Maps REST APIs along with {@link Response} on successful - * completion of {@link Mono}. + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> regenerateKeysWithResponseAsync(String resourceGroupName, @@ -1301,7 +1312,7 @@ private Mono> regenerateKeysWithResponseAsync(Str /** * Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working * immediately. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param keySpecification Which key to regenerate: primary or secondary. @@ -1320,7 +1331,7 @@ private Mono regenerateKeysAsync(String resourceGroupName, /** * Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working * immediately. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param keySpecification Which key to regenerate: primary or secondary. @@ -1339,7 +1350,7 @@ public Response regenerateKeysWithResponse(String resource /** * Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working * immediately. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param keySpecification Which key to regenerate: primary or secondary. @@ -1356,9 +1367,8 @@ public MapsAccountKeysInner regenerateKeys(String resourceGroupName, String acco /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1384,9 +1394,8 @@ private Mono> listByResourceGroupNextSinglePageA /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1412,9 +1421,8 @@ private Mono> listByResourceGroupNextSinglePageA /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -1440,9 +1448,8 @@ private Mono> listBySubscriptionNextSinglePageAs /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AccountsImpl.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AccountsImpl.java index 5037f572effe..e7ae421af8f1 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AccountsImpl.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AccountsImpl.java @@ -64,22 +64,22 @@ public MapsAccount getByResourceGroup(String resourceGroupName, String accountNa public PagedIterable listByResourceGroup(String resourceGroupName) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return Utils.mapPage(inner, inner1 -> new MapsAccountImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MapsAccountImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return Utils.mapPage(inner, inner1 -> new MapsAccountImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MapsAccountImpl(inner1, this.manager())); } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return Utils.mapPage(inner, inner1 -> new MapsAccountImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MapsAccountImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return Utils.mapPage(inner, inner1 -> new MapsAccountImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MapsAccountImpl(inner1, this.manager())); } public Response listSasWithResponse(String resourceGroupName, String accountName, @@ -150,12 +150,12 @@ public MapsAccountKeys regenerateKeys(String resourceGroupName, String accountNa } public MapsAccount getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String accountName = Utils.getValueFromIdByName(id, "accounts"); + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); if (accountName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); @@ -164,12 +164,12 @@ public MapsAccount getById(String id) { } public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String accountName = Utils.getValueFromIdByName(id, "accounts"); + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); if (accountName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); @@ -178,12 +178,12 @@ public Response getByIdWithResponse(String id, Context context) { } public void deleteById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String accountName = Utils.getValueFromIdByName(id, "accounts"); + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); if (accountName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); @@ -192,12 +192,12 @@ public void deleteById(String id) { } public Response deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String accountName = Utils.getValueFromIdByName(id, "accounts"); + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); if (accountName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AzureMapsManagementClientBuilder.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AzureMapsManagementClientBuilder.java index ef9ee6ae21f6..ab3b9a0b0f1f 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AzureMapsManagementClientBuilder.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AzureMapsManagementClientBuilder.java @@ -14,7 +14,9 @@ import com.azure.core.util.serializer.SerializerAdapter; import java.time.Duration; -/** A builder for creating a new instance of the AzureMapsManagementClientImpl type. */ +/** + * A builder for creating a new instance of the AzureMapsManagementClientImpl type. + */ @ServiceClientBuilder(serviceClients = { AzureMapsManagementClientImpl.class }) public final class AzureMapsManagementClientBuilder { /* @@ -24,7 +26,7 @@ public final class AzureMapsManagementClientBuilder { /** * Sets The ID of the target subscription. - * + * * @param subscriptionId the subscriptionId value. * @return the AzureMapsManagementClientBuilder. */ @@ -40,7 +42,7 @@ public AzureMapsManagementClientBuilder subscriptionId(String subscriptionId) { /** * Sets server parameter. - * + * * @param endpoint the endpoint value. * @return the AzureMapsManagementClientBuilder. */ @@ -56,7 +58,7 @@ public AzureMapsManagementClientBuilder endpoint(String endpoint) { /** * Sets The environment to connect to. - * + * * @param environment the environment value. * @return the AzureMapsManagementClientBuilder. */ @@ -72,7 +74,7 @@ public AzureMapsManagementClientBuilder environment(AzureEnvironment environment /** * Sets The HTTP pipeline to send requests through. - * + * * @param pipeline the pipeline value. * @return the AzureMapsManagementClientBuilder. */ @@ -88,7 +90,7 @@ public AzureMapsManagementClientBuilder pipeline(HttpPipeline pipeline) { /** * Sets The default poll interval for long-running operation. - * + * * @param defaultPollInterval the defaultPollInterval value. * @return the AzureMapsManagementClientBuilder. */ @@ -104,7 +106,7 @@ public AzureMapsManagementClientBuilder defaultPollInterval(Duration defaultPoll /** * Sets The serializer to serialize an object into a string. - * + * * @param serializerAdapter the serializerAdapter value. * @return the AzureMapsManagementClientBuilder. */ @@ -115,7 +117,7 @@ public AzureMapsManagementClientBuilder serializerAdapter(SerializerAdapter seri /** * Builds an instance of AzureMapsManagementClientImpl with the provided parameters. - * + * * @return an instance of AzureMapsManagementClientImpl. */ public AzureMapsManagementClientImpl buildClient() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AzureMapsManagementClientImpl.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AzureMapsManagementClientImpl.java index 914b508cd056..ec1ce296780e 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AzureMapsManagementClientImpl.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/AzureMapsManagementClientImpl.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.maps.implementation; import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpResponse; @@ -35,111 +36,131 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** Initializes a new instance of the AzureMapsManagementClientImpl type. */ +/** + * Initializes a new instance of the AzureMapsManagementClientImpl type. + */ @ServiceClient(builder = AzureMapsManagementClientBuilder.class) public final class AzureMapsManagementClientImpl implements AzureMapsManagementClient { - /** The ID of the target subscription. */ + /** + * The ID of the target subscription. + */ private final String subscriptionId; /** * Gets The ID of the target subscription. - * + * * @return the subscriptionId value. */ public String getSubscriptionId() { return this.subscriptionId; } - /** server parameter. */ + /** + * server parameter. + */ private final String endpoint; /** * Gets server parameter. - * + * * @return the endpoint value. */ public String getEndpoint() { return this.endpoint; } - /** Api Version. */ + /** + * Api Version. + */ private final String apiVersion; /** * Gets Api Version. - * + * * @return the apiVersion value. */ public String getApiVersion() { return this.apiVersion; } - /** The HTTP pipeline to send requests through. */ + /** + * The HTTP pipeline to send requests through. + */ private final HttpPipeline httpPipeline; /** * Gets The HTTP pipeline to send requests through. - * + * * @return the httpPipeline value. */ public HttpPipeline getHttpPipeline() { return this.httpPipeline; } - /** The serializer to serialize an object into a string. */ + /** + * The serializer to serialize an object into a string. + */ private final SerializerAdapter serializerAdapter; /** * Gets The serializer to serialize an object into a string. - * + * * @return the serializerAdapter value. */ SerializerAdapter getSerializerAdapter() { return this.serializerAdapter; } - /** The default poll interval for long-running operation. */ + /** + * The default poll interval for long-running operation. + */ private final Duration defaultPollInterval; /** * Gets The default poll interval for long-running operation. - * + * * @return the defaultPollInterval value. */ public Duration getDefaultPollInterval() { return this.defaultPollInterval; } - /** The AccountsClient object to access its operations. */ + /** + * The AccountsClient object to access its operations. + */ private final AccountsClient accounts; /** * Gets the AccountsClient object to access its operations. - * + * * @return the AccountsClient object. */ public AccountsClient getAccounts() { return this.accounts; } - /** The MapsClient object to access its operations. */ + /** + * The MapsClient object to access its operations. + */ private final MapsClient maps; /** * Gets the MapsClient object to access its operations. - * + * * @return the MapsClient object. */ public MapsClient getMaps() { return this.maps; } - /** The CreatorsClient object to access its operations. */ + /** + * The CreatorsClient object to access its operations. + */ private final CreatorsClient creators; /** * Gets the CreatorsClient object to access its operations. - * + * * @return the CreatorsClient object. */ public CreatorsClient getCreators() { @@ -148,7 +169,7 @@ public CreatorsClient getCreators() { /** * Initializes an instance of AzureMapsManagementClient client. - * + * * @param httpPipeline The HTTP pipeline to send requests through. * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. @@ -171,7 +192,7 @@ public CreatorsClient getCreators() { /** * Gets default client context. - * + * * @return the default client context. */ public Context getContext() { @@ -180,7 +201,7 @@ public Context getContext() { /** * Merges default client context with provided context. - * + * * @param context the context to be merged with default client context. * @return the merged context. */ @@ -190,7 +211,7 @@ public Context mergeContext(Context context) { /** * Gets long running operation result. - * + * * @param activationResponse the response of activation operation. * @param httpPipeline the http pipeline. * @param pollResultType type of poll result. @@ -208,7 +229,7 @@ public PollerFlux, U> getLroResult(Mono type of poll result. * @param type of final result. @@ -271,7 +292,7 @@ public int getStatusCode() { } public String getHeaderValue(String s) { - return httpHeaders.getValue(s); + return httpHeaders.getValue(HttpHeaderName.fromString(s)); } public HttpHeaders getHeaders() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/CreatorImpl.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/CreatorImpl.java index 7576908e57c4..ebb297d5531d 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/CreatorImpl.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/CreatorImpl.java @@ -133,9 +133,9 @@ public Creator apply(Context context) { CreatorImpl(CreatorInner innerObject, com.azure.resourcemanager.maps.AzureMapsManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; - this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.accountName = Utils.getValueFromIdByName(innerObject.id(), "accounts"); - this.creatorName = Utils.getValueFromIdByName(innerObject.id(), "creators"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "accounts"); + this.creatorName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "creators"); } public Creator refresh() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/CreatorsClientImpl.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/CreatorsClientImpl.java index 7542351801ea..7e5d78c8fd33 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/CreatorsClientImpl.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/CreatorsClientImpl.java @@ -35,17 +35,23 @@ import com.azure.resourcemanager.maps.models.CreatorUpdateParameters; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in CreatorsClient. */ +/** + * An instance of this class provides access to all the operations defined in CreatorsClient. + */ public final class CreatorsClientImpl implements CreatorsClient { - /** The proxy service used to perform REST calls. */ + /** + * The proxy service used to perform REST calls. + */ private final CreatorsService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final AzureMapsManagementClientImpl client; /** * Initializes an instance of CreatorsClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ CreatorsClientImpl(AzureMapsManagementClientImpl client) { @@ -118,14 +124,14 @@ Mono> listByAccountNext(@PathParam(value = "nextLink", enc /** * Get all Creator instances for an Azure Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all Creator instances for an Azure Maps Account along with {@link PagedResponse} on successful completion - * of {@link Mono}. + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByAccountSinglePageAsync(String resourceGroupName, @@ -156,7 +162,7 @@ private Mono> listByAccountSinglePageAsync(String re /** * Get all Creator instances for an Azure Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -164,7 +170,7 @@ private Mono> listByAccountSinglePageAsync(String re * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all Creator instances for an Azure Maps Account along with {@link PagedResponse} on successful completion - * of {@link Mono}. + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByAccountSinglePageAsync(String resourceGroupName, String accountName, @@ -195,7 +201,7 @@ private Mono> listByAccountSinglePageAsync(String re /** * Get all Creator instances for an Azure Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -211,7 +217,7 @@ private PagedFlux listByAccountAsync(String resourceGroupName, Str /** * Get all Creator instances for an Azure Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -228,7 +234,7 @@ private PagedFlux listByAccountAsync(String resourceGroupName, Str /** * Get all Creator instances for an Azure Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -243,7 +249,7 @@ public PagedIterable listByAccount(String resourceGroupName, Strin /** * Get all Creator instances for an Azure Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -260,7 +266,7 @@ public PagedIterable listByAccount(String resourceGroupName, Strin /** * Create or update a Maps Creator resource. Creator resource will manage Azure resources required to populate a * custom set of mapping data. It requires an account to exist before it can be created. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -269,7 +275,7 @@ public PagedIterable listByAccount(String resourceGroupName, Strin * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data along with {@link Response} on successful completion of {@link Mono}. + * data along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String accountName, @@ -309,7 +315,7 @@ private Mono> createOrUpdateWithResponseAsync(String reso /** * Create or update a Maps Creator resource. Creator resource will manage Azure resources required to populate a * custom set of mapping data. It requires an account to exist before it can be created. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -319,7 +325,7 @@ private Mono> createOrUpdateWithResponseAsync(String reso * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data along with {@link Response} on successful completion of {@link Mono}. + * data along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, String accountName, @@ -358,7 +364,7 @@ private Mono> createOrUpdateWithResponseAsync(String reso /** * Create or update a Maps Creator resource. Creator resource will manage Azure resources required to populate a * custom set of mapping data. It requires an account to exist before it can be created. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -367,7 +373,7 @@ private Mono> createOrUpdateWithResponseAsync(String reso * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data on successful completion of {@link Mono}. + * data on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync(String resourceGroupName, String accountName, String creatorName, @@ -379,7 +385,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, String /** * Create or update a Maps Creator resource. Creator resource will manage Azure resources required to populate a * custom set of mapping data. It requires an account to exist before it can be created. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -389,7 +395,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, String * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data along with {@link Response}. + * data along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response createOrUpdateWithResponse(String resourceGroupName, String accountName, @@ -401,7 +407,7 @@ public Response createOrUpdateWithResponse(String resourceGroupNam /** * Create or update a Maps Creator resource. Creator resource will manage Azure resources required to populate a * custom set of mapping data. It requires an account to exist before it can be created. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -410,7 +416,7 @@ public Response createOrUpdateWithResponse(String resourceGroupNam * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data. + * data. */ @ServiceMethod(returns = ReturnType.SINGLE) public CreatorInner createOrUpdate(String resourceGroupName, String accountName, String creatorName, @@ -421,7 +427,7 @@ public CreatorInner createOrUpdate(String resourceGroupName, String accountName, /** * Updates the Maps Creator resource. Only a subset of the parameters may be updated after creation, such as Tags. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -430,7 +436,7 @@ public CreatorInner createOrUpdate(String resourceGroupName, String accountName, * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data along with {@link Response} on successful completion of {@link Mono}. + * data along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> updateWithResponseAsync(String resourceGroupName, String accountName, @@ -469,7 +475,7 @@ private Mono> updateWithResponseAsync(String resourceGrou /** * Updates the Maps Creator resource. Only a subset of the parameters may be updated after creation, such as Tags. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -479,7 +485,7 @@ private Mono> updateWithResponseAsync(String resourceGrou * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data along with {@link Response} on successful completion of {@link Mono}. + * data along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> updateWithResponseAsync(String resourceGroupName, String accountName, @@ -516,7 +522,7 @@ private Mono> updateWithResponseAsync(String resourceGrou /** * Updates the Maps Creator resource. Only a subset of the parameters may be updated after creation, such as Tags. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -525,7 +531,7 @@ private Mono> updateWithResponseAsync(String resourceGrou * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data on successful completion of {@link Mono}. + * data on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync(String resourceGroupName, String accountName, String creatorName, @@ -536,7 +542,7 @@ private Mono updateAsync(String resourceGroupName, String accountN /** * Updates the Maps Creator resource. Only a subset of the parameters may be updated after creation, such as Tags. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -546,7 +552,7 @@ private Mono updateAsync(String resourceGroupName, String accountN * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data along with {@link Response}. + * data along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response updateWithResponse(String resourceGroupName, String accountName, String creatorName, @@ -557,7 +563,7 @@ public Response updateWithResponse(String resourceGroupName, Strin /** * Updates the Maps Creator resource. Only a subset of the parameters may be updated after creation, such as Tags. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -566,7 +572,7 @@ public Response updateWithResponse(String resourceGroupName, Strin * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure resource which represents Maps Creator product and provides ability to manage private location - * data. + * data. */ @ServiceMethod(returns = ReturnType.SINGLE) public CreatorInner update(String resourceGroupName, String accountName, String creatorName, @@ -577,7 +583,7 @@ public CreatorInner update(String resourceGroupName, String accountName, String /** * Delete a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -616,7 +622,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S /** * Delete a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -655,7 +661,7 @@ private Mono> deleteWithResponseAsync(String resourceGroupName, S /** * Delete a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -671,7 +677,7 @@ private Mono deleteAsync(String resourceGroupName, String accountName, Str /** * Delete a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -689,7 +695,7 @@ public Response deleteWithResponse(String resourceGroupName, String accoun /** * Delete a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -704,7 +710,7 @@ public void delete(String resourceGroupName, String accountName, String creatorN /** * Get a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -743,7 +749,7 @@ private Mono> getWithResponseAsync(String resourceGroupNa /** * Get a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -782,7 +788,7 @@ private Mono> getWithResponseAsync(String resourceGroupNa /** * Get a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -799,7 +805,7 @@ private Mono getAsync(String resourceGroupName, String accountName /** * Get a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -817,7 +823,7 @@ public Response getWithResponse(String resourceGroupName, String a /** * Get a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -833,9 +839,8 @@ public CreatorInner get(String resourceGroupName, String accountName, String cre /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -860,9 +865,8 @@ private Mono> listByAccountNextSinglePageAsync(Strin /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/CreatorsImpl.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/CreatorsImpl.java index 4366db06858e..ed7d382cc599 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/CreatorsImpl.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/CreatorsImpl.java @@ -28,12 +28,12 @@ public CreatorsImpl(CreatorsClient innerClient, com.azure.resourcemanager.maps.A public PagedIterable listByAccount(String resourceGroupName, String accountName) { PagedIterable inner = this.serviceClient().listByAccount(resourceGroupName, accountName); - return Utils.mapPage(inner, inner1 -> new CreatorImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CreatorImpl(inner1, this.manager())); } public PagedIterable listByAccount(String resourceGroupName, String accountName, Context context) { PagedIterable inner = this.serviceClient().listByAccount(resourceGroupName, accountName, context); - return Utils.mapPage(inner, inner1 -> new CreatorImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CreatorImpl(inner1, this.manager())); } public Response deleteWithResponse(String resourceGroupName, String accountName, String creatorName, @@ -67,17 +67,17 @@ public Creator get(String resourceGroupName, String accountName, String creatorN } public Creator getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String accountName = Utils.getValueFromIdByName(id, "accounts"); + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); if (accountName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); } - String creatorName = Utils.getValueFromIdByName(id, "creators"); + String creatorName = ResourceManagerUtils.getValueFromIdByName(id, "creators"); if (creatorName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'creators'.", id))); @@ -86,17 +86,17 @@ public Creator getById(String id) { } public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String accountName = Utils.getValueFromIdByName(id, "accounts"); + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); if (accountName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); } - String creatorName = Utils.getValueFromIdByName(id, "creators"); + String creatorName = ResourceManagerUtils.getValueFromIdByName(id, "creators"); if (creatorName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'creators'.", id))); @@ -105,17 +105,17 @@ public Response getByIdWithResponse(String id, Context context) { } public void deleteById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String accountName = Utils.getValueFromIdByName(id, "accounts"); + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); if (accountName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); } - String creatorName = Utils.getValueFromIdByName(id, "creators"); + String creatorName = ResourceManagerUtils.getValueFromIdByName(id, "creators"); if (creatorName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'creators'.", id))); @@ -124,17 +124,17 @@ public void deleteById(String id) { } public Response deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String accountName = Utils.getValueFromIdByName(id, "accounts"); + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); if (accountName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); } - String creatorName = Utils.getValueFromIdByName(id, "creators"); + String creatorName = ResourceManagerUtils.getValueFromIdByName(id, "creators"); if (creatorName == null) { throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'creators'.", id))); diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/MapsAccountImpl.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/MapsAccountImpl.java index 7b1cab36ddb7..dcdafd147b6c 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/MapsAccountImpl.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/MapsAccountImpl.java @@ -153,8 +153,8 @@ public MapsAccount apply(Context context) { MapsAccountImpl(MapsAccountInner innerObject, com.azure.resourcemanager.maps.AzureMapsManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; - this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.accountName = Utils.getValueFromIdByName(innerObject.id(), "accounts"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "accounts"); } public MapsAccount refresh() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/MapsClientImpl.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/MapsClientImpl.java index 734c2932cc2d..5a479248f846 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/MapsClientImpl.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/MapsClientImpl.java @@ -30,17 +30,23 @@ import com.azure.resourcemanager.maps.models.MapsOperations; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in MapsClient. */ +/** + * An instance of this class provides access to all the operations defined in MapsClient. + */ public final class MapsClientImpl implements MapsClient { - /** The proxy service used to perform REST calls. */ + /** + * The proxy service used to perform REST calls. + */ private final MapsService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final AzureMapsManagementClientImpl client; /** * Initializes an instance of MapsClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ MapsClientImpl(AzureMapsManagementClientImpl client) { @@ -89,11 +95,11 @@ Mono> listSubscriptionOperationsNext( /** * List operations available for the Maps Resource Provider. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listOperationsSinglePageAsync() { @@ -111,13 +117,13 @@ private Mono> listOperationsSinglePageAsync( /** * List operations available for the Maps Resource Provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listOperationsSinglePageAsync(Context context) { @@ -134,7 +140,7 @@ private Mono> listOperationsSinglePageAsync( /** * List operations available for the Maps Resource Provider. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps as paginated response with {@link PagedFlux}. @@ -147,7 +153,7 @@ private PagedFlux listOperationsAsync() { /** * List operations available for the Maps Resource Provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -162,7 +168,7 @@ private PagedFlux listOperationsAsync(Context context) { /** * List operations available for the Maps Resource Provider. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps as paginated response with {@link PagedIterable}. @@ -174,7 +180,7 @@ public PagedIterable listOperations() { /** * List operations available for the Maps Resource Provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -188,11 +194,11 @@ public PagedIterable listOperations(Context context) { /** * List operations available for the Maps Resource Provider. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { @@ -215,13 +221,13 @@ private Mono> listSinglePageAsync() { /** * List operations available for the Maps Resource Provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(Context context) { @@ -244,7 +250,7 @@ private Mono> listSinglePageAsync(Context co /** * List operations available for the Maps Resource Provider. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps as paginated response with {@link PagedFlux}. @@ -257,7 +263,7 @@ private PagedFlux listAsync() { /** * List operations available for the Maps Resource Provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -272,7 +278,7 @@ private PagedFlux listAsync(Context context) { /** * List operations available for the Maps Resource Provider. - * + * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps as paginated response with {@link PagedIterable}. @@ -284,7 +290,7 @@ public PagedIterable list() { /** * List operations available for the Maps Resource Provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -298,14 +304,13 @@ public PagedIterable list(Context context) { /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listOperationsNextSinglePageAsync(String nextLink) { @@ -326,15 +331,14 @@ private Mono> listOperationsNextSinglePageAs /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listOperationsNextSinglePageAsync(String nextLink, @@ -355,14 +359,13 @@ private Mono> listOperationsNextSinglePageAs /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSubscriptionOperationsNextSinglePageAsync(String nextLink) { @@ -384,15 +387,14 @@ private Mono> listSubscriptionOperationsNext /** * Get the next page of items. - * - * @param nextLink The URL to get the next list of items - *

The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSubscriptionOperationsNextSinglePageAsync(String nextLink, diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/MapsImpl.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/MapsImpl.java index 168ced232d42..84632304cb8b 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/MapsImpl.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/MapsImpl.java @@ -26,22 +26,22 @@ public MapsImpl(MapsClient innerClient, com.azure.resourcemanager.maps.AzureMaps public PagedIterable listOperations() { PagedIterable inner = this.serviceClient().listOperations(); - return Utils.mapPage(inner, inner1 -> new OperationDetailImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationDetailImpl(inner1, this.manager())); } public PagedIterable listOperations(Context context) { PagedIterable inner = this.serviceClient().listOperations(context); - return Utils.mapPage(inner, inner1 -> new OperationDetailImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationDetailImpl(inner1, this.manager())); } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return Utils.mapPage(inner, inner1 -> new OperationDetailImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationDetailImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return Utils.mapPage(inner, inner1 -> new OperationDetailImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationDetailImpl(inner1, this.manager())); } private MapsClient serviceClient() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/Utils.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/ResourceManagerUtils.java similarity index 88% rename from sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/Utils.java rename to sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/ResourceManagerUtils.java index 7485a636e185..44fc5699e312 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/Utils.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/ResourceManagerUtils.java @@ -19,7 +19,10 @@ import java.util.stream.Stream; import reactor.core.publisher.Flux; -final class Utils { +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + static String getValueFromIdByName(String id, String name) { if (id == null) { return null; @@ -60,7 +63,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri segments.add(idSegment); idItrReverted.forEachRemaining(segments::add); Collections.reverse(segments); - if (segments.size() > 0 && segments.get(0).isEmpty()) { + if (!segments.isEmpty() && segments.get(0).isEmpty()) { segments.remove(0); } return String.join("/", segments); @@ -74,7 +77,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri } static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl(pageIterable, mapper); + return new PagedIterableImpl<>(pageIterable, mapper); } private static final class PagedIterableImpl extends PagedIterable { @@ -124,30 +127,27 @@ public Stream> streamByPage(String continuationToken, int prefe @Override public Iterator iterator() { - return new IteratorImpl(pagedIterable.iterator(), mapper); + return new IteratorImpl<>(pagedIterable.iterator(), mapper); } @Override public Iterable> iterableByPage() { - return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); } @Override public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(continuationToken), - pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); } @Override public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(preferredPageSize), - pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); } @Override public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); } } @@ -189,7 +189,7 @@ private IterableImpl(Iterable iterable, Function mapper) { @Override public Iterator iterator() { - return new IteratorImpl(iterable.iterator(), mapper); + return new IteratorImpl<>(iterable.iterator(), mapper); } } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/package-info.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/package-info.java index ea8e37e8e8a7..a895ff2b36da 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/package-info.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/implementation/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the implementations for AzureMapsManagementClient. Azure Maps. */ +/** + * Package containing the implementations for AzureMapsManagementClient. + * Azure Maps. + */ package com.azure.resourcemanager.maps.implementation; diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/AccountSasParameters.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/AccountSasParameters.java index 70f2650cb8a9..cfe6208bb31b 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/AccountSasParameters.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/AccountSasParameters.java @@ -6,7 +6,11 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; /** @@ -14,12 +18,11 @@ * Azure Maps Role Based Access (RBAC) identity and access. */ @Fluent -public final class AccountSasParameters { +public final class AccountSasParameters implements JsonSerializable { /* * The Map account key to use for signing. Picking `primaryKey` or `secondaryKey` will use the Map account Shared * Keys, and using `managedIdentity` will use the auto-renewed private key to sign the SAS. */ - @JsonProperty(value = "signingKey", required = true) private SigningKey signingKey; /* @@ -27,14 +30,12 @@ public final class AccountSasParameters { * Account. To assign a Managed Identity of the account, use operation Create or Update an assign a User Assigned * Identity resource Id. */ - @JsonProperty(value = "principalId", required = true) private String principalId; /* * Optional, allows control of which region locations are permitted access to Azure Maps REST APIs with the SAS * token. Example: "eastus", "westus2". Omitting this parameter will allow all region locations to be accessible. */ - @JsonProperty(value = "regions") private List regions; /* @@ -42,24 +43,23 @@ public final class AccountSasParameters { * This does not guarantee perfect accuracy in measurements but provides application safe guards of abuse with * eventual enforcement. */ - @JsonProperty(value = "maxRatePerSecond", required = true) private int maxRatePerSecond; /* * The date time offset of when the token validity begins. For example "2017-05-24T10:42:03.1567373Z". Maximum * duration allowed is 24 hours between `start` and `expiry`. */ - @JsonProperty(value = "start", required = true) private String start; /* * The date time offset of when the token validity expires. For example "2017-05-24T10:42:03.1567373Z". Maximum * duration allowed is 24 hours between `start` and `expiry`. */ - @JsonProperty(value = "expiry", required = true) private String expiry; - /** Creates an instance of AccountSasParameters class. */ + /** + * Creates an instance of AccountSasParameters class. + */ public AccountSasParameters() { } @@ -67,7 +67,7 @@ public AccountSasParameters() { * Get the signingKey property: The Map account key to use for signing. Picking `primaryKey` or `secondaryKey` will * use the Map account Shared Keys, and using `managedIdentity` will use the auto-renewed private key to sign the * SAS. - * + * * @return the signingKey value. */ public SigningKey signingKey() { @@ -78,7 +78,7 @@ public SigningKey signingKey() { * Set the signingKey property: The Map account key to use for signing. Picking `primaryKey` or `secondaryKey` will * use the Map account Shared Keys, and using `managedIdentity` will use the auto-renewed private key to sign the * SAS. - * + * * @param signingKey the signingKey value to set. * @return the AccountSasParameters object itself. */ @@ -91,7 +91,7 @@ public AccountSasParameters withSigningKey(SigningKey signingKey) { * Get the principalId property: The principal Id also known as the object Id of a User Assigned Managed Identity * currently assigned to the Map Account. To assign a Managed Identity of the account, use operation Create or * Update an assign a User Assigned Identity resource Id. - * + * * @return the principalId value. */ public String principalId() { @@ -102,7 +102,7 @@ public String principalId() { * Set the principalId property: The principal Id also known as the object Id of a User Assigned Managed Identity * currently assigned to the Map Account. To assign a Managed Identity of the account, use operation Create or * Update an assign a User Assigned Identity resource Id. - * + * * @param principalId the principalId value to set. * @return the AccountSasParameters object itself. */ @@ -115,7 +115,7 @@ public AccountSasParameters withPrincipalId(String principalId) { * Get the regions property: Optional, allows control of which region locations are permitted access to Azure Maps * REST APIs with the SAS token. Example: "eastus", "westus2". Omitting this parameter will allow all region * locations to be accessible. - * + * * @return the regions value. */ public List regions() { @@ -126,7 +126,7 @@ public List regions() { * Set the regions property: Optional, allows control of which region locations are permitted access to Azure Maps * REST APIs with the SAS token. Example: "eastus", "westus2". Omitting this parameter will allow all region * locations to be accessible. - * + * * @param regions the regions value to set. * @return the AccountSasParameters object itself. */ @@ -139,7 +139,7 @@ public AccountSasParameters withRegions(List regions) { * Get the maxRatePerSecond property: Required parameter which represents the desired maximum request per second to * allowed for the given SAS token. This does not guarantee perfect accuracy in measurements but provides * application safe guards of abuse with eventual enforcement. - * + * * @return the maxRatePerSecond value. */ public int maxRatePerSecond() { @@ -150,7 +150,7 @@ public int maxRatePerSecond() { * Set the maxRatePerSecond property: Required parameter which represents the desired maximum request per second to * allowed for the given SAS token. This does not guarantee perfect accuracy in measurements but provides * application safe guards of abuse with eventual enforcement. - * + * * @param maxRatePerSecond the maxRatePerSecond value to set. * @return the AccountSasParameters object itself. */ @@ -162,7 +162,7 @@ public AccountSasParameters withMaxRatePerSecond(int maxRatePerSecond) { /** * Get the start property: The date time offset of when the token validity begins. For example * "2017-05-24T10:42:03.1567373Z". Maximum duration allowed is 24 hours between `start` and `expiry`. - * + * * @return the start value. */ public String start() { @@ -172,7 +172,7 @@ public String start() { /** * Set the start property: The date time offset of when the token validity begins. For example * "2017-05-24T10:42:03.1567373Z". Maximum duration allowed is 24 hours between `start` and `expiry`. - * + * * @param start the start value to set. * @return the AccountSasParameters object itself. */ @@ -184,7 +184,7 @@ public AccountSasParameters withStart(String start) { /** * Get the expiry property: The date time offset of when the token validity expires. For example * "2017-05-24T10:42:03.1567373Z". Maximum duration allowed is 24 hours between `start` and `expiry`. - * + * * @return the expiry value. */ public String expiry() { @@ -194,7 +194,7 @@ public String expiry() { /** * Set the expiry property: The date time offset of when the token validity expires. For example * "2017-05-24T10:42:03.1567373Z". Maximum duration allowed is 24 hours between `start` and `expiry`. - * + * * @param expiry the expiry value to set. * @return the AccountSasParameters object itself. */ @@ -205,27 +205,82 @@ public AccountSasParameters withExpiry(String expiry) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (signingKey() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property signingKey in model AccountSasParameters")); + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property signingKey in model AccountSasParameters")); } if (principalId() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property principalId in model AccountSasParameters")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property principalId in model AccountSasParameters")); } if (start() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property start in model AccountSasParameters")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property start in model AccountSasParameters")); } if (expiry() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property expiry in model AccountSasParameters")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property expiry in model AccountSasParameters")); } } private static final ClientLogger LOGGER = new ClientLogger(AccountSasParameters.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("signingKey", this.signingKey == null ? null : this.signingKey.toString()); + jsonWriter.writeStringField("principalId", this.principalId); + jsonWriter.writeIntField("maxRatePerSecond", this.maxRatePerSecond); + jsonWriter.writeStringField("start", this.start); + jsonWriter.writeStringField("expiry", this.expiry); + jsonWriter.writeArrayField("regions", this.regions, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccountSasParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccountSasParameters 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 AccountSasParameters. + */ + public static AccountSasParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccountSasParameters deserializedAccountSasParameters = new AccountSasParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("signingKey".equals(fieldName)) { + deserializedAccountSasParameters.signingKey = SigningKey.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedAccountSasParameters.principalId = reader.getString(); + } else if ("maxRatePerSecond".equals(fieldName)) { + deserializedAccountSasParameters.maxRatePerSecond = reader.getInt(); + } else if ("start".equals(fieldName)) { + deserializedAccountSasParameters.start = reader.getString(); + } else if ("expiry".equals(fieldName)) { + deserializedAccountSasParameters.expiry = reader.getString(); + } else if ("regions".equals(fieldName)) { + List regions = reader.readArray(reader1 -> reader1.getString()); + deserializedAccountSasParameters.regions = regions; + } else { + reader.skipChildren(); + } + } + + return deserializedAccountSasParameters; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Accounts.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Accounts.java index 26abfc0411a8..b15ceda6291d 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Accounts.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Accounts.java @@ -8,11 +8,13 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of Accounts. */ +/** + * Resource collection API of Accounts. + */ public interface Accounts { /** * Delete a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -25,7 +27,7 @@ public interface Accounts { /** * Delete a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -36,7 +38,7 @@ public interface Accounts { /** * Get a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -49,7 +51,7 @@ public interface Accounts { /** * Get a Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -61,7 +63,7 @@ public interface Accounts { /** * Get all Maps Accounts in a Resource Group. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -72,7 +74,7 @@ public interface Accounts { /** * Get all Maps Accounts in a Resource Group. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -84,7 +86,7 @@ public interface Accounts { /** * Get all Maps Accounts in a Subscription. - * + * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all Maps Accounts in a Subscription as paginated response with {@link PagedIterable}. @@ -93,7 +95,7 @@ public interface Accounts { /** * Get all Maps Accounts in a Subscription. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -105,11 +107,12 @@ public interface Accounts { /** * Create and list an account shared access signature token. Use this SAS token for authentication to Azure Maps * REST APIs through various Azure Maps SDKs. As prerequisite to create a SAS Token. - * - *

Prerequisites: 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the - * account. 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed - * Identity is placed. - * + * + * Prerequisites: + * 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the account. + * 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed Identity is + * placed. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountSasParameters The updated parameters for the Maps Account. @@ -118,7 +121,7 @@ public interface Accounts { * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed - * identity permissions on Azure (IAM) Role Based Access Control along with {@link Response}. + * identity permissions on Azure (IAM) Role Based Access Control along with {@link Response}. */ Response listSasWithResponse(String resourceGroupName, String accountName, AccountSasParameters mapsAccountSasParameters, Context context); @@ -126,11 +129,12 @@ Response listSasWithResponse(String resourceGroupName, Stri /** * Create and list an account shared access signature token. Use this SAS token for authentication to Azure Maps * REST APIs through various Azure Maps SDKs. As prerequisite to create a SAS Token. - * - *

Prerequisites: 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the - * account. 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed - * Identity is placed. - * + * + * Prerequisites: + * 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the account. + * 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed Identity is + * placed. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param mapsAccountSasParameters The updated parameters for the Maps Account. @@ -138,7 +142,7 @@ Response listSasWithResponse(String resourceGroupName, Stri * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed - * identity permissions on Azure (IAM) Role Based Access Control. + * identity permissions on Azure (IAM) Role Based Access Control. */ MapsAccountSasToken listSas(String resourceGroupName, String accountName, AccountSasParameters mapsAccountSasParameters); @@ -146,7 +150,7 @@ MapsAccountSasToken listSas(String resourceGroupName, String accountName, /** * Get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to the Maps REST APIs. * Only one key is needed at a time; two are given to provide seamless key regeneration. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -160,7 +164,7 @@ MapsAccountSasToken listSas(String resourceGroupName, String accountName, /** * Get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to the Maps REST APIs. * Only one key is needed at a time; two are given to provide seamless key regeneration. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -173,7 +177,7 @@ MapsAccountSasToken listSas(String resourceGroupName, String accountName, /** * Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working * immediately. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param keySpecification Which key to regenerate: primary or secondary. @@ -189,7 +193,7 @@ Response regenerateKeysWithResponse(String resourceGroupName, S /** * Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working * immediately. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param keySpecification Which key to regenerate: primary or secondary. @@ -202,7 +206,7 @@ Response regenerateKeysWithResponse(String resourceGroupName, S /** * Get a Maps Account. - * + * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -213,7 +217,7 @@ Response regenerateKeysWithResponse(String resourceGroupName, S /** * Get a Maps Account. - * + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -225,7 +229,7 @@ Response regenerateKeysWithResponse(String resourceGroupName, S /** * Delete a Maps Account. - * + * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -235,7 +239,7 @@ Response regenerateKeysWithResponse(String resourceGroupName, S /** * Delete a Maps Account. - * + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -247,7 +251,7 @@ Response regenerateKeysWithResponse(String resourceGroupName, S /** * Begins definition for a new MapsAccount resource. - * + * * @param name resource name. * @return the first stage of the new MapsAccount definition. */ diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CorsRule.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CorsRule.java index aa09e8d50298..a58d1bbd0728 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CorsRule.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CorsRule.java @@ -6,27 +6,34 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; -/** Specifies a CORS rule for the Map Account. */ +/** + * Specifies a CORS rule for the Map Account. + */ @Fluent -public final class CorsRule { +public final class CorsRule implements JsonSerializable { /* * Required if CorsRule element is present. A list of origin domains that will be allowed via CORS, or "*" to allow * all domains */ - @JsonProperty(value = "allowedOrigins", required = true) private List allowedOrigins; - /** Creates an instance of CorsRule class. */ + /** + * Creates an instance of CorsRule class. + */ public CorsRule() { } /** * Get the allowedOrigins property: Required if CorsRule element is present. A list of origin domains that will be * allowed via CORS, or "*" to allow all domains. - * + * * @return the allowedOrigins value. */ public List allowedOrigins() { @@ -36,7 +43,7 @@ public List allowedOrigins() { /** * Set the allowedOrigins property: Required if CorsRule element is present. A list of origin domains that will be * allowed via CORS, or "*" to allow all domains. - * + * * @param allowedOrigins the allowedOrigins value to set. * @return the CorsRule object itself. */ @@ -47,15 +54,54 @@ public CorsRule withAllowedOrigins(List allowedOrigins) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (allowedOrigins() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property allowedOrigins in model CorsRule")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property allowedOrigins in model CorsRule")); } } private static final ClientLogger LOGGER = new ClientLogger(CorsRule.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("allowedOrigins", this.allowedOrigins, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CorsRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CorsRule 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 CorsRule. + */ + public static CorsRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CorsRule deserializedCorsRule = new CorsRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("allowedOrigins".equals(fieldName)) { + List allowedOrigins = reader.readArray(reader1 -> reader1.getString()); + deserializedCorsRule.allowedOrigins = allowedOrigins; + } else { + reader.skipChildren(); + } + } + + return deserializedCorsRule; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CorsRules.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CorsRules.java index 360f3b7601cd..6bde8bb9bfc7 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CorsRules.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CorsRules.java @@ -5,25 +5,32 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; -/** Sets the CORS rules. You can include up to five CorsRule elements in the request. */ +/** + * Sets the CORS rules. You can include up to five CorsRule elements in the request. + */ @Fluent -public final class CorsRules { +public final class CorsRules implements JsonSerializable { /* * The list of CORS rules. You can include up to five CorsRule elements in the request. */ - @JsonProperty(value = "corsRules") private List corsRules; - /** Creates an instance of CorsRules class. */ + /** + * Creates an instance of CorsRules class. + */ public CorsRules() { } /** * Get the corsRules property: The list of CORS rules. You can include up to five CorsRule elements in the request. - * + * * @return the corsRules value. */ public List corsRules() { @@ -32,7 +39,7 @@ public List corsRules() { /** * Set the corsRules property: The list of CORS rules. You can include up to five CorsRule elements in the request. - * + * * @param corsRules the corsRules value to set. * @return the CorsRules object itself. */ @@ -43,7 +50,7 @@ public CorsRules withCorsRules(List corsRules) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -51,4 +58,41 @@ public void validate() { corsRules().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("corsRules", this.corsRules, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CorsRules from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CorsRules 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 CorsRules. + */ + public static CorsRules fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CorsRules deserializedCorsRules = new CorsRules(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("corsRules".equals(fieldName)) { + List corsRules = reader.readArray(reader1 -> CorsRule.fromJson(reader1)); + deserializedCorsRules.corsRules = corsRules; + } else { + reader.skipChildren(); + } + } + + return deserializedCorsRules; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Creator.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Creator.java index 12fb9d445d28..0e72a1b508df 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Creator.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Creator.java @@ -11,101 +11,111 @@ import com.azure.resourcemanager.maps.fluent.models.CreatorProperties; import java.util.Map; -/** An immutable client-side representation of Creator. */ +/** + * An immutable client-side representation of Creator. + */ public interface Creator { /** * Gets the id property: Fully qualified resource Id for the resource. - * + * * @return the id value. */ String id(); /** * Gets the name property: The name of the resource. - * + * * @return the name value. */ String name(); /** * Gets the type property: The type of the resource. - * + * * @return the type value. */ String type(); /** * Gets the location property: The geo-location where the resource lives. - * + * * @return the location value. */ String location(); /** * Gets the tags property: Resource tags. - * + * * @return the tags value. */ Map tags(); /** * Gets the properties property: The Creator resource properties. - * + * * @return the properties value. */ CreatorProperties properties(); /** * Gets the systemData property: The system meta data relating to this resource. - * + * * @return the systemData value. */ SystemData systemData(); /** * Gets the region of the resource. - * + * * @return the region of the resource. */ Region region(); /** * Gets the name of the resource region. - * + * * @return the name of the resource region. */ String regionName(); /** * Gets the name of the resource group. - * + * * @return the name of the resource group. */ String resourceGroupName(); /** * Gets the inner com.azure.resourcemanager.maps.fluent.models.CreatorInner object. - * + * * @return the inner object. */ CreatorInner innerModel(); - /** The entirety of the Creator definition. */ + /** + * The entirety of the Creator definition. + */ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithParentResource, DefinitionStages.WithProperties, DefinitionStages.WithCreate { } - /** The Creator definition stages. */ + /** + * The Creator definition stages. + */ interface DefinitionStages { - /** The first stage of the Creator definition. */ + /** + * The first stage of the Creator definition. + */ interface Blank extends WithLocation { } - /** The stage of the Creator definition allowing to specify location. */ + /** + * The stage of the Creator definition allowing to specify location. + */ interface WithLocation { /** * Specifies the region for the resource. - * + * * @param location The geo-location where the resource lives. * @return the next definition stage. */ @@ -113,18 +123,20 @@ interface WithLocation { /** * Specifies the region for the resource. - * + * * @param location The geo-location where the resource lives. * @return the next definition stage. */ WithParentResource withRegion(String location); } - /** The stage of the Creator definition allowing to specify parent resource. */ + /** + * The stage of the Creator definition allowing to specify parent resource. + */ interface WithParentResource { /** * Specifies resourceGroupName, accountName. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @return the next definition stage. @@ -132,11 +144,13 @@ interface WithParentResource { WithProperties withExistingAccount(String resourceGroupName, String accountName); } - /** The stage of the Creator definition allowing to specify properties. */ + /** + * The stage of the Creator definition allowing to specify properties. + */ interface WithProperties { /** * Specifies the properties property: The Creator resource properties.. - * + * * @param properties The Creator resource properties. * @return the next definition stage. */ @@ -150,25 +164,27 @@ interface WithProperties { interface WithCreate extends DefinitionStages.WithTags { /** * Executes the create request. - * + * * @return the created resource. */ Creator create(); /** * Executes the create request. - * + * * @param context The context to associate with this operation. * @return the created resource. */ Creator create(Context context); } - /** The stage of the Creator definition allowing to specify tags. */ + /** + * The stage of the Creator definition allowing to specify tags. + */ interface WithTags { /** * Specifies the tags property: Resource tags.. - * + * * @param tags Resource tags. * @return the next definition stage. */ @@ -178,54 +194,62 @@ interface WithTags { /** * Begins update for the Creator resource. - * + * * @return the stage of resource update. */ Creator.Update update(); - /** The template for Creator update. */ + /** + * The template for Creator update. + */ interface Update extends UpdateStages.WithTags, UpdateStages.WithStorageUnits { /** * Executes the update request. - * + * * @return the updated resource. */ Creator apply(); /** * Executes the update request. - * + * * @param context The context to associate with this operation. * @return the updated resource. */ Creator apply(Context context); } - /** The Creator update stages. */ + /** + * The Creator update stages. + */ interface UpdateStages { - /** The stage of the Creator update allowing to specify tags. */ + /** + * The stage of the Creator update allowing to specify tags. + */ interface WithTags { /** * Specifies the tags property: Gets or sets a list of key value pairs that describe the resource. These * tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can * be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater * than 256 characters.. - * + * * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in - * viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for - * a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 - * characters. + * viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a + * resource. Each tag must have a key no greater than 128 characters and value no greater than 256 + * characters. * @return the next definition stage. */ Update withTags(Map tags); } - /** The stage of the Creator update allowing to specify storageUnits. */ + /** + * The stage of the Creator update allowing to specify storageUnits. + */ interface WithStorageUnits { /** * Specifies the storageUnits property: The storage units to be allocated. Integer values from 1 to 100, * inclusive.. - * + * * @param storageUnits The storage units to be allocated. Integer values from 1 to 100, inclusive. * @return the next definition stage. */ @@ -235,14 +259,14 @@ interface WithStorageUnits { /** * Refreshes the resource to sync with Azure. - * + * * @return the refreshed resource. */ Creator refresh(); /** * Refreshes the resource to sync with Azure. - * + * * @param context The context to associate with this operation. * @return the refreshed resource. */ diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CreatorList.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CreatorList.java index 7f060ea5ff64..fb45832b8d43 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CreatorList.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CreatorList.java @@ -5,33 +5,39 @@ package com.azure.resourcemanager.maps.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.maps.fluent.models.CreatorInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of Creator resources. */ +/** + * A list of Creator resources. + */ @Fluent -public final class CreatorList { +public final class CreatorList implements JsonSerializable { /* * a Creator account. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * URL client should use to fetch the next page (per server side paging). * It's null for now, added for future use. */ - @JsonProperty(value = "nextLink") private String nextLink; - /** Creates an instance of CreatorList class. */ + /** + * Creates an instance of CreatorList class. + */ public CreatorList() { } /** * Get the value property: a Creator account. - * + * * @return the value value. */ public List value() { @@ -39,9 +45,9 @@ public List value() { } /** - * Get the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for - * now, added for future use. - * + * Get the nextLink property: URL client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + * * @return the nextLink value. */ public String nextLink() { @@ -49,9 +55,9 @@ public String nextLink() { } /** - * Set the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for - * now, added for future use. - * + * Set the nextLink property: URL client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + * * @param nextLink the nextLink value to set. * @return the CreatorList object itself. */ @@ -62,7 +68,7 @@ public CreatorList withNextLink(String nextLink) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -70,4 +76,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreatorList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreatorList 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 CreatorList. + */ + public static CreatorList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CreatorList deserializedCreatorList = new CreatorList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> CreatorInner.fromJson(reader1)); + deserializedCreatorList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCreatorList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCreatorList; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CreatorUpdateParameters.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CreatorUpdateParameters.java index 927bb9baf9fb..d4d631c6cac0 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CreatorUpdateParameters.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CreatorUpdateParameters.java @@ -5,30 +5,34 @@ package com.azure.resourcemanager.maps.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.maps.fluent.models.CreatorProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; -/** Parameters used to update an existing Creator resource. */ +/** + * Parameters used to update an existing Creator resource. + */ @Fluent -public final class CreatorUpdateParameters { +public final class CreatorUpdateParameters implements JsonSerializable { /* - * Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and - * grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag - * must have a key no greater than 128 characters and value no greater than 256 characters. + * Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping + * this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a + * key no greater than 128 characters and value no greater than 256 characters. */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /* * Creator resource properties. */ - @JsonProperty(value = "properties") private CreatorProperties innerProperties; - /** Creates an instance of CreatorUpdateParameters class. */ + /** + * Creates an instance of CreatorUpdateParameters class. + */ public CreatorUpdateParameters() { } @@ -36,7 +40,7 @@ public CreatorUpdateParameters() { * Get the tags property: Gets or sets a list of key value pairs that describe the resource. These tags can be used * in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a * resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. - * + * * @return the tags value. */ public Map tags() { @@ -47,7 +51,7 @@ public Map tags() { * Set the tags property: Gets or sets a list of key value pairs that describe the resource. These tags can be used * in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a * resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. - * + * * @param tags the tags value to set. * @return the CreatorUpdateParameters object itself. */ @@ -58,7 +62,7 @@ public CreatorUpdateParameters withTags(Map tags) { /** * Get the innerProperties property: Creator resource properties. - * + * * @return the innerProperties value. */ private CreatorProperties innerProperties() { @@ -68,7 +72,7 @@ private CreatorProperties innerProperties() { /** * Get the provisioningState property: The state of the resource provisioning, terminal states: Succeeded, Failed, * Canceled. - * + * * @return the provisioningState value. */ public String provisioningState() { @@ -77,7 +81,7 @@ public String provisioningState() { /** * Get the storageUnits property: The storage units to be allocated. Integer values from 1 to 100, inclusive. - * + * * @return the storageUnits value. */ public Integer storageUnits() { @@ -86,7 +90,7 @@ public Integer storageUnits() { /** * Set the storageUnits property: The storage units to be allocated. Integer values from 1 to 100, inclusive. - * + * * @param storageUnits the storageUnits value to set. * @return the CreatorUpdateParameters object itself. */ @@ -100,7 +104,7 @@ public CreatorUpdateParameters withStorageUnits(Integer storageUnits) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -108,4 +112,44 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreatorUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreatorUpdateParameters 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 CreatorUpdateParameters. + */ + public static CreatorUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CreatorUpdateParameters deserializedCreatorUpdateParameters = new CreatorUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCreatorUpdateParameters.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedCreatorUpdateParameters.innerProperties = CreatorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCreatorUpdateParameters; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Creators.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Creators.java index 772d6244e97d..3503bed0805c 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Creators.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Creators.java @@ -8,11 +8,13 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of Creators. */ +/** + * Resource collection API of Creators. + */ public interface Creators { /** * Get all Creator instances for an Azure Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -24,7 +26,7 @@ public interface Creators { /** * Get all Creator instances for an Azure Maps Account. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param context The context to associate with this operation. @@ -37,7 +39,7 @@ public interface Creators { /** * Delete a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -52,7 +54,7 @@ Response deleteWithResponse(String resourceGroupName, String accountName, /** * Delete a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -64,7 +66,7 @@ Response deleteWithResponse(String resourceGroupName, String accountName, /** * Get a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -79,7 +81,7 @@ Response getWithResponse(String resourceGroupName, String accountName, /** * Get a Maps Creator resource. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of the Maps Account. * @param creatorName The name of the Maps Creator instance. @@ -92,7 +94,7 @@ Response getWithResponse(String resourceGroupName, String accountName, /** * Get a Maps Creator resource. - * + * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -103,7 +105,7 @@ Response getWithResponse(String resourceGroupName, String accountName, /** * Get a Maps Creator resource. - * + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -115,7 +117,7 @@ Response getWithResponse(String resourceGroupName, String accountName, /** * Delete a Maps Creator resource. - * + * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -125,7 +127,7 @@ Response getWithResponse(String resourceGroupName, String accountName, /** * Delete a Maps Creator resource. - * + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -137,7 +139,7 @@ Response getWithResponse(String resourceGroupName, String accountName, /** * Begins definition for a new Creator resource. - * + * * @param name resource name. * @return the first stage of the new Creator definition. */ diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CustomerManagedKeyEncryption.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CustomerManagedKeyEncryption.java index 640f22b417b8..50ae0cdf5c92 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CustomerManagedKeyEncryption.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CustomerManagedKeyEncryption.java @@ -5,16 +5,21 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** All Customer-managed key encryption properties for the resource. */ +/** + * All Customer-managed key encryption properties for the resource. + */ @Fluent -public final class CustomerManagedKeyEncryption { +public final class CustomerManagedKeyEncryption implements JsonSerializable { /* * All identity configuration for Customer-managed key settings defining which identity should be used to auth to * Key Vault. */ - @JsonProperty(value = "keyEncryptionKeyIdentity") private CustomerManagedKeyEncryptionKeyIdentity keyEncryptionKeyIdentity; /* @@ -22,17 +27,18 @@ public final class CustomerManagedKeyEncryption { * https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or * https://contosovault.vault.azure.net/keys/contosokek. */ - @JsonProperty(value = "keyEncryptionKeyUrl") private String keyEncryptionKeyUrl; - /** Creates an instance of CustomerManagedKeyEncryption class. */ + /** + * Creates an instance of CustomerManagedKeyEncryption class. + */ public CustomerManagedKeyEncryption() { } /** * Get the keyEncryptionKeyIdentity property: All identity configuration for Customer-managed key settings defining * which identity should be used to auth to Key Vault. - * + * * @return the keyEncryptionKeyIdentity value. */ public CustomerManagedKeyEncryptionKeyIdentity keyEncryptionKeyIdentity() { @@ -42,7 +48,7 @@ public CustomerManagedKeyEncryptionKeyIdentity keyEncryptionKeyIdentity() { /** * Set the keyEncryptionKeyIdentity property: All identity configuration for Customer-managed key settings defining * which identity should be used to auth to Key Vault. - * + * * @param keyEncryptionKeyIdentity the keyEncryptionKeyIdentity value to set. * @return the CustomerManagedKeyEncryption object itself. */ @@ -56,7 +62,7 @@ public CustomerManagedKeyEncryptionKeyIdentity keyEncryptionKeyIdentity() { * Get the keyEncryptionKeyUrl property: key encryption key Url, versioned or non-versioned. Ex: * https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or * https://contosovault.vault.azure.net/keys/contosokek. - * + * * @return the keyEncryptionKeyUrl value. */ public String keyEncryptionKeyUrl() { @@ -67,7 +73,7 @@ public String keyEncryptionKeyUrl() { * Set the keyEncryptionKeyUrl property: key encryption key Url, versioned or non-versioned. Ex: * https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or * https://contosovault.vault.azure.net/keys/contosokek. - * + * * @param keyEncryptionKeyUrl the keyEncryptionKeyUrl value to set. * @return the CustomerManagedKeyEncryption object itself. */ @@ -78,7 +84,7 @@ public CustomerManagedKeyEncryption withKeyEncryptionKeyUrl(String keyEncryption /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -86,4 +92,44 @@ public void validate() { keyEncryptionKeyIdentity().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("keyEncryptionKeyIdentity", this.keyEncryptionKeyIdentity); + jsonWriter.writeStringField("keyEncryptionKeyUrl", this.keyEncryptionKeyUrl); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomerManagedKeyEncryption from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomerManagedKeyEncryption 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 CustomerManagedKeyEncryption. + */ + public static CustomerManagedKeyEncryption fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomerManagedKeyEncryption deserializedCustomerManagedKeyEncryption = new CustomerManagedKeyEncryption(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyEncryptionKeyIdentity".equals(fieldName)) { + deserializedCustomerManagedKeyEncryption.keyEncryptionKeyIdentity + = CustomerManagedKeyEncryptionKeyIdentity.fromJson(reader); + } else if ("keyEncryptionKeyUrl".equals(fieldName)) { + deserializedCustomerManagedKeyEncryption.keyEncryptionKeyUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomerManagedKeyEncryption; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CustomerManagedKeyEncryptionKeyIdentity.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CustomerManagedKeyEncryptionKeyIdentity.java index 22ca870aabd6..3250b71a595b 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CustomerManagedKeyEncryptionKeyIdentity.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/CustomerManagedKeyEncryptionKeyIdentity.java @@ -5,7 +5,12 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Objects; import java.util.UUID; /** @@ -13,11 +18,11 @@ * Vault. */ @Fluent -public final class CustomerManagedKeyEncryptionKeyIdentity { +public final class CustomerManagedKeyEncryptionKeyIdentity + implements JsonSerializable { /* * Values can be systemAssignedIdentity or userAssignedIdentity */ - @JsonProperty(value = "identityType") private IdentityType identityType; /* @@ -26,7 +31,6 @@ public final class CustomerManagedKeyEncryptionKeyIdentity { * group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType * systemAssignedIdentity and delegatedResourceIdentity. */ - @JsonProperty(value = "userAssignedIdentityResourceId") private String userAssignedIdentityResourceId; /* @@ -35,16 +39,17 @@ public final class CustomerManagedKeyEncryptionKeyIdentity { * group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType * systemAssignedIdentity and userAssignedIdentity - internal use only. */ - @JsonProperty(value = "delegatedIdentityClientId") private UUID delegatedIdentityClientId; - /** Creates an instance of CustomerManagedKeyEncryptionKeyIdentity class. */ + /** + * Creates an instance of CustomerManagedKeyEncryptionKeyIdentity class. + */ public CustomerManagedKeyEncryptionKeyIdentity() { } /** * Get the identityType property: Values can be systemAssignedIdentity or userAssignedIdentity. - * + * * @return the identityType value. */ public IdentityType identityType() { @@ -53,7 +58,7 @@ public IdentityType identityType() { /** * Set the identityType property: Values can be systemAssignedIdentity or userAssignedIdentity. - * + * * @param identityType the identityType value to set. * @return the CustomerManagedKeyEncryptionKeyIdentity object itself. */ @@ -67,7 +72,7 @@ public CustomerManagedKeyEncryptionKeyIdentity withIdentityType(IdentityType ide * Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/<resource * group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType * systemAssignedIdentity and delegatedResourceIdentity. - * + * * @return the userAssignedIdentityResourceId value. */ public String userAssignedIdentityResourceId() { @@ -79,7 +84,7 @@ public String userAssignedIdentityResourceId() { * Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/<resource * group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType * systemAssignedIdentity and delegatedResourceIdentity. - * + * * @param userAssignedIdentityResourceId the userAssignedIdentityResourceId value to set. * @return the CustomerManagedKeyEncryptionKeyIdentity object itself. */ @@ -94,7 +99,7 @@ public String userAssignedIdentityResourceId() { * /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/<resource * group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType * systemAssignedIdentity and userAssignedIdentity - internal use only. - * + * * @return the delegatedIdentityClientId value. */ public UUID delegatedIdentityClientId() { @@ -106,7 +111,7 @@ public UUID delegatedIdentityClientId() { * /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/<resource * group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType * systemAssignedIdentity and userAssignedIdentity - internal use only. - * + * * @param delegatedIdentityClientId the delegatedIdentityClientId value to set. * @return the CustomerManagedKeyEncryptionKeyIdentity object itself. */ @@ -117,9 +122,56 @@ public CustomerManagedKeyEncryptionKeyIdentity withDelegatedIdentityClientId(UUI /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("identityType", this.identityType == null ? null : this.identityType.toString()); + jsonWriter.writeStringField("userAssignedIdentityResourceId", this.userAssignedIdentityResourceId); + jsonWriter.writeStringField("delegatedIdentityClientId", + Objects.toString(this.delegatedIdentityClientId, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomerManagedKeyEncryptionKeyIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomerManagedKeyEncryptionKeyIdentity 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 CustomerManagedKeyEncryptionKeyIdentity. + */ + public static CustomerManagedKeyEncryptionKeyIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomerManagedKeyEncryptionKeyIdentity deserializedCustomerManagedKeyEncryptionKeyIdentity + = new CustomerManagedKeyEncryptionKeyIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identityType".equals(fieldName)) { + deserializedCustomerManagedKeyEncryptionKeyIdentity.identityType + = IdentityType.fromString(reader.getString()); + } else if ("userAssignedIdentityResourceId".equals(fieldName)) { + deserializedCustomerManagedKeyEncryptionKeyIdentity.userAssignedIdentityResourceId + = reader.getString(); + } else if ("delegatedIdentityClientId".equals(fieldName)) { + deserializedCustomerManagedKeyEncryptionKeyIdentity.delegatedIdentityClientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomerManagedKeyEncryptionKeyIdentity; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Dimension.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Dimension.java index 5dab0880231b..0989f5599aa5 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Dimension.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Dimension.java @@ -5,54 +5,56 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Dimension of map account, for example API Category, Api Name, Result Type, and Response Code. */ +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Dimension of map account, for example API Category, Api Name, Result Type, and Response Code. + */ @Fluent -public final class Dimension { +public final class Dimension implements JsonSerializable { /* * Display name of dimension. */ - @JsonProperty(value = "name") private String name; /* * Display name of dimension. */ - @JsonProperty(value = "displayName") private String displayName; /* * Internal name of the dimension. */ - @JsonProperty(value = "internalName") private String internalName; /* * Internal metric name of the dimension. */ - @JsonProperty(value = "internalMetricName") private String internalMetricName; /* * Source Mdm Namespace of the dimension. */ - @JsonProperty(value = "sourceMdmNamespace") private String sourceMdmNamespace; /* * Flag to indicate exporting to Azure Monitor. */ - @JsonProperty(value = "toBeExportedToShoebox") private Boolean toBeExportedToShoebox; - /** Creates an instance of Dimension class. */ + /** + * Creates an instance of Dimension class. + */ public Dimension() { } /** * Get the name property: Display name of dimension. - * + * * @return the name value. */ public String name() { @@ -61,7 +63,7 @@ public String name() { /** * Set the name property: Display name of dimension. - * + * * @param name the name value to set. * @return the Dimension object itself. */ @@ -72,7 +74,7 @@ public Dimension withName(String name) { /** * Get the displayName property: Display name of dimension. - * + * * @return the displayName value. */ public String displayName() { @@ -81,7 +83,7 @@ public String displayName() { /** * Set the displayName property: Display name of dimension. - * + * * @param displayName the displayName value to set. * @return the Dimension object itself. */ @@ -92,7 +94,7 @@ public Dimension withDisplayName(String displayName) { /** * Get the internalName property: Internal name of the dimension. - * + * * @return the internalName value. */ public String internalName() { @@ -101,7 +103,7 @@ public String internalName() { /** * Set the internalName property: Internal name of the dimension. - * + * * @param internalName the internalName value to set. * @return the Dimension object itself. */ @@ -112,7 +114,7 @@ public Dimension withInternalName(String internalName) { /** * Get the internalMetricName property: Internal metric name of the dimension. - * + * * @return the internalMetricName value. */ public String internalMetricName() { @@ -121,7 +123,7 @@ public String internalMetricName() { /** * Set the internalMetricName property: Internal metric name of the dimension. - * + * * @param internalMetricName the internalMetricName value to set. * @return the Dimension object itself. */ @@ -132,7 +134,7 @@ public Dimension withInternalMetricName(String internalMetricName) { /** * Get the sourceMdmNamespace property: Source Mdm Namespace of the dimension. - * + * * @return the sourceMdmNamespace value. */ public String sourceMdmNamespace() { @@ -141,7 +143,7 @@ public String sourceMdmNamespace() { /** * Set the sourceMdmNamespace property: Source Mdm Namespace of the dimension. - * + * * @param sourceMdmNamespace the sourceMdmNamespace value to set. * @return the Dimension object itself. */ @@ -152,7 +154,7 @@ public Dimension withSourceMdmNamespace(String sourceMdmNamespace) { /** * Get the toBeExportedToShoebox property: Flag to indicate exporting to Azure Monitor. - * + * * @return the toBeExportedToShoebox value. */ public Boolean toBeExportedToShoebox() { @@ -161,7 +163,7 @@ public Boolean toBeExportedToShoebox() { /** * Set the toBeExportedToShoebox property: Flag to indicate exporting to Azure Monitor. - * + * * @param toBeExportedToShoebox the toBeExportedToShoebox value to set. * @return the Dimension object itself. */ @@ -172,9 +174,60 @@ public Dimension withToBeExportedToShoebox(Boolean toBeExportedToShoebox) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("internalName", this.internalName); + jsonWriter.writeStringField("internalMetricName", this.internalMetricName); + jsonWriter.writeStringField("sourceMdmNamespace", this.sourceMdmNamespace); + jsonWriter.writeBooleanField("toBeExportedToShoebox", this.toBeExportedToShoebox); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dimension from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dimension 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 Dimension. + */ + public static Dimension fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Dimension deserializedDimension = new Dimension(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDimension.name = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedDimension.displayName = reader.getString(); + } else if ("internalName".equals(fieldName)) { + deserializedDimension.internalName = reader.getString(); + } else if ("internalMetricName".equals(fieldName)) { + deserializedDimension.internalMetricName = reader.getString(); + } else if ("sourceMdmNamespace".equals(fieldName)) { + deserializedDimension.sourceMdmNamespace = reader.getString(); + } else if ("toBeExportedToShoebox".equals(fieldName)) { + deserializedDimension.toBeExportedToShoebox = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedDimension; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Encryption.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Encryption.java index 6bcd738e57b8..fc4635c4c514 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Encryption.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Encryption.java @@ -5,33 +5,37 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * (Optional) Discouraged to include in resource definition. Only needed where it is possible to disable platform (AKA * infrastructure) encryption. Azure SQL TDE is an example of this. Values are enabled and disabled. */ @Fluent -public final class Encryption { +public final class Encryption implements JsonSerializable { /* * Values are enabled and disabled. */ - @JsonProperty(value = "infrastructureEncryption") private InfrastructureEncryption infrastructureEncryption; /* * All Customer-managed key encryption properties for the resource. */ - @JsonProperty(value = "customerManagedKeyEncryption") private CustomerManagedKeyEncryption customerManagedKeyEncryption; - /** Creates an instance of Encryption class. */ + /** + * Creates an instance of Encryption class. + */ public Encryption() { } /** * Get the infrastructureEncryption property: Values are enabled and disabled. - * + * * @return the infrastructureEncryption value. */ public InfrastructureEncryption infrastructureEncryption() { @@ -40,7 +44,7 @@ public InfrastructureEncryption infrastructureEncryption() { /** * Set the infrastructureEncryption property: Values are enabled and disabled. - * + * * @param infrastructureEncryption the infrastructureEncryption value to set. * @return the Encryption object itself. */ @@ -51,7 +55,7 @@ public Encryption withInfrastructureEncryption(InfrastructureEncryption infrastr /** * Get the customerManagedKeyEncryption property: All Customer-managed key encryption properties for the resource. - * + * * @return the customerManagedKeyEncryption value. */ public CustomerManagedKeyEncryption customerManagedKeyEncryption() { @@ -60,7 +64,7 @@ public CustomerManagedKeyEncryption customerManagedKeyEncryption() { /** * Set the customerManagedKeyEncryption property: All Customer-managed key encryption properties for the resource. - * + * * @param customerManagedKeyEncryption the customerManagedKeyEncryption value to set. * @return the Encryption object itself. */ @@ -71,7 +75,7 @@ public Encryption withCustomerManagedKeyEncryption(CustomerManagedKeyEncryption /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -79,4 +83,45 @@ public void validate() { customerManagedKeyEncryption().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("infrastructureEncryption", + this.infrastructureEncryption == null ? null : this.infrastructureEncryption.toString()); + jsonWriter.writeJsonField("customerManagedKeyEncryption", this.customerManagedKeyEncryption); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Encryption from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Encryption 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 Encryption. + */ + public static Encryption fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Encryption deserializedEncryption = new Encryption(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("infrastructureEncryption".equals(fieldName)) { + deserializedEncryption.infrastructureEncryption + = InfrastructureEncryption.fromString(reader.getString()); + } else if ("customerManagedKeyEncryption".equals(fieldName)) { + deserializedEncryption.customerManagedKeyEncryption = CustomerManagedKeyEncryption.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEncryption; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/IdentityType.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/IdentityType.java index 0adb7eb049df..a4aefa3e8776 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/IdentityType.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/IdentityType.java @@ -5,23 +5,30 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Values can be systemAssignedIdentity or userAssignedIdentity. */ +/** + * Values can be systemAssignedIdentity or userAssignedIdentity. + */ public final class IdentityType extends ExpandableStringEnum { - /** Static value systemAssignedIdentity for IdentityType. */ + /** + * Static value systemAssignedIdentity for IdentityType. + */ public static final IdentityType SYSTEM_ASSIGNED_IDENTITY = fromString("systemAssignedIdentity"); - /** Static value userAssignedIdentity for IdentityType. */ + /** + * Static value userAssignedIdentity for IdentityType. + */ public static final IdentityType USER_ASSIGNED_IDENTITY = fromString("userAssignedIdentity"); - /** Static value delegatedResourceIdentity for IdentityType. */ + /** + * Static value delegatedResourceIdentity for IdentityType. + */ public static final IdentityType DELEGATED_RESOURCE_IDENTITY = fromString("delegatedResourceIdentity"); /** * Creates a new instance of IdentityType value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -30,18 +37,17 @@ public IdentityType() { /** * Creates or finds a IdentityType from its string representation. - * + * * @param name a name to look for. * @return the corresponding IdentityType. */ - @JsonCreator public static IdentityType fromString(String name) { return fromString(name, IdentityType.class); } /** * Gets known IdentityType values. - * + * * @return known IdentityType values. */ public static Collection values() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/InfrastructureEncryption.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/InfrastructureEncryption.java index 4a01536956e3..8faf2a88e000 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/InfrastructureEncryption.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/InfrastructureEncryption.java @@ -5,20 +5,25 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Values are enabled and disabled. */ +/** + * Values are enabled and disabled. + */ public final class InfrastructureEncryption extends ExpandableStringEnum { - /** Static value enabled for InfrastructureEncryption. */ + /** + * Static value enabled for InfrastructureEncryption. + */ public static final InfrastructureEncryption ENABLED = fromString("enabled"); - /** Static value disabled for InfrastructureEncryption. */ + /** + * Static value disabled for InfrastructureEncryption. + */ public static final InfrastructureEncryption DISABLED = fromString("disabled"); /** * Creates a new instance of InfrastructureEncryption value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -27,18 +32,17 @@ public InfrastructureEncryption() { /** * Creates or finds a InfrastructureEncryption from its string representation. - * + * * @param name a name to look for. * @return the corresponding InfrastructureEncryption. */ - @JsonCreator public static InfrastructureEncryption fromString(String name) { return fromString(name, InfrastructureEncryption.class); } /** * Gets known InfrastructureEncryption values. - * + * * @return known InfrastructureEncryption values. */ public static Collection values() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/KeyType.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/KeyType.java index 3354a39a766d..0851432ad4bc 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/KeyType.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/KeyType.java @@ -5,20 +5,25 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Whether the operation refers to the primary or secondary key. */ +/** + * Whether the operation refers to the primary or secondary key. + */ public final class KeyType extends ExpandableStringEnum { - /** Static value primary for KeyType. */ + /** + * Static value primary for KeyType. + */ public static final KeyType PRIMARY = fromString("primary"); - /** Static value secondary for KeyType. */ + /** + * Static value secondary for KeyType. + */ public static final KeyType SECONDARY = fromString("secondary"); /** * Creates a new instance of KeyType value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -27,18 +32,17 @@ public KeyType() { /** * Creates or finds a KeyType from its string representation. - * + * * @param name a name to look for. * @return the corresponding KeyType. */ - @JsonCreator public static KeyType fromString(String name) { return fromString(name, KeyType.class); } /** * Gets known KeyType values. - * + * * @return known KeyType values. */ public static Collection values() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Kind.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Kind.java index 63bf6d660aa3..677c08393e46 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Kind.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Kind.java @@ -5,20 +5,25 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** The Kind of the Maps Account. */ +/** + * The Kind of the Maps Account. + */ public final class Kind extends ExpandableStringEnum { - /** Static value Gen1 for Kind. */ + /** + * Static value Gen1 for Kind. + */ public static final Kind GEN1 = fromString("Gen1"); - /** Static value Gen2 for Kind. */ + /** + * Static value Gen2 for Kind. + */ public static final Kind GEN2 = fromString("Gen2"); /** * Creates a new instance of Kind value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -27,18 +32,17 @@ public Kind() { /** * Creates or finds a Kind from its string representation. - * + * * @param name a name to look for. * @return the corresponding Kind. */ - @JsonCreator public static Kind fromString(String name) { return fromString(name, Kind.class); } /** * Gets known Kind values. - * + * * @return known Kind values. */ public static Collection values() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/LinkedResource.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/LinkedResource.java index 32c9d948b0e4..7f669f7f51f2 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/LinkedResource.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/LinkedResource.java @@ -6,34 +6,39 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; /** * Linked resource is reference to a resource deployed in an Azure subscription, add the linked resource `uniqueName` * value as an optional parameter for operations on Azure Maps Geospatial REST APIs. */ @Fluent -public final class LinkedResource { +public final class LinkedResource implements JsonSerializable { /* * A provided name which uniquely identifies the linked resource. */ - @JsonProperty(value = "uniqueName", required = true) private String uniqueName; /* * ARM resource id in the form: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{storageName}'. + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{ + * storageName}'. */ - @JsonProperty(value = "id", required = true) private String id; - /** Creates an instance of LinkedResource class. */ + /** + * Creates an instance of LinkedResource class. + */ public LinkedResource() { } /** * Get the uniqueName property: A provided name which uniquely identifies the linked resource. - * + * * @return the uniqueName value. */ public String uniqueName() { @@ -42,7 +47,7 @@ public String uniqueName() { /** * Set the uniqueName property: A provided name which uniquely identifies the linked resource. - * + * * @param uniqueName the uniqueName value to set. * @return the LinkedResource object itself. */ @@ -54,7 +59,7 @@ public LinkedResource withUniqueName(String uniqueName) { /** * Get the id property: ARM resource id in the form: * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{storageName}'. - * + * * @return the id value. */ public String id() { @@ -64,7 +69,7 @@ public String id() { /** * Set the id property: ARM resource id in the form: * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{storageName}'. - * + * * @param id the id value to set. * @return the LinkedResource object itself. */ @@ -75,19 +80,59 @@ public LinkedResource withId(String id) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (uniqueName() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property uniqueName in model LinkedResource")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property uniqueName in model LinkedResource")); } if (id() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property id in model LinkedResource")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model LinkedResource")); } } private static final ClientLogger LOGGER = new ClientLogger(LinkedResource.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("uniqueName", this.uniqueName); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LinkedResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LinkedResource 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 LinkedResource. + */ + public static LinkedResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LinkedResource deserializedLinkedResource = new LinkedResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("uniqueName".equals(fieldName)) { + deserializedLinkedResource.uniqueName = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedLinkedResource.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLinkedResource; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/ManagedServiceIdentity.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/ManagedServiceIdentity.java index 006a46432f40..650f24f9c336 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/ManagedServiceIdentity.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/ManagedServiceIdentity.java @@ -6,52 +6,54 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; import java.util.UUID; -/** Managed service identity (system assigned and/or user assigned identities). */ +/** + * Managed service identity (system assigned and/or user assigned identities). + */ @Fluent -public final class ManagedServiceIdentity { +public final class ManagedServiceIdentity implements JsonSerializable { /* * The service principal ID of the system assigned identity. This property will only be provided for a system * assigned identity. */ - @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) private UUID principalId; /* * The tenant ID of the system assigned identity. This property will only be provided for a system assigned * identity. */ - @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) private UUID tenantId; /* * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ - @JsonProperty(value = "type", required = true) private ManagedServiceIdentityType type; /* - * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys - * will be ARM resource ids in the form: - * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - * The dictionary values can be empty objects ({}) in requests. + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will + * be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/ + * userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. */ - @JsonProperty(value = "userAssignedIdentities") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map userAssignedIdentities; - /** Creates an instance of ManagedServiceIdentity class. */ + /** + * 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 UUID principalId() { @@ -61,7 +63,7 @@ public UUID 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. */ public UUID tenantId() { @@ -71,7 +73,7 @@ public UUID tenantId() { /** * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are * allowed). - * + * * @return the type value. */ public ManagedServiceIdentityType type() { @@ -81,7 +83,7 @@ public ManagedServiceIdentityType type() { /** * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are * allowed). - * + * * @param type the type value to set. * @return the ManagedServiceIdentity object itself. */ @@ -95,7 +97,7 @@ public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { * userAssignedIdentities dictionary keys will be ARM resource ids in the form: * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. * The dictionary values can be empty objects ({}) in requests. - * + * * @return the userAssignedIdentities value. */ public Map userAssignedIdentities() { @@ -107,7 +109,7 @@ public Map userAssignedIdentities() { * userAssignedIdentities dictionary keys will be ARM resource ids in the form: * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. * The dictionary values can be empty objects ({}) in requests. - * + * * @param userAssignedIdentities the userAssignedIdentities value to set. * @return the ManagedServiceIdentity object itself. */ @@ -118,13 +120,13 @@ public ManagedServiceIdentity withUserAssignedIdentities(Map { @@ -136,4 +138,53 @@ public void validate() { } private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity 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. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + 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.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/ManagedServiceIdentityType.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/ManagedServiceIdentityType.java index 9dc31b984c90..1bddd48b8fba 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/ManagedServiceIdentityType.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/ManagedServiceIdentityType.java @@ -5,27 +5,36 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ public final class ManagedServiceIdentityType extends ExpandableStringEnum { - /** Static value None for ManagedServiceIdentityType. */ + /** + * Static value None for ManagedServiceIdentityType. + */ public static final ManagedServiceIdentityType NONE = fromString("None"); - /** Static value SystemAssigned for ManagedServiceIdentityType. */ + /** + * Static value SystemAssigned for ManagedServiceIdentityType. + */ public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); - /** Static value UserAssigned for ManagedServiceIdentityType. */ + /** + * Static value UserAssigned for ManagedServiceIdentityType. + */ public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); - /** Static value SystemAssigned, UserAssigned for ManagedServiceIdentityType. */ + /** + * Static value SystemAssigned, UserAssigned for ManagedServiceIdentityType. + */ public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = fromString("SystemAssigned, UserAssigned"); /** * Creates a new instance of ManagedServiceIdentityType value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -34,18 +43,17 @@ public ManagedServiceIdentityType() { /** * Creates or finds a ManagedServiceIdentityType from its string representation. - * + * * @param name a name to look for. * @return the corresponding ManagedServiceIdentityType. */ - @JsonCreator public static ManagedServiceIdentityType fromString(String name) { return fromString(name, ManagedServiceIdentityType.class); } /** * Gets known ManagedServiceIdentityType values. - * + * * @return known ManagedServiceIdentityType values. */ public static Collection values() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Maps.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Maps.java index 0cd7e379c608..3595d78494c1 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Maps.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Maps.java @@ -7,11 +7,13 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -/** Resource collection API of Maps. */ +/** + * Resource collection API of Maps. + */ public interface Maps { /** * List operations available for the Maps Resource Provider. - * + * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps as paginated response with {@link PagedIterable}. @@ -20,7 +22,7 @@ public interface Maps { /** * List operations available for the Maps Resource Provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -31,7 +33,7 @@ public interface Maps { /** * List operations available for the Maps Resource Provider. - * + * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the set of operations available for Maps as paginated response with {@link PagedIterable}. @@ -40,7 +42,7 @@ public interface Maps { /** * List operations available for the Maps Resource Provider. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccount.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccount.java index da9d91e75f14..2575dc3e5794 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccount.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccount.java @@ -13,122 +13,132 @@ import java.util.List; import java.util.Map; -/** An immutable client-side representation of MapsAccount. */ +/** + * An immutable client-side representation of MapsAccount. + */ public interface MapsAccount { /** * Gets the id property: Fully qualified resource Id for the resource. - * + * * @return the id value. */ String id(); /** * Gets the name property: The name of the resource. - * + * * @return the name value. */ String name(); /** * Gets the type property: The type of the resource. - * + * * @return the type value. */ String type(); /** * Gets the location property: The geo-location where the resource lives. - * + * * @return the location value. */ String location(); /** * Gets the tags property: Resource tags. - * + * * @return the tags value. */ Map tags(); /** * Gets the sku property: The SKU of this account. - * + * * @return the sku value. */ Sku sku(); /** * Gets the kind property: Get or Set Kind property. - * + * * @return the kind value. */ Kind kind(); /** * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. - * + * * @return the systemData value. */ SystemData systemData(); /** * Gets the identity property: Managed service identity (system assigned and/or user assigned identities). - * + * * @return the identity value. */ ManagedServiceIdentity identity(); /** * Gets the properties property: The map account properties. - * + * * @return the properties value. */ MapsAccountProperties properties(); /** * Gets the region of the resource. - * + * * @return the region of the resource. */ Region region(); /** * Gets the name of the resource region. - * + * * @return the name of the resource region. */ String regionName(); /** * Gets the name of the resource group. - * + * * @return the name of the resource group. */ String resourceGroupName(); /** * Gets the inner com.azure.resourcemanager.maps.fluent.models.MapsAccountInner object. - * + * * @return the inner object. */ MapsAccountInner innerModel(); - /** The entirety of the MapsAccount definition. */ + /** + * The entirety of the MapsAccount definition. + */ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, DefinitionStages.WithSku, DefinitionStages.WithCreate { } - /** The MapsAccount definition stages. */ + /** + * The MapsAccount definition stages. + */ interface DefinitionStages { - /** The first stage of the MapsAccount definition. */ + /** + * The first stage of the MapsAccount definition. + */ interface Blank extends WithLocation { } - /** The stage of the MapsAccount definition allowing to specify location. */ + /** + * The stage of the MapsAccount definition allowing to specify location. + */ interface WithLocation { /** * Specifies the region for the resource. - * + * * @param location The geo-location where the resource lives. * @return the next definition stage. */ @@ -136,29 +146,33 @@ interface WithLocation { /** * Specifies the region for the resource. - * + * * @param location The geo-location where the resource lives. * @return the next definition stage. */ WithResourceGroup withRegion(String location); } - /** The stage of the MapsAccount definition allowing to specify parent resource. */ + /** + * The stage of the MapsAccount definition allowing to specify parent resource. + */ interface WithResourceGroup { /** * Specifies resourceGroupName. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @return the next definition stage. */ WithSku withExistingResourceGroup(String resourceGroupName); } - /** The stage of the MapsAccount definition allowing to specify sku. */ + /** + * The stage of the MapsAccount definition allowing to specify sku. + */ interface WithSku { /** * Specifies the sku property: The SKU of this account.. - * + * * @param sku The SKU of this account. * @return the next definition stage. */ @@ -173,59 +187,67 @@ interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithKin DefinitionStages.WithIdentity, DefinitionStages.WithProperties { /** * Executes the create request. - * + * * @return the created resource. */ MapsAccount create(); /** * Executes the create request. - * + * * @param context The context to associate with this operation. * @return the created resource. */ MapsAccount create(Context context); } - /** The stage of the MapsAccount definition allowing to specify tags. */ + /** + * The stage of the MapsAccount definition allowing to specify tags. + */ interface WithTags { /** * Specifies the tags property: Resource tags.. - * + * * @param tags Resource tags. * @return the next definition stage. */ WithCreate withTags(Map tags); } - /** The stage of the MapsAccount definition allowing to specify kind. */ + /** + * The stage of the MapsAccount definition allowing to specify kind. + */ interface WithKind { /** * Specifies the kind property: Get or Set Kind property.. - * + * * @param kind Get or Set Kind property. * @return the next definition stage. */ WithCreate withKind(Kind kind); } - /** The stage of the MapsAccount definition allowing to specify identity. */ + /** + * The stage of the MapsAccount definition allowing to specify identity. + */ interface WithIdentity { /** * Specifies the identity property: Managed service identity (system assigned and/or user assigned * identities). - * + * * @param identity Managed service identity (system assigned and/or user assigned identities). * @return the next definition stage. */ WithCreate withIdentity(ManagedServiceIdentity identity); } - /** The stage of the MapsAccount definition allowing to specify properties. */ + /** + * The stage of the MapsAccount definition allowing to specify properties. + */ interface WithProperties { /** * Specifies the properties property: The map account properties.. - * + * * @param properties The map account properties. * @return the next definition stage. */ @@ -235,141 +257,161 @@ interface WithProperties { /** * Begins update for the MapsAccount resource. - * + * * @return the stage of resource update. */ MapsAccount.Update update(); - /** The template for MapsAccount update. */ + /** + * The template for MapsAccount update. + */ interface Update extends UpdateStages.WithTags, UpdateStages.WithKind, UpdateStages.WithSku, UpdateStages.WithIdentity, UpdateStages.WithDisableLocalAuth, UpdateStages.WithLinkedResources, UpdateStages.WithCors, UpdateStages.WithEncryption { /** * Executes the update request. - * + * * @return the updated resource. */ MapsAccount apply(); /** * Executes the update request. - * + * * @param context The context to associate with this operation. * @return the updated resource. */ MapsAccount apply(Context context); } - /** The MapsAccount update stages. */ + /** + * The MapsAccount update stages. + */ interface UpdateStages { - /** The stage of the MapsAccount update allowing to specify tags. */ + /** + * The stage of the MapsAccount update allowing to specify tags. + */ interface WithTags { /** * Specifies the tags property: Gets or sets a list of key value pairs that describe the resource. These * tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can * be provided for a resource. Each tag must have a key no greater than 128 characters and value no greater * than 256 characters.. - * + * * @param tags Gets or sets a list of key value pairs that describe the resource. These tags can be used in - * viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for - * a resource. Each tag must have a key no greater than 128 characters and value no greater than 256 - * characters. + * viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a + * resource. Each tag must have a key no greater than 128 characters and value no greater than 256 + * characters. * @return the next definition stage. */ Update withTags(Map tags); } - /** The stage of the MapsAccount update allowing to specify kind. */ + /** + * The stage of the MapsAccount update allowing to specify kind. + */ interface WithKind { /** * Specifies the kind property: Get or Set Kind property.. - * + * * @param kind Get or Set Kind property. * @return the next definition stage. */ Update withKind(Kind kind); } - /** The stage of the MapsAccount update allowing to specify sku. */ + /** + * The stage of the MapsAccount update allowing to specify sku. + */ interface WithSku { /** * Specifies the sku property: The SKU of this account.. - * + * * @param sku The SKU of this account. * @return the next definition stage. */ Update withSku(Sku sku); } - /** The stage of the MapsAccount update allowing to specify identity. */ + /** + * The stage of the MapsAccount update allowing to specify identity. + */ interface WithIdentity { /** * Specifies the identity property: Managed service identity (system assigned and/or user assigned * identities). - * + * * @param identity Managed service identity (system assigned and/or user assigned identities). * @return the next definition stage. */ Update withIdentity(ManagedServiceIdentity identity); } - /** The stage of the MapsAccount update allowing to specify disableLocalAuth. */ + /** + * The stage of the MapsAccount update allowing to specify disableLocalAuth. + */ interface WithDisableLocalAuth { /** * Specifies the disableLocalAuth property: Allows toggle functionality on Azure Policy to disable Azure * Maps local authentication support. This will disable Shared Keys and Shared Access Signature Token * authentication from any usage.. - * + * * @param disableLocalAuth Allows toggle functionality on Azure Policy to disable Azure Maps local - * authentication support. This will disable Shared Keys and Shared Access Signature Token - * authentication from any usage. + * authentication support. This will disable Shared Keys and Shared Access Signature Token authentication + * from any usage. * @return the next definition stage. */ Update withDisableLocalAuth(Boolean disableLocalAuth); } - /** The stage of the MapsAccount update allowing to specify linkedResources. */ + /** + * The stage of the MapsAccount update allowing to specify linkedResources. + */ interface WithLinkedResources { /** * Specifies the linkedResources property: The array of associated resources to the Map account. Linked * resource in the array cannot individually update, you must update all linked resources in the array * together. These resources may be used on operations on the Azure Maps REST API. Access is controlled by * the Map Account Managed Identity(s) permissions to those resource(s).. - * + * * @param linkedResources The array of associated resources to the Map account. Linked resource in the array - * cannot individually update, you must update all linked resources in the array together. These - * resources may be used on operations on the Azure Maps REST API. Access is controlled by the Map - * Account Managed Identity(s) permissions to those resource(s). + * cannot individually update, you must update all linked resources in the array together. These resources + * may be used on operations on the Azure Maps REST API. Access is controlled by the Map Account Managed + * Identity(s) permissions to those resource(s). * @return the next definition stage. */ Update withLinkedResources(List linkedResources); } - /** The stage of the MapsAccount update allowing to specify cors. */ + /** + * The stage of the MapsAccount update allowing to specify cors. + */ interface WithCors { /** * Specifies the cors property: Specifies CORS rules for the Blob service. You can include up to five * CorsRule elements in the request. If no CorsRule elements are included in the request body, all CORS * rules will be deleted, and CORS will be disabled for the Blob service.. - * + * * @param cors Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in - * the request. If no CorsRule elements are included in the request body, all CORS rules will be - * deleted, and CORS will be disabled for the Blob service. + * the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, + * and CORS will be disabled for the Blob service. * @return the next definition stage. */ Update withCors(CorsRules cors); } - /** The stage of the MapsAccount update allowing to specify encryption. */ + /** + * The stage of the MapsAccount update allowing to specify encryption. + */ interface WithEncryption { /** * Specifies the encryption property: (Optional) Discouraged to include in resource definition. Only needed * where it is possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of * this. Values are enabled and disabled.. - * + * * @param encryption (Optional) Discouraged to include in resource definition. Only needed where it is - * possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. - * Values are enabled and disabled. + * possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values + * are enabled and disabled. * @return the next definition stage. */ Update withEncryption(Encryption encryption); @@ -378,14 +420,14 @@ interface WithEncryption { /** * Refreshes the resource to sync with Azure. - * + * * @return the refreshed resource. */ MapsAccount refresh(); /** * Refreshes the resource to sync with Azure. - * + * * @param context The context to associate with this operation. * @return the refreshed resource. */ @@ -394,42 +436,44 @@ interface WithEncryption { /** * Create and list an account shared access signature token. Use this SAS token for authentication to Azure Maps * REST APIs through various Azure Maps SDKs. As prerequisite to create a SAS Token. - * - *

Prerequisites: 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the - * account. 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed - * Identity is placed. - * + * + * Prerequisites: + * 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the account. + * 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed Identity is + * placed. + * * @param mapsAccountSasParameters The updated parameters for the Maps Account. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed - * identity permissions on Azure (IAM) Role Based Access Control along with {@link Response}. + * identity permissions on Azure (IAM) Role Based Access Control along with {@link Response}. */ Response listSasWithResponse(AccountSasParameters mapsAccountSasParameters, Context context); /** * Create and list an account shared access signature token. Use this SAS token for authentication to Azure Maps * REST APIs through various Azure Maps SDKs. As prerequisite to create a SAS Token. - * - *

Prerequisites: 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the - * account. 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed - * Identity is placed. - * + * + * Prerequisites: + * 1. Create or have an existing User Assigned Managed Identity in the same Azure region as the account. + * 2. Create or update an Azure Map account with the same Azure region as the User Assigned Managed Identity is + * placed. + * * @param mapsAccountSasParameters The updated parameters for the Maps Account. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a new Sas token which can be used to access the Maps REST APIs and is controlled by the specified Managed - * identity permissions on Azure (IAM) Role Based Access Control. + * identity permissions on Azure (IAM) Role Based Access Control. */ MapsAccountSasToken listSas(AccountSasParameters mapsAccountSasParameters); /** * Get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to the Maps REST APIs. * Only one key is needed at a time; two are given to provide seamless key regeneration. - * + * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -441,7 +485,7 @@ interface WithEncryption { /** * Get the keys to use with the Maps APIs. A key is used to authenticate and authorize access to the Maps REST APIs. * Only one key is needed at a time; two are given to provide seamless key regeneration. - * + * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the keys to use with the Maps APIs. @@ -451,7 +495,7 @@ interface WithEncryption { /** * Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working * immediately. - * + * * @param keySpecification Which key to regenerate: primary or secondary. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -464,7 +508,7 @@ interface WithEncryption { /** * Regenerate either the primary or secondary key for use with the Maps APIs. The old key will stop working * immediately. - * + * * @param keySpecification Which key to regenerate: primary or secondary. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccountKeys.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccountKeys.java index 2affa364b185..17bc9cb49b62 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccountKeys.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccountKeys.java @@ -6,39 +6,41 @@ import com.azure.resourcemanager.maps.fluent.models.MapsAccountKeysInner; -/** An immutable client-side representation of MapsAccountKeys. */ +/** + * An immutable client-side representation of MapsAccountKeys. + */ public interface MapsAccountKeys { /** * Gets the primaryKeyLastUpdated property: The last updated date and time of the primary key. - * + * * @return the primaryKeyLastUpdated value. */ String primaryKeyLastUpdated(); /** * Gets the primaryKey property: The primary key for accessing the Maps REST APIs. - * + * * @return the primaryKey value. */ String primaryKey(); /** * Gets the secondaryKey property: The secondary key for accessing the Maps REST APIs. - * + * * @return the secondaryKey value. */ String secondaryKey(); /** * Gets the secondaryKeyLastUpdated property: The last updated date and time of the secondary key. - * + * * @return the secondaryKeyLastUpdated value. */ String secondaryKeyLastUpdated(); /** * Gets the inner com.azure.resourcemanager.maps.fluent.models.MapsAccountKeysInner object. - * + * * @return the inner object. */ MapsAccountKeysInner innerModel(); diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccountSasToken.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccountSasToken.java index a8177d2c4506..513bd7fe5b02 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccountSasToken.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccountSasToken.java @@ -6,18 +6,20 @@ import com.azure.resourcemanager.maps.fluent.models.MapsAccountSasTokenInner; -/** An immutable client-side representation of MapsAccountSasToken. */ +/** + * An immutable client-side representation of MapsAccountSasToken. + */ public interface MapsAccountSasToken { /** * Gets the accountSasToken property: The shared access signature access token. - * + * * @return the accountSasToken value. */ String accountSasToken(); /** * Gets the inner com.azure.resourcemanager.maps.fluent.models.MapsAccountSasTokenInner object. - * + * * @return the inner object. */ MapsAccountSasTokenInner innerModel(); diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccountUpdateParameters.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccountUpdateParameters.java index 15afd430a22c..499ce5dc99ed 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccountUpdateParameters.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccountUpdateParameters.java @@ -5,49 +5,50 @@ package com.azure.resourcemanager.maps.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.maps.fluent.models.MapsAccountProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; import java.util.Map; -/** Parameters used to update an existing Maps Account. */ +/** + * Parameters used to update an existing Maps Account. + */ @Fluent -public final class MapsAccountUpdateParameters { +public final class MapsAccountUpdateParameters implements JsonSerializable { /* - * Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and - * grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag - * must have a key no greater than 128 characters and value no greater than 256 characters. + * Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping + * this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a + * key no greater than 128 characters and value no greater than 256 characters. */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /* * Get or Set Kind property. */ - @JsonProperty(value = "kind") private Kind kind; /* * The SKU of this account. */ - @JsonProperty(value = "sku") private Sku sku; /* * Managed service identity (system assigned and/or user assigned identities) */ - @JsonProperty(value = "identity") private ManagedServiceIdentity identity; /* * The map account properties. */ - @JsonProperty(value = "properties") private MapsAccountProperties innerProperties; - /** Creates an instance of MapsAccountUpdateParameters class. */ + /** + * Creates an instance of MapsAccountUpdateParameters class. + */ public MapsAccountUpdateParameters() { } @@ -55,7 +56,7 @@ public MapsAccountUpdateParameters() { * Get the tags property: Gets or sets a list of key value pairs that describe the resource. These tags can be used * in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a * resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. - * + * * @return the tags value. */ public Map tags() { @@ -66,7 +67,7 @@ public Map tags() { * Set the tags property: Gets or sets a list of key value pairs that describe the resource. These tags can be used * in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a * resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. - * + * * @param tags the tags value to set. * @return the MapsAccountUpdateParameters object itself. */ @@ -77,7 +78,7 @@ public MapsAccountUpdateParameters withTags(Map tags) { /** * Get the kind property: Get or Set Kind property. - * + * * @return the kind value. */ public Kind kind() { @@ -86,7 +87,7 @@ public Kind kind() { /** * Set the kind property: Get or Set Kind property. - * + * * @param kind the kind value to set. * @return the MapsAccountUpdateParameters object itself. */ @@ -97,7 +98,7 @@ public MapsAccountUpdateParameters withKind(Kind kind) { /** * Get the sku property: The SKU of this account. - * + * * @return the sku value. */ public Sku sku() { @@ -106,7 +107,7 @@ public Sku sku() { /** * Set the sku property: The SKU of this account. - * + * * @param sku the sku value to set. * @return the MapsAccountUpdateParameters object itself. */ @@ -117,7 +118,7 @@ public MapsAccountUpdateParameters withSku(Sku sku) { /** * Get the identity property: Managed service identity (system assigned and/or user assigned identities). - * + * * @return the identity value. */ public ManagedServiceIdentity identity() { @@ -126,7 +127,7 @@ public ManagedServiceIdentity identity() { /** * Set the identity property: Managed service identity (system assigned and/or user assigned identities). - * + * * @param identity the identity value to set. * @return the MapsAccountUpdateParameters object itself. */ @@ -137,7 +138,7 @@ public MapsAccountUpdateParameters withIdentity(ManagedServiceIdentity identity) /** * Get the innerProperties property: The map account properties. - * + * * @return the innerProperties value. */ private MapsAccountProperties innerProperties() { @@ -146,7 +147,7 @@ private MapsAccountProperties innerProperties() { /** * Get the uniqueId property: A unique identifier for the maps account. - * + * * @return the uniqueId value. */ public String uniqueId() { @@ -157,7 +158,7 @@ public String uniqueId() { * Get the disableLocalAuth property: Allows toggle functionality on Azure Policy to disable Azure Maps local * authentication support. This will disable Shared Keys and Shared Access Signature Token authentication from any * usage. - * + * * @return the disableLocalAuth value. */ public Boolean disableLocalAuth() { @@ -168,7 +169,7 @@ public Boolean disableLocalAuth() { * Set the disableLocalAuth property: Allows toggle functionality on Azure Policy to disable Azure Maps local * authentication support. This will disable Shared Keys and Shared Access Signature Token authentication from any * usage. - * + * * @param disableLocalAuth the disableLocalAuth value to set. * @return the MapsAccountUpdateParameters object itself. */ @@ -183,7 +184,7 @@ public MapsAccountUpdateParameters withDisableLocalAuth(Boolean disableLocalAuth /** * Get the provisioningState property: The provisioning state of the Map account resource, Account updates can only * be performed on terminal states. Terminal states: `Succeeded` and `Failed`. - * + * * @return the provisioningState value. */ public String provisioningState() { @@ -195,7 +196,7 @@ public String provisioningState() { * array cannot individually update, you must update all linked resources in the array together. These resources may * be used on operations on the Azure Maps REST API. Access is controlled by the Map Account Managed Identity(s) * permissions to those resource(s). - * + * * @return the linkedResources value. */ public List linkedResources() { @@ -207,7 +208,7 @@ public List linkedResources() { * array cannot individually update, you must update all linked resources in the array together. These resources may * be used on operations on the Azure Maps REST API. Access is controlled by the Map Account Managed Identity(s) * permissions to those resource(s). - * + * * @param linkedResources the linkedResources value to set. * @return the MapsAccountUpdateParameters object itself. */ @@ -223,7 +224,7 @@ public MapsAccountUpdateParameters withLinkedResources(List link * Get the cors property: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in * the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS * will be disabled for the Blob service. - * + * * @return the cors value. */ public CorsRules cors() { @@ -234,7 +235,7 @@ public CorsRules cors() { * Set the cors property: Specifies CORS rules for the Blob service. You can include up to five CorsRule elements in * the request. If no CorsRule elements are included in the request body, all CORS rules will be deleted, and CORS * will be disabled for the Blob service. - * + * * @param cors the cors value to set. * @return the MapsAccountUpdateParameters object itself. */ @@ -250,7 +251,7 @@ public MapsAccountUpdateParameters withCors(CorsRules cors) { * Get the encryption property: (Optional) Discouraged to include in resource definition. Only needed where it is * possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are * enabled and disabled. - * + * * @return the encryption value. */ public Encryption encryption() { @@ -261,7 +262,7 @@ public Encryption encryption() { * Set the encryption property: (Optional) Discouraged to include in resource definition. Only needed where it is * possible to disable platform (AKA infrastructure) encryption. Azure SQL TDE is an example of this. Values are * enabled and disabled. - * + * * @param encryption the encryption value to set. * @return the MapsAccountUpdateParameters object itself. */ @@ -275,7 +276,7 @@ public MapsAccountUpdateParameters withEncryption(Encryption encryption) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -289,4 +290,53 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MapsAccountUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MapsAccountUpdateParameters 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 MapsAccountUpdateParameters. + */ + public static MapsAccountUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MapsAccountUpdateParameters deserializedMapsAccountUpdateParameters = new MapsAccountUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMapsAccountUpdateParameters.tags = tags; + } else if ("kind".equals(fieldName)) { + deserializedMapsAccountUpdateParameters.kind = Kind.fromString(reader.getString()); + } else if ("sku".equals(fieldName)) { + deserializedMapsAccountUpdateParameters.sku = Sku.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedMapsAccountUpdateParameters.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedMapsAccountUpdateParameters.innerProperties = MapsAccountProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMapsAccountUpdateParameters; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccounts.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccounts.java index a7aabfe7f5de..005bc1427fd9 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccounts.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsAccounts.java @@ -5,33 +5,39 @@ package com.azure.resourcemanager.maps.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.maps.fluent.models.MapsAccountInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of Maps Accounts. */ +/** + * A list of Maps Accounts. + */ @Fluent -public final class MapsAccounts { +public final class MapsAccounts implements JsonSerializable { /* * a Maps Account. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * URL client should use to fetch the next page (per server side paging). * It's null for now, added for future use. */ - @JsonProperty(value = "nextLink") private String nextLink; - /** Creates an instance of MapsAccounts class. */ + /** + * Creates an instance of MapsAccounts class. + */ public MapsAccounts() { } /** * Get the value property: a Maps Account. - * + * * @return the value value. */ public List value() { @@ -39,9 +45,9 @@ public List value() { } /** - * Get the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for - * now, added for future use. - * + * Get the nextLink property: URL client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + * * @return the nextLink value. */ public String nextLink() { @@ -49,9 +55,9 @@ public String nextLink() { } /** - * Set the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for - * now, added for future use. - * + * Set the nextLink property: URL client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + * * @param nextLink the nextLink value to set. * @return the MapsAccounts object itself. */ @@ -62,7 +68,7 @@ public MapsAccounts withNextLink(String nextLink) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -70,4 +76,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MapsAccounts from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MapsAccounts 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 MapsAccounts. + */ + public static MapsAccounts fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MapsAccounts deserializedMapsAccounts = new MapsAccounts(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> MapsAccountInner.fromJson(reader1)); + deserializedMapsAccounts.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedMapsAccounts.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMapsAccounts; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsKeySpecification.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsKeySpecification.java index 20ed909dca66..7d7e038ed89f 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsKeySpecification.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsKeySpecification.java @@ -6,24 +6,31 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** Whether the operation refers to the primary or secondary key. */ +/** + * Whether the operation refers to the primary or secondary key. + */ @Fluent -public final class MapsKeySpecification { +public final class MapsKeySpecification implements JsonSerializable { /* * Whether the operation refers to the primary or secondary key. */ - @JsonProperty(value = "keyType", required = true) private KeyType keyType; - /** Creates an instance of MapsKeySpecification class. */ + /** + * Creates an instance of MapsKeySpecification class. + */ public MapsKeySpecification() { } /** * Get the keyType property: Whether the operation refers to the primary or secondary key. - * + * * @return the keyType value. */ public KeyType keyType() { @@ -32,7 +39,7 @@ public KeyType keyType() { /** * Set the keyType property: Whether the operation refers to the primary or secondary key. - * + * * @param keyType the keyType value to set. * @return the MapsKeySpecification object itself. */ @@ -43,15 +50,52 @@ public MapsKeySpecification withKeyType(KeyType keyType) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (keyType() == null) { - throw LOGGER.logExceptionAsError( - new IllegalArgumentException("Missing required property keyType in model MapsKeySpecification")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property keyType in model MapsKeySpecification")); } } private static final ClientLogger LOGGER = new ClientLogger(MapsKeySpecification.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keyType", this.keyType == null ? null : this.keyType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MapsKeySpecification from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MapsKeySpecification 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 MapsKeySpecification. + */ + public static MapsKeySpecification fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MapsKeySpecification deserializedMapsKeySpecification = new MapsKeySpecification(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyType".equals(fieldName)) { + deserializedMapsKeySpecification.keyType = KeyType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMapsKeySpecification; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsOperations.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsOperations.java index b50f9acf5f69..2e50a4f24902 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsOperations.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MapsOperations.java @@ -5,33 +5,39 @@ package com.azure.resourcemanager.maps.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.maps.fluent.models.OperationDetailInner; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** The set of operations available for Maps. */ +/** + * The set of operations available for Maps. + */ @Fluent -public final class MapsOperations { +public final class MapsOperations implements JsonSerializable { /* * An operation available for Maps. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * URL client should use to fetch the next page (per server side paging). * It's null for now, added for future use. */ - @JsonProperty(value = "nextLink") private String nextLink; - /** Creates an instance of MapsOperations class. */ + /** + * Creates an instance of MapsOperations class. + */ public MapsOperations() { } /** * Get the value property: An operation available for Maps. - * + * * @return the value value. */ public List value() { @@ -39,9 +45,9 @@ public List value() { } /** - * Get the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for - * now, added for future use. - * + * Get the nextLink property: URL client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + * * @return the nextLink value. */ public String nextLink() { @@ -49,9 +55,9 @@ public String nextLink() { } /** - * Set the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for - * now, added for future use. - * + * Set the nextLink property: URL client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + * * @param nextLink the nextLink value to set. * @return the MapsOperations object itself. */ @@ -62,7 +68,7 @@ public MapsOperations withNextLink(String nextLink) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -70,4 +76,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MapsOperations from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MapsOperations 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 MapsOperations. + */ + public static MapsOperations fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MapsOperations deserializedMapsOperations = new MapsOperations(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> OperationDetailInner.fromJson(reader1)); + deserializedMapsOperations.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedMapsOperations.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMapsOperations; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MetricSpecification.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MetricSpecification.java index 9b374bd601cc..9ce04bc7be94 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MetricSpecification.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/MetricSpecification.java @@ -5,103 +5,97 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; -/** Metric specification of operation. */ +/** + * Metric specification of operation. + */ @Fluent -public final class MetricSpecification { +public final class MetricSpecification implements JsonSerializable { /* * Name of metric specification. */ - @JsonProperty(value = "name") private String name; /* * Display name of metric specification. */ - @JsonProperty(value = "displayName") private String displayName; /* * Display description of metric specification. */ - @JsonProperty(value = "displayDescription") private String displayDescription; /* * Unit could be Count. */ - @JsonProperty(value = "unit") private String unit; /* * Dimensions of map account. */ - @JsonProperty(value = "dimensions") private List dimensions; /* * Aggregation type could be Average. */ - @JsonProperty(value = "aggregationType") private String aggregationType; /* * The property to decide fill gap with zero or not. */ - @JsonProperty(value = "fillGapWithZero") private Boolean fillGapWithZero; /* * The category this metric specification belong to, could be Capacity. */ - @JsonProperty(value = "category") private String category; /* * Account Resource Id. */ - @JsonProperty(value = "resourceIdDimensionNameOverride") private String resourceIdDimensionNameOverride; /* * Source metrics account. */ - @JsonProperty(value = "sourceMdmAccount") private String sourceMdmAccount; /* * Internal metric name. */ - @JsonProperty(value = "internalMetricName") private String internalMetricName; /* * Lock aggregation type for metrics. */ - @JsonProperty(value = "lockAggregationType") private String lockAggregationType; /* * Metrics namespace. */ - @JsonProperty(value = "sourceMdmNamespace") private String sourceMdmNamespace; /* * Allowed aggregation types for metrics. */ - @JsonProperty(value = "supportedAggregationTypes") private String supportedAggregationTypes; - /** Creates an instance of MetricSpecification class. */ + /** + * Creates an instance of MetricSpecification class. + */ public MetricSpecification() { } /** * Get the name property: Name of metric specification. - * + * * @return the name value. */ public String name() { @@ -110,7 +104,7 @@ public String name() { /** * Set the name property: Name of metric specification. - * + * * @param name the name value to set. * @return the MetricSpecification object itself. */ @@ -121,7 +115,7 @@ public MetricSpecification withName(String name) { /** * Get the displayName property: Display name of metric specification. - * + * * @return the displayName value. */ public String displayName() { @@ -130,7 +124,7 @@ public String displayName() { /** * Set the displayName property: Display name of metric specification. - * + * * @param displayName the displayName value to set. * @return the MetricSpecification object itself. */ @@ -141,7 +135,7 @@ public MetricSpecification withDisplayName(String displayName) { /** * Get the displayDescription property: Display description of metric specification. - * + * * @return the displayDescription value. */ public String displayDescription() { @@ -150,7 +144,7 @@ public String displayDescription() { /** * Set the displayDescription property: Display description of metric specification. - * + * * @param displayDescription the displayDescription value to set. * @return the MetricSpecification object itself. */ @@ -161,7 +155,7 @@ public MetricSpecification withDisplayDescription(String displayDescription) { /** * Get the unit property: Unit could be Count. - * + * * @return the unit value. */ public String unit() { @@ -170,7 +164,7 @@ public String unit() { /** * Set the unit property: Unit could be Count. - * + * * @param unit the unit value to set. * @return the MetricSpecification object itself. */ @@ -181,7 +175,7 @@ public MetricSpecification withUnit(String unit) { /** * Get the dimensions property: Dimensions of map account. - * + * * @return the dimensions value. */ public List dimensions() { @@ -190,7 +184,7 @@ public List dimensions() { /** * Set the dimensions property: Dimensions of map account. - * + * * @param dimensions the dimensions value to set. * @return the MetricSpecification object itself. */ @@ -201,7 +195,7 @@ public MetricSpecification withDimensions(List dimensions) { /** * Get the aggregationType property: Aggregation type could be Average. - * + * * @return the aggregationType value. */ public String aggregationType() { @@ -210,7 +204,7 @@ public String aggregationType() { /** * Set the aggregationType property: Aggregation type could be Average. - * + * * @param aggregationType the aggregationType value to set. * @return the MetricSpecification object itself. */ @@ -221,7 +215,7 @@ public MetricSpecification withAggregationType(String aggregationType) { /** * Get the fillGapWithZero property: The property to decide fill gap with zero or not. - * + * * @return the fillGapWithZero value. */ public Boolean fillGapWithZero() { @@ -230,7 +224,7 @@ public Boolean fillGapWithZero() { /** * Set the fillGapWithZero property: The property to decide fill gap with zero or not. - * + * * @param fillGapWithZero the fillGapWithZero value to set. * @return the MetricSpecification object itself. */ @@ -241,7 +235,7 @@ public MetricSpecification withFillGapWithZero(Boolean fillGapWithZero) { /** * Get the category property: The category this metric specification belong to, could be Capacity. - * + * * @return the category value. */ public String category() { @@ -250,7 +244,7 @@ public String category() { /** * Set the category property: The category this metric specification belong to, could be Capacity. - * + * * @param category the category value to set. * @return the MetricSpecification object itself. */ @@ -261,7 +255,7 @@ public MetricSpecification withCategory(String category) { /** * Get the resourceIdDimensionNameOverride property: Account Resource Id. - * + * * @return the resourceIdDimensionNameOverride value. */ public String resourceIdDimensionNameOverride() { @@ -270,7 +264,7 @@ public String resourceIdDimensionNameOverride() { /** * Set the resourceIdDimensionNameOverride property: Account Resource Id. - * + * * @param resourceIdDimensionNameOverride the resourceIdDimensionNameOverride value to set. * @return the MetricSpecification object itself. */ @@ -281,7 +275,7 @@ public MetricSpecification withResourceIdDimensionNameOverride(String resourceId /** * Get the sourceMdmAccount property: Source metrics account. - * + * * @return the sourceMdmAccount value. */ public String sourceMdmAccount() { @@ -290,7 +284,7 @@ public String sourceMdmAccount() { /** * Set the sourceMdmAccount property: Source metrics account. - * + * * @param sourceMdmAccount the sourceMdmAccount value to set. * @return the MetricSpecification object itself. */ @@ -301,7 +295,7 @@ public MetricSpecification withSourceMdmAccount(String sourceMdmAccount) { /** * Get the internalMetricName property: Internal metric name. - * + * * @return the internalMetricName value. */ public String internalMetricName() { @@ -310,7 +304,7 @@ public String internalMetricName() { /** * Set the internalMetricName property: Internal metric name. - * + * * @param internalMetricName the internalMetricName value to set. * @return the MetricSpecification object itself. */ @@ -321,7 +315,7 @@ public MetricSpecification withInternalMetricName(String internalMetricName) { /** * Get the lockAggregationType property: Lock aggregation type for metrics. - * + * * @return the lockAggregationType value. */ public String lockAggregationType() { @@ -330,7 +324,7 @@ public String lockAggregationType() { /** * Set the lockAggregationType property: Lock aggregation type for metrics. - * + * * @param lockAggregationType the lockAggregationType value to set. * @return the MetricSpecification object itself. */ @@ -341,7 +335,7 @@ public MetricSpecification withLockAggregationType(String lockAggregationType) { /** * Get the sourceMdmNamespace property: Metrics namespace. - * + * * @return the sourceMdmNamespace value. */ public String sourceMdmNamespace() { @@ -350,7 +344,7 @@ public String sourceMdmNamespace() { /** * Set the sourceMdmNamespace property: Metrics namespace. - * + * * @param sourceMdmNamespace the sourceMdmNamespace value to set. * @return the MetricSpecification object itself. */ @@ -361,7 +355,7 @@ public MetricSpecification withSourceMdmNamespace(String sourceMdmNamespace) { /** * Get the supportedAggregationTypes property: Allowed aggregation types for metrics. - * + * * @return the supportedAggregationTypes value. */ public String supportedAggregationTypes() { @@ -370,7 +364,7 @@ public String supportedAggregationTypes() { /** * Set the supportedAggregationTypes property: Allowed aggregation types for metrics. - * + * * @param supportedAggregationTypes the supportedAggregationTypes value to set. * @return the MetricSpecification object itself. */ @@ -381,7 +375,7 @@ public MetricSpecification withSupportedAggregationTypes(String supportedAggrega /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -389,4 +383,80 @@ public void validate() { dimensions().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("displayDescription", this.displayDescription); + jsonWriter.writeStringField("unit", this.unit); + jsonWriter.writeArrayField("dimensions", this.dimensions, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("aggregationType", this.aggregationType); + jsonWriter.writeBooleanField("fillGapWithZero", this.fillGapWithZero); + jsonWriter.writeStringField("category", this.category); + jsonWriter.writeStringField("resourceIdDimensionNameOverride", this.resourceIdDimensionNameOverride); + jsonWriter.writeStringField("sourceMdmAccount", this.sourceMdmAccount); + jsonWriter.writeStringField("internalMetricName", this.internalMetricName); + jsonWriter.writeStringField("lockAggregationType", this.lockAggregationType); + jsonWriter.writeStringField("sourceMdmNamespace", this.sourceMdmNamespace); + jsonWriter.writeStringField("supportedAggregationTypes", this.supportedAggregationTypes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricSpecification from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricSpecification 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 MetricSpecification. + */ + public static MetricSpecification fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricSpecification deserializedMetricSpecification = new MetricSpecification(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedMetricSpecification.name = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedMetricSpecification.displayName = reader.getString(); + } else if ("displayDescription".equals(fieldName)) { + deserializedMetricSpecification.displayDescription = reader.getString(); + } else if ("unit".equals(fieldName)) { + deserializedMetricSpecification.unit = reader.getString(); + } else if ("dimensions".equals(fieldName)) { + List dimensions = reader.readArray(reader1 -> Dimension.fromJson(reader1)); + deserializedMetricSpecification.dimensions = dimensions; + } else if ("aggregationType".equals(fieldName)) { + deserializedMetricSpecification.aggregationType = reader.getString(); + } else if ("fillGapWithZero".equals(fieldName)) { + deserializedMetricSpecification.fillGapWithZero = reader.getNullable(JsonReader::getBoolean); + } else if ("category".equals(fieldName)) { + deserializedMetricSpecification.category = reader.getString(); + } else if ("resourceIdDimensionNameOverride".equals(fieldName)) { + deserializedMetricSpecification.resourceIdDimensionNameOverride = reader.getString(); + } else if ("sourceMdmAccount".equals(fieldName)) { + deserializedMetricSpecification.sourceMdmAccount = reader.getString(); + } else if ("internalMetricName".equals(fieldName)) { + deserializedMetricSpecification.internalMetricName = reader.getString(); + } else if ("lockAggregationType".equals(fieldName)) { + deserializedMetricSpecification.lockAggregationType = reader.getString(); + } else if ("sourceMdmNamespace".equals(fieldName)) { + deserializedMetricSpecification.sourceMdmNamespace = reader.getString(); + } else if ("supportedAggregationTypes".equals(fieldName)) { + deserializedMetricSpecification.supportedAggregationTypes = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMetricSpecification; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Name.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Name.java index 94ab260652ed..69fbb03020db 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Name.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Name.java @@ -5,23 +5,30 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** The name of the SKU, in standard format (such as S0). */ +/** + * The name of the SKU, in standard format (such as S0). + */ public final class Name extends ExpandableStringEnum { - /** Static value S0 for Name. */ + /** + * Static value S0 for Name. + */ public static final Name S0 = fromString("S0"); - /** Static value S1 for Name. */ + /** + * Static value S1 for Name. + */ public static final Name S1 = fromString("S1"); - /** Static value G2 for Name. */ + /** + * Static value G2 for Name. + */ public static final Name G2 = fromString("G2"); /** * Creates a new instance of Name value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -30,18 +37,17 @@ public Name() { /** * Creates or finds a Name from its string representation. - * + * * @param name a name to look for. * @return the corresponding Name. */ - @JsonCreator public static Name fromString(String name) { return fromString(name, Name.class); } /** * Gets known Name values. - * + * * @return known Name values. */ public static Collection values() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/OperationDetail.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/OperationDetail.java index 49fff8338255..df952ab09a39 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/OperationDetail.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/OperationDetail.java @@ -6,46 +6,48 @@ import com.azure.resourcemanager.maps.fluent.models.OperationDetailInner; -/** An immutable client-side representation of OperationDetail. */ +/** + * An immutable client-side representation of OperationDetail. + */ public interface OperationDetail { /** * Gets the name property: Name of the operation. - * + * * @return the name value. */ String name(); /** * Gets the isDataAction property: Indicates whether the operation is a data action. - * + * * @return the isDataAction value. */ Boolean isDataAction(); /** * Gets the display property: Display of the operation. - * + * * @return the display value. */ OperationDisplay display(); /** * Gets the origin property: Origin of the operation. - * + * * @return the origin value. */ String origin(); /** * Gets the serviceSpecification property: One property of operation, include metric specifications. - * + * * @return the serviceSpecification value. */ ServiceSpecification serviceSpecification(); /** * Gets the inner com.azure.resourcemanager.maps.fluent.models.OperationDetailInner object. - * + * * @return the inner object. */ OperationDetailInner innerModel(); diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/OperationDisplay.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/OperationDisplay.java index a672b2417ed9..d2e423899b73 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/OperationDisplay.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/OperationDisplay.java @@ -5,42 +5,46 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Operation display payload. */ +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Operation display payload. + */ @Fluent -public final class OperationDisplay { +public final class OperationDisplay implements JsonSerializable { /* * Resource provider of the operation */ - @JsonProperty(value = "provider") private String provider; /* * Resource of the operation */ - @JsonProperty(value = "resource") private String resource; /* * Localized friendly name for the operation */ - @JsonProperty(value = "operation") private String operation; /* * Localized friendly description for the operation */ - @JsonProperty(value = "description") private String description; - /** Creates an instance of OperationDisplay class. */ + /** + * Creates an instance of OperationDisplay class. + */ public OperationDisplay() { } /** * Get the provider property: Resource provider of the operation. - * + * * @return the provider value. */ public String provider() { @@ -49,7 +53,7 @@ public String provider() { /** * Set the provider property: Resource provider of the operation. - * + * * @param provider the provider value to set. * @return the OperationDisplay object itself. */ @@ -60,7 +64,7 @@ public OperationDisplay withProvider(String provider) { /** * Get the resource property: Resource of the operation. - * + * * @return the resource value. */ public String resource() { @@ -69,7 +73,7 @@ public String resource() { /** * Set the resource property: Resource of the operation. - * + * * @param resource the resource value to set. * @return the OperationDisplay object itself. */ @@ -80,7 +84,7 @@ public OperationDisplay withResource(String resource) { /** * Get the operation property: Localized friendly name for the operation. - * + * * @return the operation value. */ public String operation() { @@ -89,7 +93,7 @@ public String operation() { /** * Set the operation property: Localized friendly name for the operation. - * + * * @param operation the operation value to set. * @return the OperationDisplay object itself. */ @@ -100,7 +104,7 @@ public OperationDisplay withOperation(String operation) { /** * Get the description property: Localized friendly description for the operation. - * + * * @return the description value. */ public String description() { @@ -109,7 +113,7 @@ public String description() { /** * Set the description property: Localized friendly description for the operation. - * + * * @param description the description value to set. * @return the OperationDisplay object itself. */ @@ -120,9 +124,54 @@ public OperationDisplay withDescription(String description) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("provider", this.provider); + jsonWriter.writeStringField("resource", this.resource); + jsonWriter.writeStringField("operation", this.operation); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay 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 OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/ServiceSpecification.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/ServiceSpecification.java index 1a6b37cb16de..8ffd84f4865d 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/ServiceSpecification.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/ServiceSpecification.java @@ -5,25 +5,32 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.annotation.Fluent; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; -/** One property of operation, include metric specifications. */ +/** + * One property of operation, include metric specifications. + */ @Fluent -public final class ServiceSpecification { +public final class ServiceSpecification implements JsonSerializable { /* * Metric specifications of operation. */ - @JsonProperty(value = "metricSpecifications") private List metricSpecifications; - /** Creates an instance of ServiceSpecification class. */ + /** + * Creates an instance of ServiceSpecification class. + */ public ServiceSpecification() { } /** * Get the metricSpecifications property: Metric specifications of operation. - * + * * @return the metricSpecifications value. */ public List metricSpecifications() { @@ -32,7 +39,7 @@ public List metricSpecifications() { /** * Set the metricSpecifications property: Metric specifications of operation. - * + * * @param metricSpecifications the metricSpecifications value to set. * @return the ServiceSpecification object itself. */ @@ -43,7 +50,7 @@ public ServiceSpecification withMetricSpecifications(List m /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -51,4 +58,43 @@ public void validate() { metricSpecifications().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("metricSpecifications", this.metricSpecifications, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceSpecification from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceSpecification 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 ServiceSpecification. + */ + public static ServiceSpecification fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceSpecification deserializedServiceSpecification = new ServiceSpecification(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metricSpecifications".equals(fieldName)) { + List metricSpecifications + = reader.readArray(reader1 -> MetricSpecification.fromJson(reader1)); + deserializedServiceSpecification.metricSpecifications = metricSpecifications; + } else { + reader.skipChildren(); + } + } + + return deserializedServiceSpecification; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/SigningKey.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/SigningKey.java index a11ecaf6f1b0..b064e6ba8c50 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/SigningKey.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/SigningKey.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** @@ -13,18 +12,24 @@ * and using `managedIdentity` will use the auto-renewed private key to sign the SAS. */ public final class SigningKey extends ExpandableStringEnum { - /** Static value primaryKey for SigningKey. */ + /** + * Static value primaryKey for SigningKey. + */ public static final SigningKey PRIMARY_KEY = fromString("primaryKey"); - /** Static value secondaryKey for SigningKey. */ + /** + * Static value secondaryKey for SigningKey. + */ public static final SigningKey SECONDARY_KEY = fromString("secondaryKey"); - /** Static value managedIdentity for SigningKey. */ + /** + * Static value managedIdentity for SigningKey. + */ public static final SigningKey MANAGED_IDENTITY = fromString("managedIdentity"); /** * Creates a new instance of SigningKey value. - * + * * @deprecated Use the {@link #fromString(String)} factory method. */ @Deprecated @@ -33,18 +38,17 @@ public SigningKey() { /** * Creates or finds a SigningKey from its string representation. - * + * * @param name a name to look for. * @return the corresponding SigningKey. */ - @JsonCreator public static SigningKey fromString(String name) { return fromString(name, SigningKey.class); } /** * Gets known SigningKey values. - * + * * @return known SigningKey values. */ public static Collection values() { diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Sku.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Sku.java index 160b6b10fa8c..11556094a4fc 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Sku.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/Sku.java @@ -6,30 +6,36 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** The SKU of the Maps Account. */ +/** + * The SKU of the Maps Account. + */ @Fluent -public final class Sku { +public final class Sku implements JsonSerializable { /* * The name of the SKU, in standard format (such as S0). */ - @JsonProperty(value = "name", required = true) private Name name; /* * Gets the sku tier. This is based on the SKU name. */ - @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) private String tier; - /** Creates an instance of Sku class. */ + /** + * Creates an instance of Sku class. + */ public Sku() { } /** * Get the name property: The name of the SKU, in standard format (such as S0). - * + * * @return the name value. */ public Name name() { @@ -38,7 +44,7 @@ public Name name() { /** * Set the name property: The name of the SKU, in standard format (such as S0). - * + * * @param name the name value to set. * @return the Sku object itself. */ @@ -49,7 +55,7 @@ public Sku withName(Name name) { /** * Get the tier property: Gets the sku tier. This is based on the SKU name. - * + * * @return the tier value. */ public String tier() { @@ -58,15 +64,53 @@ public String tier() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (name() == null) { - throw LOGGER - .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Sku")); + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Sku")); } } private static final ClientLogger LOGGER = new ClientLogger(Sku.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name == null ? null : this.name.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Sku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Sku 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 Sku. + */ + public static Sku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Sku deserializedSku = new Sku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSku.name = Name.fromString(reader.getString()); + } else if ("tier".equals(fieldName)) { + deserializedSku.tier = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSku; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/UserAssignedIdentity.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/UserAssignedIdentity.java index 21aa0c1b4c73..acdb4f432bf9 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/UserAssignedIdentity.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/UserAssignedIdentity.java @@ -5,31 +5,37 @@ package com.azure.resourcemanager.maps.models; import com.azure.core.annotation.Immutable; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.UUID; -/** User assigned identity properties. */ +/** + * User assigned identity properties. + */ @Immutable -public final class UserAssignedIdentity { +public final class UserAssignedIdentity implements JsonSerializable { /* * The principal ID of the assigned identity. */ - @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) private UUID principalId; /* * The client ID of the assigned identity. */ - @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) private UUID clientId; - /** Creates an instance of UserAssignedIdentity class. */ + /** + * Creates an instance of UserAssignedIdentity class. + */ public UserAssignedIdentity() { } /** * Get the principalId property: The principal ID of the assigned identity. - * + * * @return the principalId value. */ public UUID principalId() { @@ -38,7 +44,7 @@ public UUID principalId() { /** * Get the clientId property: The client ID of the assigned identity. - * + * * @return the clientId value. */ public UUID clientId() { @@ -47,9 +53,48 @@ public UUID clientId() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity 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 UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/package-info.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/package-info.java index 25b44597c518..edb09506fa01 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/package-info.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/models/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the data models for AzureMapsManagementClient. Azure Maps. */ +/** + * Package containing the data models for AzureMapsManagementClient. + * Azure Maps. + */ package com.azure.resourcemanager.maps.models; diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/package-info.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/package-info.java index 7de5abc0e32f..741f55ea4665 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/package-info.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/com/azure/resourcemanager/maps/package-info.java @@ -2,5 +2,8 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -/** Package containing the classes for AzureMapsManagementClient. Azure Maps. */ +/** + * Package containing the classes for AzureMapsManagementClient. + * Azure Maps. + */ package com.azure.resourcemanager.maps; diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/java/module-info.java b/sdk/maps/azure-resourcemanager-maps/src/main/java/module-info.java index 325bb429fb0c..939c08b23fd0 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/main/java/module-info.java +++ b/sdk/maps/azure-resourcemanager-maps/src/main/java/module-info.java @@ -10,6 +10,6 @@ exports com.azure.resourcemanager.maps.fluent.models; exports com.azure.resourcemanager.maps.models; - opens com.azure.resourcemanager.maps.fluent.models to com.azure.core, com.fasterxml.jackson.databind; - opens com.azure.resourcemanager.maps.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.maps.fluent.models to com.azure.core; + opens com.azure.resourcemanager.maps.models to com.azure.core; } diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-maps/proxy-config.json b/sdk/maps/azure-resourcemanager-maps/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-maps/proxy-config.json new file mode 100644 index 000000000000..88cdeaa6ac2e --- /dev/null +++ b/sdk/maps/azure-resourcemanager-maps/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-maps/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.maps.implementation.AccountsClientImpl$AccountsService"],["com.azure.resourcemanager.maps.implementation.CreatorsClientImpl$CreatorsService"],["com.azure.resourcemanager.maps.implementation.MapsClientImpl$MapsService"]] \ No newline at end of file diff --git a/sdk/maps/azure-resourcemanager-maps/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-maps/reflect-config.json b/sdk/maps/azure-resourcemanager-maps/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-maps/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/maps/azure-resourcemanager-maps/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-maps/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsCreateOrUpdateSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsCreateOrUpdateSamples.java index bbb8a4980268..84805727cb53 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsCreateOrUpdateSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsCreateOrUpdateSamples.java @@ -22,146 +22,115 @@ import java.util.HashMap; import java.util.Map; -/** Samples for Accounts CreateOrUpdate. */ +/** + * Samples for Accounts CreateOrUpdate. + */ public final class AccountsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccountGen2.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccountGen2.json */ /** * Sample code: Create Gen2 Account. - * + * * @param manager Entry point to AzureMapsManager. */ public static void createGen2Account(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() + manager.accounts() .define("myMapsAccount") .withRegion("eastus") .withExistingResourceGroup("myResourceGroup") .withSku(new Sku().withName(Name.G2)) .withTags(mapOf("test", "true")) .withKind(Kind.GEN2) - .withProperties( - new MapsAccountProperties() - .withDisableLocalAuth(true) - .withCors( - new CorsRules() - .withCorsRules( - Arrays - .asList( - new CorsRule() - .withAllowedOrigins( - Arrays.asList("http://www.contoso.com", "http://www.fabrikam.com")))))) + .withProperties(new MapsAccountProperties().withDisableLocalAuth(true) + .withCors(new CorsRules().withCorsRules(Arrays.asList(new CorsRule() + .withAllowedOrigins(Arrays.asList("http://www.contoso.com", "http://www.fabrikam.com")))))) .create(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccountEncryption.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccountEncryption.json */ /** * Sample code: Create Account with Encryption. - * + * * @param manager Entry point to AzureMapsManager. */ public static void createAccountWithEncryption(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() + manager.accounts() .define("myMapsAccount") .withRegion("eastus") .withExistingResourceGroup("myResourceGroup") .withSku(new Sku().withName(Name.G2)) .withKind(Kind.GEN2) - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", - new UserAssignedIdentity()))) - .withProperties( - new MapsAccountProperties() - .withEncryption( - new Encryption() - .withCustomerManagedKeyEncryption( - new CustomerManagedKeyEncryption() - .withKeyEncryptionKeyIdentity( - new CustomerManagedKeyEncryptionKeyIdentity() - .withIdentityType(IdentityType.USER_ASSIGNED_IDENTITY) - .withUserAssignedIdentityResourceId( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName")) - .withKeyEncryptionKeyUrl("fakeTokenPlaceholder")))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", + new UserAssignedIdentity()))) + .withProperties(new MapsAccountProperties() + .withEncryption(new Encryption().withCustomerManagedKeyEncryption(new CustomerManagedKeyEncryption() + .withKeyEncryptionKeyIdentity(new CustomerManagedKeyEncryptionKeyIdentity() + .withIdentityType(IdentityType.USER_ASSIGNED_IDENTITY) + .withUserAssignedIdentityResourceId( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName")) + .withKeyEncryptionKeyUrl("fakeTokenPlaceholder")))) .create(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccount.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccount.json */ /** * Sample code: Create Gen1 Account. - * + * * @param manager Entry point to AzureMapsManager. */ public static void createGen1Account(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() + manager.accounts() .define("myMapsAccount") .withRegion("eastus") .withExistingResourceGroup("myResourceGroup") .withSku(new Sku().withName(Name.S0)) .withTags(mapOf("test", "true")) .withKind(Kind.GEN1) - .withProperties( - new MapsAccountProperties() - .withDisableLocalAuth(false) - .withCors( - new CorsRules() - .withCorsRules( - Arrays - .asList( - new CorsRule() - .withAllowedOrigins( - Arrays.asList("http://www.contoso.com", "http://www.fabrikam.com")))))) + .withProperties(new MapsAccountProperties().withDisableLocalAuth(false) + .withCors(new CorsRules().withCorsRules(Arrays.asList(new CorsRule() + .withAllowedOrigins(Arrays.asList("http://www.contoso.com", "http://www.fabrikam.com")))))) .create(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccountManagedIdentity.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateAccountManagedIdentity.json */ /** * Sample code: Create Account with Managed Identities. - * + * * @param manager Entry point to AzureMapsManager. */ public static void createAccountWithManagedIdentities(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() + manager.accounts() .define("myMapsAccount") .withRegion("eastus") .withExistingResourceGroup("myResourceGroup") .withSku(new Sku().withName(Name.G2)) .withTags(mapOf("test", "true")) .withKind(Kind.GEN2) - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", - new UserAssignedIdentity()))) - .withProperties( - new MapsAccountProperties() - .withDisableLocalAuth(false) - .withLinkedResources( - Arrays - .asList( - new LinkedResource() - .withUniqueName("myBatchStorageAccount") - .withId( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.Storage/accounts/mystorageacc"), - new LinkedResource() - .withUniqueName("myBlobDataSource") - .withId( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.Storage/accounts/mystorageacc")))) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", + new UserAssignedIdentity()))) + .withProperties(new MapsAccountProperties().withDisableLocalAuth(false) + .withLinkedResources(Arrays.asList(new LinkedResource().withUniqueName("myBatchStorageAccount") + .withId( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.Storage/accounts/mystorageacc"), + new LinkedResource().withUniqueName("myBlobDataSource") + .withId( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.Storage/accounts/mystorageacc")))) .create(); } diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsDeleteSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsDeleteSamples.java index 41adb97bf6de..2b85059f99e6 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsDeleteSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsDeleteSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.maps.generated; -/** Samples for Accounts Delete. */ +/** + * Samples for Accounts Delete. + */ public final class AccountsDeleteSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/DeleteAccount.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/DeleteAccount.json */ /** * Sample code: DeleteAccount. - * + * * @param manager Entry point to AzureMapsManager. */ public static void deleteAccount(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() + manager.accounts() .deleteByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE); } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsGetByResourceGroupSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsGetByResourceGroupSamples.java index 6db728411e07..54f4051c1a33 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsGetByResourceGroupSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsGetByResourceGroupSamples.java @@ -4,19 +4,20 @@ package com.azure.resourcemanager.maps.generated; -/** Samples for Accounts GetByResourceGroup. */ +/** + * Samples for Accounts GetByResourceGroup. + */ public final class AccountsGetByResourceGroupSamples { /* * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetAccount.json */ /** * Sample code: GetAccount. - * + * * @param manager Entry point to AzureMapsManager. */ public static void getAccount(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() + manager.accounts() .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE); } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListByResourceGroupSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListByResourceGroupSamples.java index 9d418fe505cc..5aef190a3434 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListByResourceGroupSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListByResourceGroupSamples.java @@ -4,14 +4,17 @@ package com.azure.resourcemanager.maps.generated; -/** Samples for Accounts ListByResourceGroup. */ +/** + * Samples for Accounts ListByResourceGroup. + */ public final class AccountsListByResourceGroupSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListAccountsByResourceGroup.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListAccountsByResourceGroup.json */ /** * Sample code: List Accounts By Resource Group. - * + * * @param manager Entry point to AzureMapsManager. */ public static void listAccountsByResourceGroup(com.azure.resourcemanager.maps.AzureMapsManager manager) { diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListKeysSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListKeysSamples.java index 768f5f56c9dd..ae055625a653 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListKeysSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListKeysSamples.java @@ -4,14 +4,16 @@ package com.azure.resourcemanager.maps.generated; -/** Samples for Accounts ListKeys. */ +/** + * Samples for Accounts ListKeys. + */ public final class AccountsListKeysSamples { /* * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListKeys.json */ /** * Sample code: List Keys. - * + * * @param manager Entry point to AzureMapsManager. */ public static void listKeys(com.azure.resourcemanager.maps.AzureMapsManager manager) { diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListSamples.java index 6d38fc9549a8..7a7e25f528aa 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListSamples.java @@ -4,14 +4,17 @@ package com.azure.resourcemanager.maps.generated; -/** Samples for Accounts List. */ +/** + * Samples for Accounts List. + */ public final class AccountsListSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListAccountsBySubscription.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListAccountsBySubscription.json */ /** * Sample code: List Accounts By Subscription. - * + * * @param manager Entry point to AzureMapsManager. */ public static void listAccountsBySubscription(com.azure.resourcemanager.maps.AzureMapsManager manager) { diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListSasSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListSasSamples.java index a35d37ded1ca..590468112253 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListSasSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsListSasSamples.java @@ -8,24 +8,23 @@ import com.azure.resourcemanager.maps.models.SigningKey; import java.util.Arrays; -/** Samples for Accounts ListSas. */ +/** + * Samples for Accounts ListSas. + */ public final class AccountsListSasSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/AccountListSAS.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/AccountListSAS.json */ /** * Sample code: List Account Sas. - * + * * @param manager Entry point to AzureMapsManager. */ public static void listAccountSas(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() - .listSasWithResponse( - "myResourceGroup", - "myMapsAccount", - new AccountSasParameters() - .withSigningKey(SigningKey.PRIMARY_KEY) + manager.accounts() + .listSasWithResponse("myResourceGroup", "myMapsAccount", + new AccountSasParameters().withSigningKey(SigningKey.PRIMARY_KEY) .withPrincipalId("e917f87b-324d-4728-98ed-e31d311a7d65") .withRegions(Arrays.asList("eastus")) .withMaxRatePerSecond(500) diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsRegenerateKeysSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsRegenerateKeysSamples.java index d130601badc6..ab910d592bea 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsRegenerateKeysSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsRegenerateKeysSamples.java @@ -7,23 +7,22 @@ import com.azure.resourcemanager.maps.models.KeyType; import com.azure.resourcemanager.maps.models.MapsKeySpecification; -/** Samples for Accounts RegenerateKeys. */ +/** + * Samples for Accounts RegenerateKeys. + */ public final class AccountsRegenerateKeysSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/RegenerateKey.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/RegenerateKey.json */ /** * Sample code: Regenerate Key. - * + * * @param manager Entry point to AzureMapsManager. */ public static void regenerateKey(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .accounts() - .regenerateKeysWithResponse( - "myResourceGroup", - "myMapsAccount", - new MapsKeySpecification().withKeyType(KeyType.PRIMARY), - com.azure.core.util.Context.NONE); + manager.accounts() + .regenerateKeysWithResponse("myResourceGroup", "myMapsAccount", + new MapsKeySpecification().withKeyType(KeyType.PRIMARY), com.azure.core.util.Context.NONE); } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsUpdateSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsUpdateSamples.java index f270d5fdb8ef..ad229f893745 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsUpdateSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/AccountsUpdateSamples.java @@ -20,125 +20,107 @@ import java.util.HashMap; import java.util.Map; -/** Samples for Accounts Update. */ +/** + * Samples for Accounts Update. + */ public final class AccountsUpdateSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountGen2.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountGen2.json */ /** * Sample code: Update to Gen2 Account. - * + * * @param manager Entry point to AzureMapsManager. */ public static void updateToGen2Account(com.azure.resourcemanager.maps.AzureMapsManager manager) { - MapsAccount resource = - manager - .accounts() - .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) - .getValue(); + MapsAccount resource = manager.accounts() + .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withKind(Kind.GEN2).withSku(new Sku().withName(Name.G2)).apply(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccount.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccount.json */ /** * Sample code: Update Account Tags. - * + * * @param manager Entry point to AzureMapsManager. */ public static void updateAccountTags(com.azure.resourcemanager.maps.AzureMapsManager manager) { - MapsAccount resource = - manager - .accounts() - .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) - .getValue(); + MapsAccount resource = manager.accounts() + .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("specialTag", "true")).apply(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountManagedIdentity.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountManagedIdentity.json */ /** * Sample code: Update Account Managed Identities. - * + * * @param manager Entry point to AzureMapsManager. */ public static void updateAccountManagedIdentities(com.azure.resourcemanager.maps.AzureMapsManager manager) { - MapsAccount resource = - manager - .accounts() - .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) - .getValue(); - resource - .update() + MapsAccount resource = manager.accounts() + .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() .withKind(Kind.GEN2) .withSku(new Sku().withName(Name.G2)) - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", - new UserAssignedIdentity()))) - .withLinkedResources( - Arrays - .asList( - new LinkedResource() - .withUniqueName("myBatchStorageAccount") - .withId( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{storageName}"))) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", + new UserAssignedIdentity()))) + .withLinkedResources(Arrays.asList(new LinkedResource().withUniqueName("myBatchStorageAccount") + .withId( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/accounts/{storageName}"))) .apply(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountGen1.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountGen1.json */ /** * Sample code: Update to Gen1 Account. - * + * * @param manager Entry point to AzureMapsManager. */ public static void updateToGen1Account(com.azure.resourcemanager.maps.AzureMapsManager manager) { - MapsAccount resource = - manager - .accounts() - .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) - .getValue(); + MapsAccount resource = manager.accounts() + .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withKind(Kind.GEN1).withSku(new Sku().withName(Name.S1)).apply(); } /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountEncryption.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateAccountEncryption.json */ /** * Sample code: Update Account Encryption. - * + * * @param manager Entry point to AzureMapsManager. */ public static void updateAccountEncryption(com.azure.resourcemanager.maps.AzureMapsManager manager) { - MapsAccount resource = - manager - .accounts() - .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) - .getValue(); - resource - .update() - .withIdentity( - new ManagedServiceIdentity() - .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) - .withUserAssignedIdentities( - mapOf( - "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", - null))) - .withEncryption( - new Encryption() - .withCustomerManagedKeyEncryption( - new CustomerManagedKeyEncryption() - .withKeyEncryptionKeyIdentity( - new CustomerManagedKeyEncryptionKeyIdentity() - .withIdentityType(IdentityType.SYSTEM_ASSIGNED_IDENTITY)) - .withKeyEncryptionKeyUrl("fakeTokenPlaceholder"))) + MapsAccount resource = manager.accounts() + .getByResourceGroupWithResponse("myResourceGroup", "myMapsAccount", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/21a9967a-e8a9-4656-a70b-96ff1c4d05a0/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName", + null))) + .withEncryption(new Encryption().withCustomerManagedKeyEncryption(new CustomerManagedKeyEncryption() + .withKeyEncryptionKeyIdentity(new CustomerManagedKeyEncryptionKeyIdentity() + .withIdentityType(IdentityType.SYSTEM_ASSIGNED_IDENTITY)) + .withKeyEncryptionKeyUrl("fakeTokenPlaceholder"))) .apply(); } diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsCreateOrUpdateSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsCreateOrUpdateSamples.java index 1c5d4302b942..e532da710350 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsCreateOrUpdateSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsCreateOrUpdateSamples.java @@ -8,19 +8,21 @@ import java.util.HashMap; import java.util.Map; -/** Samples for Creators CreateOrUpdate. */ +/** + * Samples for Creators CreateOrUpdate. + */ public final class CreatorsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateMapsCreator.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/CreateMapsCreator.json */ /** * Sample code: Create Creator Resource. - * + * * @param manager Entry point to AzureMapsManager. */ public static void createCreatorResource(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .creators() + manager.creators() .define("myCreator") .withRegion("eastus2") .withExistingAccount("myResourceGroup", "myMapsAccount") diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsDeleteSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsDeleteSamples.java index a834c77dd55f..3deb6d7c8442 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsDeleteSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsDeleteSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.maps.generated; -/** Samples for Creators Delete. */ +/** + * Samples for Creators Delete. + */ public final class CreatorsDeleteSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/DeleteMapsCreator.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/DeleteMapsCreator.json */ /** * Sample code: Delete Creator Resource. - * + * * @param manager Entry point to AzureMapsManager. */ public static void deleteCreatorResource(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .creators() + manager.creators() .deleteWithResponse("myResourceGroup", "myMapsAccount", "myCreator", com.azure.core.util.Context.NONE); } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsGetSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsGetSamples.java index a46c09070f48..03f70b8b63c1 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsGetSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsGetSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.maps.generated; -/** Samples for Creators Get. */ +/** + * Samples for Creators Get. + */ public final class CreatorsGetSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetMapsCreator.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetMapsCreator.json */ /** * Sample code: Get Creator Resource. - * + * * @param manager Entry point to AzureMapsManager. */ public static void getCreatorResource(com.azure.resourcemanager.maps.AzureMapsManager manager) { - manager - .creators() + manager.creators() .getWithResponse("myResourceGroup", "myMapsAccount", "myCreator", com.azure.core.util.Context.NONE); } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsListByAccountSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsListByAccountSamples.java index c24b5d361dd7..3f0a29b36176 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsListByAccountSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsListByAccountSamples.java @@ -4,14 +4,17 @@ package com.azure.resourcemanager.maps.generated; -/** Samples for Creators ListByAccount. */ +/** + * Samples for Creators ListByAccount. + */ public final class CreatorsListByAccountSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListMapsCreatorsByAccount.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/ListMapsCreatorsByAccount.json */ /** * Sample code: List Creator Resources By Account. - * + * * @param manager Entry point to AzureMapsManager. */ public static void listCreatorResourcesByAccount(com.azure.resourcemanager.maps.AzureMapsManager manager) { diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsUpdateSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsUpdateSamples.java index cba2b40f3ee9..eddd34d0cb87 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsUpdateSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/CreatorsUpdateSamples.java @@ -8,22 +8,23 @@ import java.util.HashMap; import java.util.Map; -/** Samples for Creators Update. */ +/** + * Samples for Creators Update. + */ public final class CreatorsUpdateSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateMapsCreator.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/UpdateMapsCreator.json */ /** * Sample code: Update Creator Resource. - * + * * @param manager Entry point to AzureMapsManager. */ public static void updateCreatorResource(com.azure.resourcemanager.maps.AzureMapsManager manager) { - Creator resource = - manager - .creators() - .getWithResponse("myResourceGroup", "myMapsAccount", "myCreator", com.azure.core.util.Context.NONE) - .getValue(); + Creator resource = manager.creators() + .getWithResponse("myResourceGroup", "myMapsAccount", "myCreator", com.azure.core.util.Context.NONE) + .getValue(); resource.update().withTags(mapOf("specialTag", "true")).withStorageUnits(10).apply(); } diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/MapsListOperationsSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/MapsListOperationsSamples.java index c5331cab155e..6321fe20e1c0 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/MapsListOperationsSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/MapsListOperationsSamples.java @@ -4,14 +4,17 @@ package com.azure.resourcemanager.maps.generated; -/** Samples for Maps ListOperations. */ +/** + * Samples for Maps ListOperations. + */ public final class MapsListOperationsSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetOperations.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetOperations.json */ /** * Sample code: Get Operations. - * + * * @param manager Entry point to AzureMapsManager. */ public static void getOperations(com.azure.resourcemanager.maps.AzureMapsManager manager) { diff --git a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/MapsListSamples.java b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/MapsListSamples.java index ade8e16a749a..bcbf3e33b61f 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/MapsListSamples.java +++ b/sdk/maps/azure-resourcemanager-maps/src/samples/java/com/azure/resourcemanager/maps/generated/MapsListSamples.java @@ -4,14 +4,17 @@ package com.azure.resourcemanager.maps.generated; -/** Samples for Maps List. */ +/** + * Samples for Maps List. + */ public final class MapsListSamples { /* - * x-ms-original-file: specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetOperationsSubscription.json + * x-ms-original-file: + * specification/maps/resource-manager/Microsoft.Maps/stable/2023-06-01/examples/GetOperationsSubscription.json */ /** * Sample code: Get Operations by Subscription. - * + * * @param manager Entry point to AzureMapsManager. */ public static void getOperationsBySubscription(com.azure.resourcemanager.maps.AzureMapsManager manager) { diff --git a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/AccountsDeleteByResourceGroupWithResponseMockTests.java b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/AccountsDeleteByResourceGroupWithResponseMockTests.java index 0ba9ca3ed1b3..af89daf3ee39 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/AccountsDeleteByResourceGroupWithResponseMockTests.java +++ b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/AccountsDeleteByResourceGroupWithResponseMockTests.java @@ -6,46 +6,28 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.maps.AzureMapsManager; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class AccountsDeleteByResourceGroupWithResponseMockTests { @Test public void testDeleteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AzureMapsManager manager = AzureMapsManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); manager.accounts().deleteByResourceGroupWithResponse("tcc", "g", com.azure.core.util.Context.NONE); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsCreateOrUpdateWithResponseMockTests.java b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsCreateOrUpdateWithResponseMockTests.java index b6de13a49eed..143e78e75368 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsCreateOrUpdateWithResponseMockTests.java +++ b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsCreateOrUpdateWithResponseMockTests.java @@ -6,47 +6,28 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.maps.AzureMapsManager; import com.azure.resourcemanager.maps.fluent.models.CreatorProperties; import com.azure.resourcemanager.maps.models.Creator; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class CreatorsCreateOrUpdateWithResponseMockTests { @Test public void testCreateOrUpdateWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"properties\":{\"provisioningState\":\"wlycoduhpkxkg\",\"storageUnits\":1081662268},\"location\":\"re\",\"tags\":{\"ubeddg\":\"jxqugjhky\"},\"id\":\"sofwqmzqalkrmnji\",\"name\":\"pxacqqudfn\",\"type\":\"yxbaaabjyvayf\"}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AzureMapsManager manager = AzureMapsManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsDeleteWithResponseMockTests.java b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsDeleteWithResponseMockTests.java index bb3441369fde..48fd98bcb306 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsDeleteWithResponseMockTests.java +++ b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsDeleteWithResponseMockTests.java @@ -6,46 +6,28 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.maps.AzureMapsManager; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class CreatorsDeleteWithResponseMockTests { @Test public void testDeleteWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AzureMapsManager manager = AzureMapsManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), new AzureProfile("", "", AzureEnvironment.AZURE)); manager.creators().deleteWithResponse("stkwqqtch", "alm", "mtdaa", com.azure.core.util.Context.NONE); + } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsGetWithResponseMockTests.java b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsGetWithResponseMockTests.java index b0ef38e140d6..c3d0a37ef5bf 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsGetWithResponseMockTests.java +++ b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsGetWithResponseMockTests.java @@ -6,44 +6,25 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.maps.AzureMapsManager; import com.azure.resourcemanager.maps.models.Creator; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class CreatorsGetWithResponseMockTests { @Test public void testGetWithResponse() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"properties\":{\"provisioningState\":\"mnpkukghimdblxg\",\"storageUnits\":261614569},\"location\":\"fnjhfjxwmszkkfo\",\"tags\":{\"jawneaiv\":\"yfkzik\",\"elsfeaen\":\"wczelpci\",\"dxbjhwuaanozj\":\"abfatkl\"},\"id\":\"sphyoulpjrvxa\",\"name\":\"l\",\"type\":\"vimjwos\"}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AzureMapsManager manager = AzureMapsManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsListByAccountMockTests.java b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsListByAccountMockTests.java index 09708db81b7e..2e1a56709630 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsListByAccountMockTests.java +++ b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CreatorsListByAccountMockTests.java @@ -6,45 +6,26 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.PagedIterable; import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.maps.AzureMapsManager; import com.azure.resourcemanager.maps.models.Creator; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class CreatorsListByAccountMockTests { @Test public void testListByAccount() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"properties\":{\"provisioningState\":\"y\",\"storageUnits\":427983093},\"location\":\"gjltdtbnnhado\",\"tags\":{\"hnvpamqgxq\":\"kvci\",\"zikywgg\":\"u\",\"uipiccjzk\":\"kallatmel\"},\"id\":\"ivgvvcna\",\"name\":\"rhyrnxxmueed\",\"type\":\"drd\"}]}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AzureMapsManager manager = AzureMapsManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CustomerManagedKeyEncryptionKeyIdentityTests.java b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CustomerManagedKeyEncryptionKeyIdentityTests.java index c31aa924eda3..8d8d0c79f00e 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CustomerManagedKeyEncryptionKeyIdentityTests.java +++ b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/CustomerManagedKeyEncryptionKeyIdentityTests.java @@ -14,11 +14,11 @@ public final class CustomerManagedKeyEncryptionKeyIdentityTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { CustomerManagedKeyEncryptionKeyIdentity model = BinaryData.fromString( - "{\"identityType\":\"delegatedResourceIdentity\",\"userAssignedIdentityResourceId\":\"odmailzyd\",\"delegatedIdentityClientId\":\"456ffc73-a669-42b8-bea9-179d11afd233\"}") + "{\"identityType\":\"delegatedResourceIdentity\",\"userAssignedIdentityResourceId\":\"odmailzyd\",\"delegatedIdentityClientId\":\"a0e174af-345d-42e6-bacd-29ecdc7473cc\"}") .toObject(CustomerManagedKeyEncryptionKeyIdentity.class); Assertions.assertEquals(IdentityType.DELEGATED_RESOURCE_IDENTITY, model.identityType()); Assertions.assertEquals("odmailzyd", model.userAssignedIdentityResourceId()); - Assertions.assertEquals(UUID.fromString("456ffc73-a669-42b8-bea9-179d11afd233"), + Assertions.assertEquals(UUID.fromString("a0e174af-345d-42e6-bacd-29ecdc7473cc"), model.delegatedIdentityClientId()); } @@ -27,11 +27,11 @@ public void testSerialize() throws Exception { CustomerManagedKeyEncryptionKeyIdentity model = new CustomerManagedKeyEncryptionKeyIdentity().withIdentityType(IdentityType.DELEGATED_RESOURCE_IDENTITY) .withUserAssignedIdentityResourceId("odmailzyd") - .withDelegatedIdentityClientId(UUID.fromString("456ffc73-a669-42b8-bea9-179d11afd233")); + .withDelegatedIdentityClientId(UUID.fromString("a0e174af-345d-42e6-bacd-29ecdc7473cc")); model = BinaryData.fromObject(model).toObject(CustomerManagedKeyEncryptionKeyIdentity.class); Assertions.assertEquals(IdentityType.DELEGATED_RESOURCE_IDENTITY, model.identityType()); Assertions.assertEquals("odmailzyd", model.userAssignedIdentityResourceId()); - Assertions.assertEquals(UUID.fromString("456ffc73-a669-42b8-bea9-179d11afd233"), + Assertions.assertEquals(UUID.fromString("a0e174af-345d-42e6-bacd-29ecdc7473cc"), model.delegatedIdentityClientId()); } } diff --git a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/ManagedServiceIdentityTests.java b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/ManagedServiceIdentityTests.java index 36a4b9a95b75..9310d6da2f9f 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/ManagedServiceIdentityTests.java +++ b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/ManagedServiceIdentityTests.java @@ -16,7 +16,7 @@ public final class ManagedServiceIdentityTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ManagedServiceIdentity model = BinaryData.fromString( - "{\"principalId\":\"2aef289f-c921-40e4-b578-0013ca801fbd\",\"tenantId\":\"44ebfffd-814e-4bd1-9dc1-92f694f6c915\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"mofcq\":{\"principalId\":\"73904b5a-57bb-424d-993f-d2f0b22c7100\",\"clientId\":\"1db3cfb4-9917-4436-96aa-5e74f26de891\"},\"yurkdtmlxhekuksj\":{\"principalId\":\"254f61d2-3289-4cd4-be6c-e59e59337b88\",\"clientId\":\"ab60788f-9ffc-4382-aa52-58d325a08171\"},\"kc\":{\"principalId\":\"0d226a2e-284e-4183-882e-ba972266012b\",\"clientId\":\"e98ebf53-8bf8-413d-92d1-395d04df3d65\"}}}") + "{\"principalId\":\"3b6287d3-4ebb-479e-af44-af26f6abffb2\",\"tenantId\":\"17ee488b-52fd-43d5-8938-79eb21d138c8\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"mofcq\":{\"principalId\":\"c8f0179e-fdae-4056-b9be-e037ddeccccb\",\"clientId\":\"eb25c9a4-9168-4207-bc20-6598563073b9\"},\"yurkdtmlxhekuksj\":{\"principalId\":\"145c1af3-df87-4e20-90d6-170ba66bd515\",\"clientId\":\"6a1cff1f-cd11-4102-89c5-c71f6424cc75\"},\"kc\":{\"principalId\":\"bc284bd3-3177-4178-8474-f92b04f05079\",\"clientId\":\"7fa4cb59-ff69-4190-9c7c-6d77dad4b6e0\"}}}") .toObject(ManagedServiceIdentity.class); Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); } diff --git a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/MapsListMockTests.java b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/MapsListMockTests.java index 0ace59722b85..4bd468c7841d 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/MapsListMockTests.java +++ b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/MapsListMockTests.java @@ -6,45 +6,26 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.PagedIterable; import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.maps.AzureMapsManager; import com.azure.resourcemanager.maps.models.OperationDetail; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class MapsListMockTests { @Test public void testList() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"name\":\"pajqgxysm\",\"isDataAction\":false,\"display\":{\"provider\":\"fqvm\",\"resource\":\"xozap\",\"operation\":\"elxprglyatddck\",\"description\":\"cuejrjxgci\"},\"origin\":\"brh\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[{\"name\":\"rhzo\",\"displayName\":\"i\",\"displayDescription\":\"rq\",\"unit\":\"bahwfl\",\"dimensions\":[{},{},{}],\"aggregationType\":\"tmhrkwofyyvoqacp\",\"fillGapWithZero\":true,\"category\":\"btgiwbwoenwas\",\"resourceIdDimensionNameOverride\":\"tdtkcn\",\"sourceMdmAccount\":\"wbpokulpiujwaasi\",\"internalMetricName\":\"i\",\"lockAggregationType\":\"byuqerpqlp\",\"sourceMdmNamespace\":\"cciuqgbdbutau\",\"supportedAggregationTypes\":\"btkuwhh\"},{\"name\":\"ykojoxafnndlpic\",\"displayName\":\"o\",\"displayDescription\":\"kcdyhbpk\",\"unit\":\"wdreqnovvqfovl\",\"dimensions\":[{},{}],\"aggregationType\":\"suwsyrsnds\",\"fillGapWithZero\":false,\"category\":\"dgvraeaeneq\",\"resourceIdDimensionNameOverride\":\"arrwlquu\",\"sourceMdmAccount\":\"fqka\",\"internalMetricName\":\"wiipfpub\",\"lockAggregationType\":\"bwwift\",\"sourceMdmNamespace\":\"qkvpuvksgplsakn\",\"supportedAggregationTypes\":\"fsynljphuop\"},{\"name\":\"dlqiyntorzih\",\"displayName\":\"osjswsr\",\"displayDescription\":\"lyzrpzbchckqqzqi\",\"unit\":\"iysui\",\"dimensions\":[{},{},{},{}],\"aggregationType\":\"ked\",\"fillGapWithZero\":true,\"category\":\"wyhqmibzyhwits\",\"resourceIdDimensionNameOverride\":\"pyy\",\"sourceMdmAccount\":\"cdpu\",\"internalMetricName\":\"zgmwznmabikns\",\"lockAggregationType\":\"gj\",\"sourceMdmNamespace\":\"bldtlww\",\"supportedAggregationTypes\":\"kdmtncvokotll\"}]}}}]}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AzureMapsManager manager = AzureMapsManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/MapsListOperationsMockTests.java b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/MapsListOperationsMockTests.java index 0a241f3ad85a..e4a1dd4ce229 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/MapsListOperationsMockTests.java +++ b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/MapsListOperationsMockTests.java @@ -6,45 +6,26 @@ import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.PagedIterable; import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.maps.AzureMapsManager; import com.azure.resourcemanager.maps.models.OperationDetail; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Mockito; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; public final class MapsListOperationsMockTests { @Test public void testListOperations() throws Exception { - HttpClient httpClient = Mockito.mock(HttpClient.class); - HttpResponse httpResponse = Mockito.mock(HttpResponse.class); - ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); - String responseStr = "{\"value\":[{\"name\":\"aqolbgycduiertg\",\"isDataAction\":false,\"display\":{\"provider\":\"aolps\",\"resource\":\"qlfmmdnbb\",\"operation\":\"zpswiydmc\",\"description\":\"hzdxssadbzm\"},\"origin\":\"dfznudaodv\",\"properties\":{\"serviceSpecification\":{\"metricSpecifications\":[{\"name\":\"lylpstdb\",\"displayName\":\"xsrz\",\"displayDescription\":\"ucerscdntnevfi\",\"unit\":\"mygtdssls\",\"dimensions\":[{},{},{}],\"aggregationType\":\"eriofzpyqs\",\"fillGapWithZero\":false,\"category\":\"bnetshh\",\"resourceIdDimensionNameOverride\":\"h\",\"sourceMdmAccount\":\"plvwiwubmwmbes\",\"internalMetricName\":\"nkww\",\"lockAggregationType\":\"pjflcxogao\",\"sourceMdmNamespace\":\"nzmnsikvm\",\"supportedAggregationTypes\":\"ze\"},{\"name\":\"kdltfzxmhhvhg\",\"displayName\":\"eodkwobda\",\"displayDescription\":\"tibqdxbxwakb\",\"unit\":\"qxn\",\"dimensions\":[{},{},{}],\"aggregationType\":\"gxhuriplbp\",\"fillGapWithZero\":true,\"category\":\"nkbebxmuby\",\"resourceIdDimensionNameOverride\":\"twlrbqt\",\"sourceMdmAccount\":\"ievseotgqrllt\",\"internalMetricName\":\"wlauwzizxbmpg\",\"lockAggregationType\":\"efuzmuvpbttd\",\"sourceMdmNamespace\":\"orppxebmnzbtb\",\"supportedAggregationTypes\":\"pglkf\"},{\"name\":\"hdneuelfph\",\"displayName\":\"yhtozfikdowwqu\",\"displayDescription\":\"xzxcl\",\"unit\":\"thhqzonosggbh\",\"dimensions\":[{},{},{},{}],\"aggregationType\":\"wdsjnkalju\",\"fillGapWithZero\":false,\"category\":\"wacf\",\"resourceIdDimensionNameOverride\":\"dkzzewkfvhqcrail\",\"sourceMdmAccount\":\"n\",\"internalMetricName\":\"fuflrwdmhdlx\",\"lockAggregationType\":\"rxsagafcnihgwqa\",\"sourceMdmNamespace\":\"edgfbcvkcvq\",\"supportedAggregationTypes\":\"keqdcvdrhvoods\"},{\"name\":\"bobzdopcjwvnhd\",\"displayName\":\"wmgxcxrsl\",\"displayDescription\":\"utwu\",\"unit\":\"grpkhjwniyqs\",\"dimensions\":[{}],\"aggregationType\":\"pdggkzzlvm\",\"fillGapWithZero\":true,\"category\":\"xmodf\",\"resourceIdDimensionNameOverride\":\"efyw\",\"sourceMdmAccount\":\"pfvmwyhrfou\",\"internalMetricName\":\"taakc\",\"lockAggregationType\":\"iyzvqtmnub\",\"sourceMdmNamespace\":\"kpzksmondjmq\",\"supportedAggregationTypes\":\"vypomgkopkwho\"}]}}}]}"; - Mockito.when(httpResponse.getStatusCode()).thenReturn(200); - Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); - Mockito.when(httpResponse.getBody()) - .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); - Mockito.when(httpResponse.getBodyAsByteArray()) - .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); - Mockito.when(httpClient.send(httpRequest.capture(), Mockito.any())).thenReturn(Mono.defer(() -> { - Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); - return Mono.just(httpResponse); - })); - + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AzureMapsManager manager = AzureMapsManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), diff --git a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/UserAssignedIdentityTests.java b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/UserAssignedIdentityTests.java index eac564589680..ac92ca05711f 100644 --- a/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/UserAssignedIdentityTests.java +++ b/sdk/maps/azure-resourcemanager-maps/src/test/java/com/azure/resourcemanager/maps/generated/UserAssignedIdentityTests.java @@ -11,7 +11,7 @@ public final class UserAssignedIdentityTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { UserAssignedIdentity model = BinaryData.fromString( - "{\"principalId\":\"e6c49af9-aebc-4882-ac18-1d78e84ed3c1\",\"clientId\":\"aa57eefa-31c8-49f3-9c29-9e2a5c3aa959\"}") + "{\"principalId\":\"18144e6f-e03c-476c-84ba-f88c3589d6c2\",\"clientId\":\"6c76553d-a2a0-450e-9520-fba6acccd0c7\"}") .toObject(UserAssignedIdentity.class); }