From 9f3a597b9ae3156ea407ea36abc930fd1b54c03d Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Tue, 31 Mar 2026 05:08:33 +0000 Subject: [PATCH 1/2] Configurations: 'specification/relationships/Relationships.Management/tspconfig.yaml', API Version: 2023-09-01-preview, SDK Release Type: beta, and CommitSHA: 'ab5c0abaf718ad3ad3328695dc8e1eb5b3bfd38c' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6084812 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 8 + .../README.md | 102 ++++ .../SAMPLE.md | 201 +++++++ .../pom.xml | 74 +++ .../relationships/RelationshipsManager.java | 315 +++++++++++ .../DependencyOfRelationshipsClient.java | 159 ++++++ .../fluent/OperationsClient.java | 40 ++ .../fluent/RelationshipsManagementClient.java | 62 +++ ...ServiceGroupMemberRelationshipsClient.java | 160 ++++++ .../models/DependencyOfRelationshipInner.java | 157 ++++++ .../fluent/models/OperationInner.java | 150 +++++ .../ServiceGroupMemberRelationshipInner.java | 157 ++++++ .../fluent/models/package-info.java | 9 + .../relationships/fluent/package-info.java | 9 + .../DependencyOfRelationshipImpl.java | 125 +++++ .../DependencyOfRelationshipsClientImpl.java | 510 +++++++++++++++++ .../DependencyOfRelationshipsImpl.java | 128 +++++ .../implementation/OperationImpl.java | 51 ++ .../implementation/OperationsClientImpl.java | 242 +++++++++ .../implementation/OperationsImpl.java | 45 ++ .../RelationshipsManagementClientBuilder.java | 122 +++++ .../RelationshipsManagementClientImpl.java | 324 +++++++++++ .../implementation/ResourceManagerUtils.java | 195 +++++++ .../ServiceGroupMemberRelationshipImpl.java | 125 +++++ ...iceGroupMemberRelationshipsClientImpl.java | 513 ++++++++++++++++++ .../ServiceGroupMemberRelationshipsImpl.java | 128 +++++ .../models/OperationListResult.java | 96 ++++ .../implementation/package-info.java | 9 + .../relationships/models/ActionType.java | 46 ++ .../models/DependencyOfRelationship.java | 180 ++++++ .../DependencyOfRelationshipProperties.java | 181 ++++++ .../models/DependencyOfRelationships.java | 113 ++++ .../relationships/models/Operation.java | 58 ++ .../models/OperationDisplay.java | 128 +++++ .../relationships/models/Operations.java | 35 ++ .../relationships/models/Origin.java | 57 ++ .../models/ProvisioningState.java | 76 +++ .../models/RelationshipMetadata.java | 90 +++ .../models/RelationshipOriginInformation.java | 92 ++++ .../models/RelationshipOrigins.java | 61 +++ .../ServiceGroupMemberRelationship.java | 180 ++++++ ...viceGroupMemberRelationshipProperties.java | 183 +++++++ .../ServiceGroupMemberRelationships.java | 113 ++++ .../relationships/models/package-info.java | 9 + .../relationships/package-info.java | 9 + .../src/main/java/module-info.java | 16 + ...esourcemanager-relationships_metadata.json | 1 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + ...e-resourcemanager-relationships.properties | 1 + ...yOfRelationshipsCreateOrUpdateSamples.java | 32 ++ ...ependencyOfRelationshipsDeleteSamples.java | 26 + .../DependencyOfRelationshipsGetSamples.java | 26 + .../generated/OperationsListSamples.java | 22 + ...berRelationshipsCreateOrUpdateSamples.java | 32 ++ ...GroupMemberRelationshipsDeleteSamples.java | 26 + ...iceGroupMemberRelationshipsGetSamples.java | 26 + .../DependencyOfRelationshipInnerTests.java | 30 + ...pendencyOfRelationshipPropertiesTests.java | 29 + ...fRelationshipsCreateOrUpdateMockTests.java | 44 ++ ...RelationshipsGetWithResponseMockTests.java | 40 ++ .../generated/OperationDisplayTests.java | 17 + .../generated/OperationInnerTests.java | 17 + .../generated/OperationListResultTests.java | 19 + .../generated/OperationsListMockTests.java | 36 ++ .../generated/RelationshipMetadataTests.java | 17 + .../RelationshipOriginInformationTests.java | 17 + ...viceGroupMemberRelationshipInnerTests.java | 31 ++ ...roupMemberRelationshipPropertiesTests.java | 30 + ...rRelationshipsCreateOrUpdateMockTests.java | 43 ++ ...RelationshipsGetWithResponseMockTests.java | 40 ++ .../tsp-location.yaml | 4 + sdk/relationships/ci.yml | 46 ++ sdk/relationships/pom.xml | 15 + 76 files changed, 6514 insertions(+) create mode 100644 sdk/relationships/azure-resourcemanager-relationships/CHANGELOG.md create mode 100644 sdk/relationships/azure-resourcemanager-relationships/README.md create mode 100644 sdk/relationships/azure-resourcemanager-relationships/SAMPLE.md create mode 100644 sdk/relationships/azure-resourcemanager-relationships/pom.xml create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/RelationshipsManager.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/DependencyOfRelationshipsClient.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/OperationsClient.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/RelationshipsManagementClient.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/ServiceGroupMemberRelationshipsClient.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/DependencyOfRelationshipInner.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/OperationInner.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/ServiceGroupMemberRelationshipInner.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/package-info.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/package-info.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipImpl.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipsClientImpl.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipsImpl.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/OperationImpl.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/OperationsClientImpl.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/OperationsImpl.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/RelationshipsManagementClientBuilder.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/RelationshipsManagementClientImpl.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ResourceManagerUtils.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipImpl.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipsClientImpl.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipsImpl.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/models/OperationListResult.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/package-info.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ActionType.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationship.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationshipProperties.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationships.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/Operation.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/OperationDisplay.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/Operations.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/Origin.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ProvisioningState.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/RelationshipMetadata.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/RelationshipOriginInformation.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/RelationshipOrigins.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationship.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationshipProperties.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationships.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/package-info.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/package-info.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/java/module-info.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/resources/META-INF/azure-resourcemanager-relationships_metadata.json create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-relationships/proxy-config.json create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-relationships/reflect-config.json create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/main/resources/azure-resourcemanager-relationships.properties create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsCreateOrUpdateSamples.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsDeleteSamples.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsGetSamples.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/OperationsListSamples.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsCreateOrUpdateSamples.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsDeleteSamples.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsGetSamples.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipInnerTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipPropertiesTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsCreateOrUpdateMockTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsGetWithResponseMockTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationDisplayTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationInnerTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationListResultTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationsListMockTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/RelationshipMetadataTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/RelationshipOriginInformationTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipInnerTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipPropertiesTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsCreateOrUpdateMockTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsGetWithResponseMockTests.java create mode 100644 sdk/relationships/azure-resourcemanager-relationships/tsp-location.yaml create mode 100644 sdk/relationships/ci.yml create mode 100644 sdk/relationships/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 3a1a23875c27..403c996f0a07 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -523,6 +523,7 @@ com.azure.resourcemanager:azure-resourcemanager-computebulkactions;1.0.0-beta.1; com.azure.resourcemanager:azure-resourcemanager-artifactsigning;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-appnetwork;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-servicegroups;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-relationships;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.2;2.0.0-beta.2 diff --git a/pom.xml b/pom.xml index a865180fc213..4f5396e1533c 100644 --- a/pom.xml +++ b/pom.xml @@ -220,6 +220,7 @@ sdk/redhatopenshift sdk/redis sdk/redisenterprise + sdk/relationships sdk/relay sdk/reservations sdk/resourceconnector diff --git a/sdk/relationships/azure-resourcemanager-relationships/CHANGELOG.md b/sdk/relationships/azure-resourcemanager-relationships/CHANGELOG.md new file mode 100644 index 000000000000..bf3c33180fb2 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2026-03-31) + +- Azure Resource Manager relationships client library for Java. This package contains Microsoft Azure SDK for relationships Management SDK. Microsoft.Relationships Resource Provider management API. Package api-version 2023-09-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-relationships Java SDK. diff --git a/sdk/relationships/azure-resourcemanager-relationships/README.md b/sdk/relationships/azure-resourcemanager-relationships/README.md new file mode 100644 index 000000000000..89f07d2a19ac --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager relationships client library for Java + +Azure Resource Manager relationships client library for Java. + +This package contains Microsoft Azure SDK for relationships Management SDK. Microsoft.Relationships Resource Provider management API. Package api-version 2023-09-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-relationships;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-relationships + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +RelationshipsManager manager = RelationshipsManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/relationships/azure-resourcemanager-relationships/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[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 +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/relationships/azure-resourcemanager-relationships/SAMPLE.md b/sdk/relationships/azure-resourcemanager-relationships/SAMPLE.md new file mode 100644 index 000000000000..60a3241a2621 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/SAMPLE.md @@ -0,0 +1,201 @@ +# Code snippets and samples + + +## DependencyOfRelationships + +- [CreateOrUpdate](#dependencyofrelationships_createorupdate) +- [Delete](#dependencyofrelationships_delete) +- [Get](#dependencyofrelationships_get) + +## Operations + +- [List](#operations_list) + +## ServiceGroupMemberRelationships + +- [CreateOrUpdate](#servicegroupmemberrelationships_createorupdate) +- [Delete](#servicegroupmemberrelationships_delete) +- [Get](#servicegroupmemberrelationships_get) +### DependencyOfRelationships_CreateOrUpdate + +```java +import com.azure.resourcemanager.relationships.models.DependencyOfRelationshipProperties; + +/** + * Samples for DependencyOfRelationships CreateOrUpdate. + */ +public final class DependencyOfRelationshipsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2023-09-01-preview/DependencyOfRelationships_CreateOrUpdate.json + */ + /** + * Sample code: DependencyOfRelationships_CreateOrUpdate. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void + dependencyOfRelationshipsCreateOrUpdate(com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.dependencyOfRelationships() + .define("relationshipOne") + .withExistingResourceUri( + "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account") + .withProperties(new DependencyOfRelationshipProperties().withTargetId( + "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg123/providers/Microsoft.Web/staticSites/test-site") + .withTargetTenant("72f988bf-86f1-41af-91ab-2d7cd011db47")) + .create(); + } +} +``` + +### DependencyOfRelationships_Delete + +```java +/** + * Samples for DependencyOfRelationships Delete. + */ +public final class DependencyOfRelationshipsDeleteSamples { + /* + * x-ms-original-file: 2023-09-01-preview/DependencyOfRelationships_Delete.json + */ + /** + * Sample code: DependencyOfRelationships_Delete. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void + dependencyOfRelationshipsDelete(com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.dependencyOfRelationships() + .delete( + "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account", + "relationshipOne", com.azure.core.util.Context.NONE); + } +} +``` + +### DependencyOfRelationships_Get + +```java +/** + * Samples for DependencyOfRelationships Get. + */ +public final class DependencyOfRelationshipsGetSamples { + /* + * x-ms-original-file: 2023-09-01-preview/DependencyOfRelationships_Get.json + */ + /** + * Sample code: DependencyOfRelationships_Get. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void + dependencyOfRelationshipsGet(com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.dependencyOfRelationships() + .getWithResponse( + "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account", + "relationshipOne", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2023-09-01-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void operationsList(com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### ServiceGroupMemberRelationships_CreateOrUpdate + +```java +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationshipProperties; + +/** + * Samples for ServiceGroupMemberRelationships CreateOrUpdate. + */ +public final class ServiceGroupMemberRelationshipsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2023-09-01-preview/ServiceGroupMemberRelationships_CreateOrUpdate.json + */ + /** + * Sample code: ServiceGroupMemberRelationships_CreateOrUpdate. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void serviceGroupMemberRelationshipsCreateOrUpdate( + com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.serviceGroupMemberRelationships() + .define("sg1") + .withExistingResourceUri( + "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account") + .withProperties(new ServiceGroupMemberRelationshipProperties() + .withTargetId("/providers/Microsoft.Management/serviceGroups/sg1") + .withTargetTenant("72f988bf-86f1-41af-91ab-2d7cd011db47")) + .create(); + } +} +``` + +### ServiceGroupMemberRelationships_Delete + +```java +/** + * Samples for ServiceGroupMemberRelationships Delete. + */ +public final class ServiceGroupMemberRelationshipsDeleteSamples { + /* + * x-ms-original-file: 2023-09-01-preview/ServiceGroupMemberRelationships_Delete.json + */ + /** + * Sample code: ServiceGroupMemberRelationships_Delete. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void + serviceGroupMemberRelationshipsDelete(com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.serviceGroupMemberRelationships() + .delete( + "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account", + "sg1", com.azure.core.util.Context.NONE); + } +} +``` + +### ServiceGroupMemberRelationships_Get + +```java +/** + * Samples for ServiceGroupMemberRelationships Get. + */ +public final class ServiceGroupMemberRelationshipsGetSamples { + /* + * x-ms-original-file: 2023-09-01-preview/ServiceGroupMemberRelationships_Get.json + */ + /** + * Sample code: ServiceGroupMemberRelationships_Get. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void + serviceGroupMemberRelationshipsGet(com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.serviceGroupMemberRelationships() + .getWithResponse( + "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account", + "sg1", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/relationships/azure-resourcemanager-relationships/pom.xml b/sdk/relationships/azure-resourcemanager-relationships/pom.xml new file mode 100644 index 000000000000..3e68e293d0c0 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-relationships + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for relationships Management + This package contains Microsoft Azure SDK for relationships Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft.Relationships Resource Provider management API. Package api-version 2023-09-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.57.1 + + + com.azure + azure-core-management + 1.19.3 + + + com.azure + azure-core-test + 1.27.0-beta.14 + test + + + com.azure + azure-identity + 1.18.2 + test + + + diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/RelationshipsManager.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/RelationshipsManager.java new file mode 100644 index 000000000000..04fbaf5cd204 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/RelationshipsManager.java @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +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.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.relationships.fluent.RelationshipsManagementClient; +import com.azure.resourcemanager.relationships.implementation.DependencyOfRelationshipsImpl; +import com.azure.resourcemanager.relationships.implementation.OperationsImpl; +import com.azure.resourcemanager.relationships.implementation.RelationshipsManagementClientBuilder; +import com.azure.resourcemanager.relationships.implementation.ServiceGroupMemberRelationshipsImpl; +import com.azure.resourcemanager.relationships.models.DependencyOfRelationships; +import com.azure.resourcemanager.relationships.models.Operations; +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationships; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to RelationshipsManager. + * Microsoft.Relationships Resource Provider management API. + */ +public final class RelationshipsManager { + private Operations operations; + + private DependencyOfRelationships dependencyOfRelationships; + + private ServiceGroupMemberRelationships serviceGroupMemberRelationships; + + private final RelationshipsManagementClient clientObject; + + private RelationshipsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new RelationshipsManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of relationships service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the relationships service API instance. + */ + public static RelationshipsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of relationships service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the relationships service API instance. + */ + public static RelationshipsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new RelationshipsManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create RelationshipsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new RelationshipsManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-relationships.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * 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. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of relationships service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the relationships service API instance. + */ + public RelationshipsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.relationships") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + 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())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new RelationshipsManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of DependencyOfRelationships. It manages DependencyOfRelationship. + * + * @return Resource collection API of DependencyOfRelationships. + */ + public DependencyOfRelationships dependencyOfRelationships() { + if (this.dependencyOfRelationships == null) { + this.dependencyOfRelationships + = new DependencyOfRelationshipsImpl(clientObject.getDependencyOfRelationships(), this); + } + return dependencyOfRelationships; + } + + /** + * Gets the resource collection API of ServiceGroupMemberRelationships. It manages ServiceGroupMemberRelationship. + * + * @return Resource collection API of ServiceGroupMemberRelationships. + */ + public ServiceGroupMemberRelationships serviceGroupMemberRelationships() { + if (this.serviceGroupMemberRelationships == null) { + this.serviceGroupMemberRelationships + = new ServiceGroupMemberRelationshipsImpl(clientObject.getServiceGroupMemberRelationships(), this); + } + return serviceGroupMemberRelationships; + } + + /** + * Gets wrapped service client RelationshipsManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client RelationshipsManagementClient. + */ + public RelationshipsManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/DependencyOfRelationshipsClient.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/DependencyOfRelationshipsClient.java new file mode 100644 index 000000000000..08ababb34318 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/DependencyOfRelationshipsClient.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.relationships.fluent.models.DependencyOfRelationshipInner; + +/** + * An instance of this class provides access to all the operations defined in DependencyOfRelationshipsClient. + */ +public interface DependencyOfRelationshipsClient { + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 the {@link SyncPoller} for polling of defines a dependencyOf relationship resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DependencyOfRelationshipInner> + beginCreateOrUpdate(String resourceUri, String name, DependencyOfRelationshipInner resource); + + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 the {@link SyncPoller} for polling of defines a dependencyOf relationship resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DependencyOfRelationshipInner> + beginCreateOrUpdate(String resourceUri, String name, DependencyOfRelationshipInner resource, Context context); + + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 defines a dependencyOf relationship resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DependencyOfRelationshipInner createOrUpdate(String resourceUri, String name, + DependencyOfRelationshipInner resource); + + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 defines a dependencyOf relationship resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DependencyOfRelationshipInner createOrUpdate(String resourceUri, String name, + DependencyOfRelationshipInner resource, Context context); + + /** + * Get a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 DependencyOfRelationship along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String name, Context context); + + /** + * Get a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 DependencyOfRelationship. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DependencyOfRelationshipInner get(String resourceUri, String name); + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceUri, String name); + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceUri, String name, Context context); + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, String name); + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, String name, Context context); +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/OperationsClient.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/OperationsClient.java new file mode 100644 index 000000000000..c486f833e9fb --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.relationships.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/RelationshipsManagementClient.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/RelationshipsManagementClient.java new file mode 100644 index 000000000000..ca85e8d70f1a --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/RelationshipsManagementClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for RelationshipsManagementClient class. + */ +public interface RelationshipsManagementClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @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 OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the DependencyOfRelationshipsClient object to access its operations. + * + * @return the DependencyOfRelationshipsClient object. + */ + DependencyOfRelationshipsClient getDependencyOfRelationships(); + + /** + * Gets the ServiceGroupMemberRelationshipsClient object to access its operations. + * + * @return the ServiceGroupMemberRelationshipsClient object. + */ + ServiceGroupMemberRelationshipsClient getServiceGroupMemberRelationships(); +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/ServiceGroupMemberRelationshipsClient.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/ServiceGroupMemberRelationshipsClient.java new file mode 100644 index 000000000000..4a5b2f39f8af --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/ServiceGroupMemberRelationshipsClient.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.relationships.fluent.models.ServiceGroupMemberRelationshipInner; + +/** + * An instance of this class provides access to all the operations defined in ServiceGroupMemberRelationshipsClient. + */ +public interface ServiceGroupMemberRelationshipsClient { + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 the {@link SyncPoller} for polling of defines a ServiceGroupMember relationship resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServiceGroupMemberRelationshipInner> + beginCreateOrUpdate(String resourceUri, String name, ServiceGroupMemberRelationshipInner resource); + + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 the {@link SyncPoller} for polling of defines a ServiceGroupMember relationship resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServiceGroupMemberRelationshipInner> + beginCreateOrUpdate(String resourceUri, String name, ServiceGroupMemberRelationshipInner resource, + Context context); + + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 defines a ServiceGroupMember relationship resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceGroupMemberRelationshipInner createOrUpdate(String resourceUri, String name, + ServiceGroupMemberRelationshipInner resource); + + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 defines a ServiceGroupMember relationship resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceGroupMemberRelationshipInner createOrUpdate(String resourceUri, String name, + ServiceGroupMemberRelationshipInner resource, Context context); + + /** + * Get a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 ServiceGroupMemberRelationship along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String name, Context context); + + /** + * Get a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 ServiceGroupMemberRelationship. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceGroupMemberRelationshipInner get(String resourceUri, String name); + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceUri, String name); + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceUri, String name, Context context); + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, String name); + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, String name, Context context); +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/DependencyOfRelationshipInner.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/DependencyOfRelationshipInner.java new file mode 100644 index 000000000000..03d25d7da520 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/DependencyOfRelationshipInner.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.relationships.models.DependencyOfRelationshipProperties; +import java.io.IOException; + +/** + * Defines a dependencyOf relationship resource. + */ +@Fluent +public final class DependencyOfRelationshipInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private DependencyOfRelationshipProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * 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 DependencyOfRelationshipInner class. + */ + public DependencyOfRelationshipInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public DependencyOfRelationshipProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the DependencyOfRelationshipInner object itself. + */ + public DependencyOfRelationshipInner withProperties(DependencyOfRelationshipProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * 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 JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DependencyOfRelationshipInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DependencyOfRelationshipInner 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 DependencyOfRelationshipInner. + */ + public static DependencyOfRelationshipInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DependencyOfRelationshipInner deserializedDependencyOfRelationshipInner + = new DependencyOfRelationshipInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDependencyOfRelationshipInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDependencyOfRelationshipInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDependencyOfRelationshipInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDependencyOfRelationshipInner.properties + = DependencyOfRelationshipProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDependencyOfRelationshipInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDependencyOfRelationshipInner; + }); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/OperationInner.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/OperationInner.java new file mode 100644 index 000000000000..e900eefac819 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.relationships.models.ActionType; +import com.azure.resourcemanager.relationships.models.OperationDisplay; +import com.azure.resourcemanager.relationships.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/ServiceGroupMemberRelationshipInner.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/ServiceGroupMemberRelationshipInner.java new file mode 100644 index 000000000000..204fb7e328ce --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/ServiceGroupMemberRelationshipInner.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationshipProperties; +import java.io.IOException; + +/** + * Defines a ServiceGroupMember relationship resource. + */ +@Fluent +public final class ServiceGroupMemberRelationshipInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ServiceGroupMemberRelationshipProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * 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 ServiceGroupMemberRelationshipInner class. + */ + public ServiceGroupMemberRelationshipInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ServiceGroupMemberRelationshipProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ServiceGroupMemberRelationshipInner object itself. + */ + public ServiceGroupMemberRelationshipInner withProperties(ServiceGroupMemberRelationshipProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * 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 JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceGroupMemberRelationshipInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceGroupMemberRelationshipInner 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 ServiceGroupMemberRelationshipInner. + */ + public static ServiceGroupMemberRelationshipInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceGroupMemberRelationshipInner deserializedServiceGroupMemberRelationshipInner + = new ServiceGroupMemberRelationshipInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedServiceGroupMemberRelationshipInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedServiceGroupMemberRelationshipInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedServiceGroupMemberRelationshipInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedServiceGroupMemberRelationshipInner.properties + = ServiceGroupMemberRelationshipProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedServiceGroupMemberRelationshipInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceGroupMemberRelationshipInner; + }); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/package-info.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/package-info.java new file mode 100644 index 000000000000..d66d02ecc1ac --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for Relationships. + * Microsoft.Relationships Resource Provider management API. + */ +package com.azure.resourcemanager.relationships.fluent.models; diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/package-info.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/package-info.java new file mode 100644 index 000000000000..1f219356d161 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for Relationships. + * Microsoft.Relationships Resource Provider management API. + */ +package com.azure.resourcemanager.relationships.fluent; diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipImpl.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipImpl.java new file mode 100644 index 000000000000..a6c2faf2cec2 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipImpl.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.relationships.fluent.models.DependencyOfRelationshipInner; +import com.azure.resourcemanager.relationships.models.DependencyOfRelationship; +import com.azure.resourcemanager.relationships.models.DependencyOfRelationshipProperties; + +public final class DependencyOfRelationshipImpl + implements DependencyOfRelationship, DependencyOfRelationship.Definition, DependencyOfRelationship.Update { + private DependencyOfRelationshipInner innerObject; + + private final com.azure.resourcemanager.relationships.RelationshipsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public DependencyOfRelationshipProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public DependencyOfRelationshipInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.relationships.RelationshipsManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String name; + + public DependencyOfRelationshipImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public DependencyOfRelationship create() { + this.innerObject = serviceManager.serviceClient() + .getDependencyOfRelationships() + .createOrUpdate(resourceUri, name, this.innerModel(), Context.NONE); + return this; + } + + public DependencyOfRelationship create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDependencyOfRelationships() + .createOrUpdate(resourceUri, name, this.innerModel(), context); + return this; + } + + DependencyOfRelationshipImpl(String name, + com.azure.resourcemanager.relationships.RelationshipsManager serviceManager) { + this.innerObject = new DependencyOfRelationshipInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public DependencyOfRelationshipImpl update() { + return this; + } + + public DependencyOfRelationship apply() { + this.innerObject = serviceManager.serviceClient() + .getDependencyOfRelationships() + .createOrUpdate(resourceUri, name, this.innerModel(), Context.NONE); + return this; + } + + public DependencyOfRelationship apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDependencyOfRelationships() + .createOrUpdate(resourceUri, name, this.innerModel(), context); + return this; + } + + DependencyOfRelationshipImpl(DependencyOfRelationshipInner innerObject, + com.azure.resourcemanager.relationships.RelationshipsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}", "resourceUri"); + this.name = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}", "name"); + } + + public DependencyOfRelationship refresh() { + this.innerObject = serviceManager.serviceClient() + .getDependencyOfRelationships() + .getWithResponse(resourceUri, name, Context.NONE) + .getValue(); + return this; + } + + public DependencyOfRelationship refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDependencyOfRelationships() + .getWithResponse(resourceUri, name, context) + .getValue(); + return this; + } + + public DependencyOfRelationshipImpl withProperties(DependencyOfRelationshipProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipsClientImpl.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipsClientImpl.java new file mode 100644 index 000000000000..7c41e7e624ee --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipsClientImpl.java @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.relationships.fluent.DependencyOfRelationshipsClient; +import com.azure.resourcemanager.relationships.fluent.models.DependencyOfRelationshipInner; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DependencyOfRelationshipsClient. + */ +public final class DependencyOfRelationshipsClientImpl implements DependencyOfRelationshipsClient { + /** + * The proxy service used to perform REST calls. + */ + private final DependencyOfRelationshipsService service; + + /** + * The service client containing this operation class. + */ + private final RelationshipsManagementClientImpl client; + + /** + * Initializes an instance of DependencyOfRelationshipsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DependencyOfRelationshipsClientImpl(RelationshipsManagementClientImpl client) { + this.service = RestProxy.create(DependencyOfRelationshipsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RelationshipsManagementClientDependencyOfRelationships to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RelationshipsManagementClientDependencyOfRelationships") + public interface DependencyOfRelationshipsService { + @Put("/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DependencyOfRelationshipInner resource, Context context); + + @Put("/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DependencyOfRelationshipInner resource, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("name") String name, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("name") String name, + Context context); + } + + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 defines a dependencyOf relationship resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceUri, String name, + DependencyOfRelationshipInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, name, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 defines a dependencyOf relationship resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceUri, String name, + DependencyOfRelationshipInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, name, + contentType, accept, resource, Context.NONE); + } + + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 defines a dependencyOf relationship resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceUri, String name, + DependencyOfRelationshipInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, name, + contentType, accept, resource, context); + } + + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 {@link PollerFlux} for polling of defines a dependencyOf relationship resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DependencyOfRelationshipInner> + beginCreateOrUpdateAsync(String resourceUri, String name, DependencyOfRelationshipInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceUri, name, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DependencyOfRelationshipInner.class, DependencyOfRelationshipInner.class, + this.client.getContext()); + } + + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 {@link SyncPoller} for polling of defines a dependencyOf relationship resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DependencyOfRelationshipInner> + beginCreateOrUpdate(String resourceUri, String name, DependencyOfRelationshipInner resource) { + Response response = createOrUpdateWithResponse(resourceUri, name, resource); + return this.client.getLroResult(response, + DependencyOfRelationshipInner.class, DependencyOfRelationshipInner.class, Context.NONE); + } + + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 {@link SyncPoller} for polling of defines a dependencyOf relationship resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DependencyOfRelationshipInner> + beginCreateOrUpdate(String resourceUri, String name, DependencyOfRelationshipInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceUri, name, resource, context); + return this.client.getLroResult(response, + DependencyOfRelationshipInner.class, DependencyOfRelationshipInner.class, context); + } + + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 defines a dependencyOf relationship resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, String name, + DependencyOfRelationshipInner resource) { + return beginCreateOrUpdateAsync(resourceUri, name, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 defines a dependencyOf relationship resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DependencyOfRelationshipInner createOrUpdate(String resourceUri, String name, + DependencyOfRelationshipInner resource) { + return beginCreateOrUpdate(resourceUri, name, resource).getFinalResult(); + } + + /** + * Create a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @param resource Resource create parameters. + * @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 defines a dependencyOf relationship resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DependencyOfRelationshipInner createOrUpdate(String resourceUri, String name, + DependencyOfRelationshipInner resource, Context context) { + return beginCreateOrUpdate(resourceUri, name, resource, context).getFinalResult(); + } + + /** + * Get a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 a DependencyOfRelationship along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String name) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 a DependencyOfRelationship on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String name) { + return getWithResponseAsync(resourceUri, name).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 a DependencyOfRelationship along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String name, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, name, accept, + context); + } + + /** + * Get a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 a DependencyOfRelationship. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DependencyOfRelationshipInner get(String resourceUri, String name) { + return getWithResponse(resourceUri, name, Context.NONE).getValue(); + } + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceUri, String name) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + name, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceUri, String name) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, name, + Context.NONE); + } + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceUri, String name, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, name, context); + } + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceUri, String name) { + Mono>> mono = deleteWithResponseAsync(resourceUri, name); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri, String name) { + Response response = deleteWithResponse(resourceUri, name); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri, String name, Context context) { + Response response = deleteWithResponse(resourceUri, name, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceUri, String name) { + return beginDeleteAsync(resourceUri, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String name) { + beginDelete(resourceUri, name).getFinalResult(); + } + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String name, Context context) { + beginDelete(resourceUri, name, context).getFinalResult(); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipsImpl.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipsImpl.java new file mode 100644 index 000000000000..aa72fa6d1a65 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipsImpl.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.relationships.fluent.DependencyOfRelationshipsClient; +import com.azure.resourcemanager.relationships.fluent.models.DependencyOfRelationshipInner; +import com.azure.resourcemanager.relationships.models.DependencyOfRelationship; +import com.azure.resourcemanager.relationships.models.DependencyOfRelationships; + +public final class DependencyOfRelationshipsImpl implements DependencyOfRelationships { + private static final ClientLogger LOGGER = new ClientLogger(DependencyOfRelationshipsImpl.class); + + private final DependencyOfRelationshipsClient innerClient; + + private final com.azure.resourcemanager.relationships.RelationshipsManager serviceManager; + + public DependencyOfRelationshipsImpl(DependencyOfRelationshipsClient innerClient, + com.azure.resourcemanager.relationships.RelationshipsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceUri, String name, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceUri, name, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DependencyOfRelationshipImpl(inner.getValue(), this.manager())); + } + + public DependencyOfRelationship get(String resourceUri, String name) { + DependencyOfRelationshipInner inner = this.serviceClient().get(resourceUri, name); + if (inner != null) { + return new DependencyOfRelationshipImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceUri, String name) { + this.serviceClient().delete(resourceUri, name); + } + + public void delete(String resourceUri, String name, Context context) { + this.serviceClient().delete(resourceUri, name, context); + } + + public DependencyOfRelationship getById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String name = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}", "name"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dependencyOf'.", id))); + } + return this.getWithResponse(resourceUri, name, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String name = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}", "name"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dependencyOf'.", id))); + } + return this.getWithResponse(resourceUri, name, context); + } + + public void deleteById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String name = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}", "name"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dependencyOf'.", id))); + } + this.delete(resourceUri, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String name = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/dependencyOf/{name}", "name"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dependencyOf'.", id))); + } + this.delete(resourceUri, name, context); + } + + private DependencyOfRelationshipsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.relationships.RelationshipsManager manager() { + return this.serviceManager; + } + + public DependencyOfRelationshipImpl define(String name) { + return new DependencyOfRelationshipImpl(name, this.manager()); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/OperationImpl.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/OperationImpl.java new file mode 100644 index 000000000000..a393a851028c --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.implementation; + +import com.azure.resourcemanager.relationships.fluent.models.OperationInner; +import com.azure.resourcemanager.relationships.models.ActionType; +import com.azure.resourcemanager.relationships.models.Operation; +import com.azure.resourcemanager.relationships.models.OperationDisplay; +import com.azure.resourcemanager.relationships.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.relationships.RelationshipsManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.relationships.RelationshipsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.relationships.RelationshipsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/OperationsClientImpl.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..f9e73fcdb9fe --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.relationships.fluent.OperationsClient; +import com.azure.resourcemanager.relationships.fluent.models.OperationInner; +import com.azure.resourcemanager.relationships.implementation.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final RelationshipsManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(RelationshipsManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RelationshipsManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RelationshipsManagementClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Relationships/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Relationships/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/OperationsImpl.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/OperationsImpl.java new file mode 100644 index 000000000000..62651a5d8eb4 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.relationships.fluent.OperationsClient; +import com.azure.resourcemanager.relationships.fluent.models.OperationInner; +import com.azure.resourcemanager.relationships.models.Operation; +import com.azure.resourcemanager.relationships.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.relationships.RelationshipsManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.relationships.RelationshipsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.relationships.RelationshipsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/RelationshipsManagementClientBuilder.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/RelationshipsManagementClientBuilder.java new file mode 100644 index 000000000000..8585a4a3717a --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/RelationshipsManagementClientBuilder.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the RelationshipsManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { RelationshipsManagementClientImpl.class }) +public final class RelationshipsManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the RelationshipsManagementClientBuilder. + */ + public RelationshipsManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the RelationshipsManagementClientBuilder. + */ + public RelationshipsManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the RelationshipsManagementClientBuilder. + */ + public RelationshipsManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the RelationshipsManagementClientBuilder. + */ + public RelationshipsManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the RelationshipsManagementClientBuilder. + */ + public RelationshipsManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of RelationshipsManagementClientImpl with the provided parameters. + * + * @return an instance of RelationshipsManagementClientImpl. + */ + public RelationshipsManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + RelationshipsManagementClientImpl client = new RelationshipsManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint); + return client; + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/RelationshipsManagementClientImpl.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/RelationshipsManagementClientImpl.java new file mode 100644 index 000000000000..2f508ef4b1c2 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/RelationshipsManagementClientImpl.java @@ -0,0 +1,324 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.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; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.relationships.fluent.DependencyOfRelationshipsClient; +import com.azure.resourcemanager.relationships.fluent.OperationsClient; +import com.azure.resourcemanager.relationships.fluent.RelationshipsManagementClient; +import com.azure.resourcemanager.relationships.fluent.ServiceGroupMemberRelationshipsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the RelationshipsManagementClientImpl type. + */ +@ServiceClient(builder = RelationshipsManagementClientBuilder.class) +public final class RelationshipsManagementClientImpl implements RelationshipsManagementClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * 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. + */ + 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. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The DependencyOfRelationshipsClient object to access its operations. + */ + private final DependencyOfRelationshipsClient dependencyOfRelationships; + + /** + * Gets the DependencyOfRelationshipsClient object to access its operations. + * + * @return the DependencyOfRelationshipsClient object. + */ + public DependencyOfRelationshipsClient getDependencyOfRelationships() { + return this.dependencyOfRelationships; + } + + /** + * The ServiceGroupMemberRelationshipsClient object to access its operations. + */ + private final ServiceGroupMemberRelationshipsClient serviceGroupMemberRelationships; + + /** + * Gets the ServiceGroupMemberRelationshipsClient object to access its operations. + * + * @return the ServiceGroupMemberRelationshipsClient object. + */ + public ServiceGroupMemberRelationshipsClient getServiceGroupMemberRelationships() { + return this.serviceGroupMemberRelationships; + } + + /** + * Initializes an instance of RelationshipsManagementClient 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. + * @param environment The Azure environment. + * @param endpoint Service host. + */ + RelationshipsManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.apiVersion = "2023-09-01-preview"; + this.operations = new OperationsClientImpl(this); + this.dependencyOfRelationships = new DependencyOfRelationshipsClientImpl(this); + this.serviceGroupMemberRelationships = new ServiceGroupMemberRelationshipsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RelationshipsManagementClientImpl.class); +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ResourceManagerUtils.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..a73d2c8d483d --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipImpl.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipImpl.java new file mode 100644 index 000000000000..e2743a5e93cc --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipImpl.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.relationships.fluent.models.ServiceGroupMemberRelationshipInner; +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationship; +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationshipProperties; + +public final class ServiceGroupMemberRelationshipImpl implements ServiceGroupMemberRelationship, + ServiceGroupMemberRelationship.Definition, ServiceGroupMemberRelationship.Update { + private ServiceGroupMemberRelationshipInner innerObject; + + private final com.azure.resourcemanager.relationships.RelationshipsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ServiceGroupMemberRelationshipProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ServiceGroupMemberRelationshipInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.relationships.RelationshipsManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String name; + + public ServiceGroupMemberRelationshipImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public ServiceGroupMemberRelationship create() { + this.innerObject = serviceManager.serviceClient() + .getServiceGroupMemberRelationships() + .createOrUpdate(resourceUri, name, this.innerModel(), Context.NONE); + return this; + } + + public ServiceGroupMemberRelationship create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getServiceGroupMemberRelationships() + .createOrUpdate(resourceUri, name, this.innerModel(), context); + return this; + } + + ServiceGroupMemberRelationshipImpl(String name, + com.azure.resourcemanager.relationships.RelationshipsManager serviceManager) { + this.innerObject = new ServiceGroupMemberRelationshipInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public ServiceGroupMemberRelationshipImpl update() { + return this; + } + + public ServiceGroupMemberRelationship apply() { + this.innerObject = serviceManager.serviceClient() + .getServiceGroupMemberRelationships() + .createOrUpdate(resourceUri, name, this.innerModel(), Context.NONE); + return this; + } + + public ServiceGroupMemberRelationship apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getServiceGroupMemberRelationships() + .createOrUpdate(resourceUri, name, this.innerModel(), context); + return this; + } + + ServiceGroupMemberRelationshipImpl(ServiceGroupMemberRelationshipInner innerObject, + com.azure.resourcemanager.relationships.RelationshipsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}", "resourceUri"); + this.name = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}", "name"); + } + + public ServiceGroupMemberRelationship refresh() { + this.innerObject = serviceManager.serviceClient() + .getServiceGroupMemberRelationships() + .getWithResponse(resourceUri, name, Context.NONE) + .getValue(); + return this; + } + + public ServiceGroupMemberRelationship refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getServiceGroupMemberRelationships() + .getWithResponse(resourceUri, name, context) + .getValue(); + return this; + } + + public ServiceGroupMemberRelationshipImpl withProperties(ServiceGroupMemberRelationshipProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipsClientImpl.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipsClientImpl.java new file mode 100644 index 000000000000..83a117905dff --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipsClientImpl.java @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.relationships.fluent.ServiceGroupMemberRelationshipsClient; +import com.azure.resourcemanager.relationships.fluent.models.ServiceGroupMemberRelationshipInner; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ServiceGroupMemberRelationshipsClient. + */ +public final class ServiceGroupMemberRelationshipsClientImpl implements ServiceGroupMemberRelationshipsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ServiceGroupMemberRelationshipsService service; + + /** + * The service client containing this operation class. + */ + private final RelationshipsManagementClientImpl client; + + /** + * Initializes an instance of ServiceGroupMemberRelationshipsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServiceGroupMemberRelationshipsClientImpl(RelationshipsManagementClientImpl client) { + this.service = RestProxy.create(ServiceGroupMemberRelationshipsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RelationshipsManagementClientServiceGroupMemberRelationships to be + * used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "RelationshipsManagementClientServiceGroupMemberRelationships") + public interface ServiceGroupMemberRelationshipsService { + @Put("/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ServiceGroupMemberRelationshipInner resource, Context context); + + @Put("/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ServiceGroupMemberRelationshipInner resource, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("name") String name, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("name") String name, + Context context); + } + + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 defines a ServiceGroupMember relationship resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceUri, String name, + ServiceGroupMemberRelationshipInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, name, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 defines a ServiceGroupMember relationship resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceUri, String name, + ServiceGroupMemberRelationshipInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, name, + contentType, accept, resource, Context.NONE); + } + + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 defines a ServiceGroupMember relationship resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceUri, String name, + ServiceGroupMemberRelationshipInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, name, + contentType, accept, resource, context); + } + + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 {@link PollerFlux} for polling of defines a ServiceGroupMember relationship resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServiceGroupMemberRelationshipInner> + beginCreateOrUpdateAsync(String resourceUri, String name, ServiceGroupMemberRelationshipInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceUri, name, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ServiceGroupMemberRelationshipInner.class, + ServiceGroupMemberRelationshipInner.class, this.client.getContext()); + } + + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 {@link SyncPoller} for polling of defines a ServiceGroupMember relationship resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServiceGroupMemberRelationshipInner> + beginCreateOrUpdate(String resourceUri, String name, ServiceGroupMemberRelationshipInner resource) { + Response response = createOrUpdateWithResponse(resourceUri, name, resource); + return this.client.getLroResult( + response, ServiceGroupMemberRelationshipInner.class, ServiceGroupMemberRelationshipInner.class, + Context.NONE); + } + + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 {@link SyncPoller} for polling of defines a ServiceGroupMember relationship resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServiceGroupMemberRelationshipInner> + beginCreateOrUpdate(String resourceUri, String name, ServiceGroupMemberRelationshipInner resource, + Context context) { + Response response = createOrUpdateWithResponse(resourceUri, name, resource, context); + return this.client.getLroResult( + response, ServiceGroupMemberRelationshipInner.class, ServiceGroupMemberRelationshipInner.class, context); + } + + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 defines a ServiceGroupMember relationship resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, String name, + ServiceGroupMemberRelationshipInner resource) { + return beginCreateOrUpdateAsync(resourceUri, name, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 defines a ServiceGroupMember relationship resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceGroupMemberRelationshipInner createOrUpdate(String resourceUri, String name, + ServiceGroupMemberRelationshipInner resource) { + return beginCreateOrUpdate(resourceUri, name, resource).getFinalResult(); + } + + /** + * Create a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @param resource Resource create parameters. + * @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 defines a ServiceGroupMember relationship resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceGroupMemberRelationshipInner createOrUpdate(String resourceUri, String name, + ServiceGroupMemberRelationshipInner resource, Context context) { + return beginCreateOrUpdate(resourceUri, name, resource, context).getFinalResult(); + } + + /** + * Get a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 a ServiceGroupMemberRelationship along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String name) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 a ServiceGroupMemberRelationship on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String name) { + return getWithResponseAsync(resourceUri, name).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 a ServiceGroupMemberRelationship along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String name, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, name, accept, + context); + } + + /** + * Get a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 a ServiceGroupMemberRelationship. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceGroupMemberRelationshipInner get(String resourceUri, String name) { + return getWithResponse(resourceUri, name, Context.NONE).getValue(); + } + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceUri, String name) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + name, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceUri, String name) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, name, + Context.NONE); + } + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceUri, String name, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, name, context); + } + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceUri, String name) { + Mono>> mono = deleteWithResponseAsync(resourceUri, name); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri, String name) { + Response response = deleteWithResponse(resourceUri, name); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri, String name, Context context) { + Response response = deleteWithResponse(resourceUri, name, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceUri, String name) { + return beginDeleteAsync(resourceUri, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String name) { + beginDelete(resourceUri, name).getFinalResult(); + } + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String name, Context context) { + beginDelete(resourceUri, name, context).getFinalResult(); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipsImpl.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipsImpl.java new file mode 100644 index 000000000000..001623252d58 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipsImpl.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.relationships.fluent.ServiceGroupMemberRelationshipsClient; +import com.azure.resourcemanager.relationships.fluent.models.ServiceGroupMemberRelationshipInner; +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationship; +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationships; + +public final class ServiceGroupMemberRelationshipsImpl implements ServiceGroupMemberRelationships { + private static final ClientLogger LOGGER = new ClientLogger(ServiceGroupMemberRelationshipsImpl.class); + + private final ServiceGroupMemberRelationshipsClient innerClient; + + private final com.azure.resourcemanager.relationships.RelationshipsManager serviceManager; + + public ServiceGroupMemberRelationshipsImpl(ServiceGroupMemberRelationshipsClient innerClient, + com.azure.resourcemanager.relationships.RelationshipsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceUri, String name, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceUri, name, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ServiceGroupMemberRelationshipImpl(inner.getValue(), this.manager())); + } + + public ServiceGroupMemberRelationship get(String resourceUri, String name) { + ServiceGroupMemberRelationshipInner inner = this.serviceClient().get(resourceUri, name); + if (inner != null) { + return new ServiceGroupMemberRelationshipImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceUri, String name) { + this.serviceClient().delete(resourceUri, name); + } + + public void delete(String resourceUri, String name, Context context) { + this.serviceClient().delete(resourceUri, name, context); + } + + public ServiceGroupMemberRelationship getById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String name = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}", "name"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'serviceGroupMember'.", id))); + } + return this.getWithResponse(resourceUri, name, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String name = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}", "name"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'serviceGroupMember'.", id))); + } + return this.getWithResponse(resourceUri, name, context); + } + + public void deleteById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String name = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}", "name"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'serviceGroupMember'.", id))); + } + this.delete(resourceUri, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String name = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Relationships/serviceGroupMember/{name}", "name"); + if (name == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'serviceGroupMember'.", id))); + } + this.delete(resourceUri, name, context); + } + + private ServiceGroupMemberRelationshipsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.relationships.RelationshipsManager manager() { + return this.serviceManager; + } + + public ServiceGroupMemberRelationshipImpl define(String name) { + return new ServiceGroupMemberRelationshipImpl(name, this.manager()); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/models/OperationListResult.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..154d49c89fac --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.relationships.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult 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 OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/package-info.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/package-info.java new file mode 100644 index 000000000000..610a69d20f1c --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for Relationships. + * Microsoft.Relationships Resource Provider management API. + */ +package com.azure.resourcemanager.relationships.implementation; diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ActionType.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ActionType.java new file mode 100644 index 000000000000..bdb5ce07c4be --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationship.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationship.java new file mode 100644 index 000000000000..e2a5d39a3abe --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationship.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.relationships.fluent.models.DependencyOfRelationshipInner; + +/** + * An immutable client-side representation of DependencyOfRelationship. + */ +public interface DependencyOfRelationship { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + DependencyOfRelationshipProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.relationships.fluent.models.DependencyOfRelationshipInner object. + * + * @return the inner object. + */ + DependencyOfRelationshipInner innerModel(); + + /** + * The entirety of the DependencyOfRelationship definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * The DependencyOfRelationship definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the DependencyOfRelationship definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the DependencyOfRelationship definition allowing to specify parent resource. + */ + interface WithScope { + /** + * Specifies resourceUri. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceUri(String resourceUri); + } + + /** + * The stage of the DependencyOfRelationship definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + DependencyOfRelationship create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DependencyOfRelationship create(Context context); + } + + /** + * The stage of the DependencyOfRelationship definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(DependencyOfRelationshipProperties properties); + } + } + + /** + * Begins update for the DependencyOfRelationship resource. + * + * @return the stage of resource update. + */ + DependencyOfRelationship.Update update(); + + /** + * The template for DependencyOfRelationship update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DependencyOfRelationship apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DependencyOfRelationship apply(Context context); + } + + /** + * The DependencyOfRelationship update stages. + */ + interface UpdateStages { + /** + * The stage of the DependencyOfRelationship update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(DependencyOfRelationshipProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DependencyOfRelationship refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DependencyOfRelationship refresh(Context context); +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationshipProperties.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationshipProperties.java new file mode 100644 index 000000000000..cbd9106cd243 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationshipProperties.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.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 java.io.IOException; + +/** + * dependencyOf relationship properties. + */ +@Fluent +public final class DependencyOfRelationshipProperties implements JsonSerializable { + /* + * The relationship source resource id. + */ + private String sourceId; + + /* + * The relationship target resource id. + */ + private String targetId; + + /* + * The relationship target tenant id. + */ + private String targetTenant; + + /* + * Information about the origin of the relationship. + */ + private RelationshipOriginInformation originInformation; + + /* + * Metadata about the relationship. + */ + private RelationshipMetadata metadata; + + /* + * The provisioning state of the relationship. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of DependencyOfRelationshipProperties class. + */ + public DependencyOfRelationshipProperties() { + } + + /** + * Get the sourceId property: The relationship source resource id. + * + * @return the sourceId value. + */ + public String sourceId() { + return this.sourceId; + } + + /** + * Get the targetId property: The relationship target resource id. + * + * @return the targetId value. + */ + public String targetId() { + return this.targetId; + } + + /** + * Set the targetId property: The relationship target resource id. + * + * @param targetId the targetId value to set. + * @return the DependencyOfRelationshipProperties object itself. + */ + public DependencyOfRelationshipProperties withTargetId(String targetId) { + this.targetId = targetId; + return this; + } + + /** + * Get the targetTenant property: The relationship target tenant id. + * + * @return the targetTenant value. + */ + public String targetTenant() { + return this.targetTenant; + } + + /** + * Set the targetTenant property: The relationship target tenant id. + * + * @param targetTenant the targetTenant value to set. + * @return the DependencyOfRelationshipProperties object itself. + */ + public DependencyOfRelationshipProperties withTargetTenant(String targetTenant) { + this.targetTenant = targetTenant; + return this; + } + + /** + * Get the originInformation property: Information about the origin of the relationship. + * + * @return the originInformation value. + */ + public RelationshipOriginInformation originInformation() { + return this.originInformation; + } + + /** + * Get the metadata property: Metadata about the relationship. + * + * @return the metadata value. + */ + public RelationshipMetadata metadata() { + return this.metadata; + } + + /** + * Get the provisioningState property: The provisioning state of the relationship. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetId", this.targetId); + jsonWriter.writeStringField("targetTenant", this.targetTenant); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DependencyOfRelationshipProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DependencyOfRelationshipProperties 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 DependencyOfRelationshipProperties. + */ + public static DependencyOfRelationshipProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DependencyOfRelationshipProperties deserializedDependencyOfRelationshipProperties + = new DependencyOfRelationshipProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceId".equals(fieldName)) { + deserializedDependencyOfRelationshipProperties.sourceId = reader.getString(); + } else if ("targetId".equals(fieldName)) { + deserializedDependencyOfRelationshipProperties.targetId = reader.getString(); + } else if ("originInformation".equals(fieldName)) { + deserializedDependencyOfRelationshipProperties.originInformation + = RelationshipOriginInformation.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + deserializedDependencyOfRelationshipProperties.metadata = RelationshipMetadata.fromJson(reader); + } else if ("targetTenant".equals(fieldName)) { + deserializedDependencyOfRelationshipProperties.targetTenant = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedDependencyOfRelationshipProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDependencyOfRelationshipProperties; + }); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationships.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationships.java new file mode 100644 index 000000000000..1184327387b1 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationships.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of DependencyOfRelationships. + */ +public interface DependencyOfRelationships { + /** + * Get a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 DependencyOfRelationship along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String name, Context context); + + /** + * Get a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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 DependencyOfRelationship. + */ + DependencyOfRelationship get(String resourceUri, String name); + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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. + */ + void deleteByResourceGroup(String resourceUri, String name); + + /** + * Delete a DependencyOfRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of dependencyOf relationship. + * @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. + */ + void delete(String resourceUri, String name, Context context); + + /** + * Get a DependencyOfRelationship. + * + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a DependencyOfRelationship along with {@link Response}. + */ + DependencyOfRelationship getById(String id); + + /** + * Get a DependencyOfRelationship. + * + * @param id the resource ID. + * @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 DependencyOfRelationship along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a DependencyOfRelationship. + * + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a DependencyOfRelationship. + * + * @param id the resource ID. + * @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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DependencyOfRelationship resource. + * + * @param name resource name. + * @return the first stage of the new DependencyOfRelationship definition. + */ + DependencyOfRelationship.DefinitionStages.Blank define(String name); +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/Operation.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/Operation.java new file mode 100644 index 000000000000..ee1a0d1824b7 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.resourcemanager.relationships.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.relationships.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/OperationDisplay.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/OperationDisplay.java new file mode 100644 index 000000000000..ef1427590fed --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for an operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + 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/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/Operations.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/Operations.java new file mode 100644 index 000000000000..cace5d3397da --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the 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 a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/Origin.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/Origin.java new file mode 100644 index 000000000000..69a6cce5c799 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ProvisioningState.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ProvisioningState.java new file mode 100644 index 000000000000..aa9e3d36bf9e --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of the resource. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * The resource is being provisioned. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * The resource is being updated. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * The resource is being deleted. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * The resource provisioning request has been accepted. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/RelationshipMetadata.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/RelationshipMetadata.java new file mode 100644 index 000000000000..170cb1c7ae48 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/RelationshipMetadata.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Provides information about the relationship properties. + */ +@Immutable +public final class RelationshipMetadata implements JsonSerializable { + /* + * The type of the relationship source resource. + */ + private String sourceType; + + /* + * The type of the relationship target resource. + */ + private String targetType; + + /** + * Creates an instance of RelationshipMetadata class. + */ + private RelationshipMetadata() { + } + + /** + * Get the sourceType property: The type of the relationship source resource. + * + * @return the sourceType value. + */ + public String sourceType() { + return this.sourceType; + } + + /** + * Get the targetType property: The type of the relationship target resource. + * + * @return the targetType value. + */ + public String targetType() { + return this.targetType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RelationshipMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RelationshipMetadata 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 RelationshipMetadata. + */ + public static RelationshipMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RelationshipMetadata deserializedRelationshipMetadata = new RelationshipMetadata(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceType".equals(fieldName)) { + deserializedRelationshipMetadata.sourceType = reader.getString(); + } else if ("targetType".equals(fieldName)) { + deserializedRelationshipMetadata.targetType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRelationshipMetadata; + }); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/RelationshipOriginInformation.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/RelationshipOriginInformation.java new file mode 100644 index 000000000000..99cd7d32357d --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/RelationshipOriginInformation.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Provides information about the origin of a relationship. + */ +@Immutable +public final class RelationshipOriginInformation implements JsonSerializable { + /* + * Identifies the origin type of the relationship. + */ + private RelationshipOrigins relationshipOriginType; + + /* + * The name of the discovery engine that created the relationship. + */ + private String discoveryEngine; + + /** + * Creates an instance of RelationshipOriginInformation class. + */ + private RelationshipOriginInformation() { + } + + /** + * Get the relationshipOriginType property: Identifies the origin type of the relationship. + * + * @return the relationshipOriginType value. + */ + public RelationshipOrigins relationshipOriginType() { + return this.relationshipOriginType; + } + + /** + * Get the discoveryEngine property: The name of the discovery engine that created the relationship. + * + * @return the discoveryEngine value. + */ + public String discoveryEngine() { + return this.discoveryEngine; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RelationshipOriginInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RelationshipOriginInformation 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 RelationshipOriginInformation. + */ + public static RelationshipOriginInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RelationshipOriginInformation deserializedRelationshipOriginInformation + = new RelationshipOriginInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("relationshipOriginType".equals(fieldName)) { + deserializedRelationshipOriginInformation.relationshipOriginType + = RelationshipOrigins.fromString(reader.getString()); + } else if ("discoveryEngine".equals(fieldName)) { + deserializedRelationshipOriginInformation.discoveryEngine = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRelationshipOriginInformation; + }); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/RelationshipOrigins.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/RelationshipOrigins.java new file mode 100644 index 000000000000..9dc0cd7c9a84 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/RelationshipOrigins.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The possible origins of a relationship. + */ +public final class RelationshipOrigins extends ExpandableStringEnum { + /** + * The relationship was explicitly created by a system. + */ + public static final RelationshipOrigins SERVICE_EXPLICITLY_CREATED = fromString("ServiceExplicitlyCreated"); + + /** + * The relationship was discovered by a system-created rule. + */ + public static final RelationshipOrigins SYSTEM_DISCOVERED_BY_RULE = fromString("SystemDiscoveredByRule"); + + /** + * The relationship was explicitly created by a user. + */ + public static final RelationshipOrigins USER_EXPLICITLY_CREATED = fromString("UserExplicitlyCreated"); + + /** + * The relationship was discovered by a user-created rule. + */ + public static final RelationshipOrigins USER_DISCOVERED_BY_RULE = fromString("UserDiscoveredByRule"); + + /** + * Creates a new instance of RelationshipOrigins value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RelationshipOrigins() { + } + + /** + * Creates or finds a RelationshipOrigins from its string representation. + * + * @param name a name to look for. + * @return the corresponding RelationshipOrigins. + */ + public static RelationshipOrigins fromString(String name) { + return fromString(name, RelationshipOrigins.class); + } + + /** + * Gets known RelationshipOrigins values. + * + * @return known RelationshipOrigins values. + */ + public static Collection values() { + return values(RelationshipOrigins.class); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationship.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationship.java new file mode 100644 index 000000000000..a528915f786e --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationship.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.relationships.fluent.models.ServiceGroupMemberRelationshipInner; + +/** + * An immutable client-side representation of ServiceGroupMemberRelationship. + */ +public interface ServiceGroupMemberRelationship { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ServiceGroupMemberRelationshipProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.relationships.fluent.models.ServiceGroupMemberRelationshipInner object. + * + * @return the inner object. + */ + ServiceGroupMemberRelationshipInner innerModel(); + + /** + * The entirety of the ServiceGroupMemberRelationship definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * The ServiceGroupMemberRelationship definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ServiceGroupMemberRelationship definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the ServiceGroupMemberRelationship definition allowing to specify parent resource. + */ + interface WithScope { + /** + * Specifies resourceUri. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceUri(String resourceUri); + } + + /** + * The stage of the ServiceGroupMemberRelationship definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServiceGroupMemberRelationship create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServiceGroupMemberRelationship create(Context context); + } + + /** + * The stage of the ServiceGroupMemberRelationship definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ServiceGroupMemberRelationshipProperties properties); + } + } + + /** + * Begins update for the ServiceGroupMemberRelationship resource. + * + * @return the stage of resource update. + */ + ServiceGroupMemberRelationship.Update update(); + + /** + * The template for ServiceGroupMemberRelationship update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServiceGroupMemberRelationship apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServiceGroupMemberRelationship apply(Context context); + } + + /** + * The ServiceGroupMemberRelationship update stages. + */ + interface UpdateStages { + /** + * The stage of the ServiceGroupMemberRelationship update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(ServiceGroupMemberRelationshipProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServiceGroupMemberRelationship refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServiceGroupMemberRelationship refresh(Context context); +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationshipProperties.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationshipProperties.java new file mode 100644 index 000000000000..1e6b3850e40c --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationshipProperties.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.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 java.io.IOException; + +/** + * ServiceGroupMember relationship properties. + */ +@Fluent +public final class ServiceGroupMemberRelationshipProperties + implements JsonSerializable { + /* + * The relationship source resource id. + */ + private String sourceId; + + /* + * The relationship target resource id. + */ + private String targetId; + + /* + * The relationship target tenant id. + */ + private String targetTenant; + + /* + * Information about the origin of the relationship. + */ + private RelationshipOriginInformation originInformation; + + /* + * Metadata about the relationship. + */ + private RelationshipMetadata metadata; + + /* + * The provisioning state of the relationship. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of ServiceGroupMemberRelationshipProperties class. + */ + public ServiceGroupMemberRelationshipProperties() { + } + + /** + * Get the sourceId property: The relationship source resource id. + * + * @return the sourceId value. + */ + public String sourceId() { + return this.sourceId; + } + + /** + * Get the targetId property: The relationship target resource id. + * + * @return the targetId value. + */ + public String targetId() { + return this.targetId; + } + + /** + * Set the targetId property: The relationship target resource id. + * + * @param targetId the targetId value to set. + * @return the ServiceGroupMemberRelationshipProperties object itself. + */ + public ServiceGroupMemberRelationshipProperties withTargetId(String targetId) { + this.targetId = targetId; + return this; + } + + /** + * Get the targetTenant property: The relationship target tenant id. + * + * @return the targetTenant value. + */ + public String targetTenant() { + return this.targetTenant; + } + + /** + * Set the targetTenant property: The relationship target tenant id. + * + * @param targetTenant the targetTenant value to set. + * @return the ServiceGroupMemberRelationshipProperties object itself. + */ + public ServiceGroupMemberRelationshipProperties withTargetTenant(String targetTenant) { + this.targetTenant = targetTenant; + return this; + } + + /** + * Get the originInformation property: Information about the origin of the relationship. + * + * @return the originInformation value. + */ + public RelationshipOriginInformation originInformation() { + return this.originInformation; + } + + /** + * Get the metadata property: Metadata about the relationship. + * + * @return the metadata value. + */ + public RelationshipMetadata metadata() { + return this.metadata; + } + + /** + * Get the provisioningState property: The provisioning state of the relationship. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetId", this.targetId); + jsonWriter.writeStringField("targetTenant", this.targetTenant); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServiceGroupMemberRelationshipProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServiceGroupMemberRelationshipProperties 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 ServiceGroupMemberRelationshipProperties. + */ + public static ServiceGroupMemberRelationshipProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServiceGroupMemberRelationshipProperties deserializedServiceGroupMemberRelationshipProperties + = new ServiceGroupMemberRelationshipProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceId".equals(fieldName)) { + deserializedServiceGroupMemberRelationshipProperties.sourceId = reader.getString(); + } else if ("targetId".equals(fieldName)) { + deserializedServiceGroupMemberRelationshipProperties.targetId = reader.getString(); + } else if ("originInformation".equals(fieldName)) { + deserializedServiceGroupMemberRelationshipProperties.originInformation + = RelationshipOriginInformation.fromJson(reader); + } else if ("metadata".equals(fieldName)) { + deserializedServiceGroupMemberRelationshipProperties.metadata + = RelationshipMetadata.fromJson(reader); + } else if ("targetTenant".equals(fieldName)) { + deserializedServiceGroupMemberRelationshipProperties.targetTenant = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedServiceGroupMemberRelationshipProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedServiceGroupMemberRelationshipProperties; + }); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationships.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationships.java new file mode 100644 index 000000000000..6d58cc9cb478 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationships.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ServiceGroupMemberRelationships. + */ +public interface ServiceGroupMemberRelationships { + /** + * Get a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 ServiceGroupMemberRelationship along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String name, Context context); + + /** + * Get a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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 ServiceGroupMemberRelationship. + */ + ServiceGroupMemberRelationship get(String resourceUri, String name); + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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. + */ + void deleteByResourceGroup(String resourceUri, String name); + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param name Name of ServiceGroupMember relationship. + * @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. + */ + void delete(String resourceUri, String name, Context context); + + /** + * Get a ServiceGroupMemberRelationship. + * + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ServiceGroupMemberRelationship along with {@link Response}. + */ + ServiceGroupMemberRelationship getById(String id); + + /** + * Get a ServiceGroupMemberRelationship. + * + * @param id the resource ID. + * @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 ServiceGroupMemberRelationship along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a ServiceGroupMemberRelationship. + * + * @param id the resource ID. + * @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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServiceGroupMemberRelationship resource. + * + * @param name resource name. + * @return the first stage of the new ServiceGroupMemberRelationship definition. + */ + ServiceGroupMemberRelationship.DefinitionStages.Blank define(String name); +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/package-info.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/package-info.java new file mode 100644 index 000000000000..cf1bc69b4e4e --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for Relationships. + * Microsoft.Relationships Resource Provider management API. + */ +package com.azure.resourcemanager.relationships.models; diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/package-info.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/package-info.java new file mode 100644 index 000000000000..86baa83484c8 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/com/azure/resourcemanager/relationships/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for Relationships. + * Microsoft.Relationships Resource Provider management API. + */ +package com.azure.resourcemanager.relationships; diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/java/module-info.java b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/module-info.java new file mode 100644 index 000000000000..1ea1b3834dfe --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/java/module-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.resourcemanager.relationships { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.relationships; + exports com.azure.resourcemanager.relationships.fluent; + exports com.azure.resourcemanager.relationships.fluent.models; + exports com.azure.resourcemanager.relationships.models; + + opens com.azure.resourcemanager.relationships.fluent.models to com.azure.core; + opens com.azure.resourcemanager.relationships.models to com.azure.core; + opens com.azure.resourcemanager.relationships.implementation.models to com.azure.core; +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/resources/META-INF/azure-resourcemanager-relationships_metadata.json b/sdk/relationships/azure-resourcemanager-relationships/src/main/resources/META-INF/azure-resourcemanager-relationships_metadata.json new file mode 100644 index 000000000000..2daf628a919e --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/resources/META-INF/azure-resourcemanager-relationships_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Microsoft.Relationships":"2023-09-01-preview"},"crossLanguageDefinitions":{"com.azure.resourcemanager.relationships.fluent.DependencyOfRelationshipsClient":"Microsoft.Relationships.DependencyOfRelationships","com.azure.resourcemanager.relationships.fluent.DependencyOfRelationshipsClient.beginCreateOrUpdate":"Microsoft.Relationships.DependencyOfRelationships.createOrUpdate","com.azure.resourcemanager.relationships.fluent.DependencyOfRelationshipsClient.beginDelete":"Microsoft.Relationships.DependencyOfRelationships.delete","com.azure.resourcemanager.relationships.fluent.DependencyOfRelationshipsClient.createOrUpdate":"Microsoft.Relationships.DependencyOfRelationships.createOrUpdate","com.azure.resourcemanager.relationships.fluent.DependencyOfRelationshipsClient.delete":"Microsoft.Relationships.DependencyOfRelationships.delete","com.azure.resourcemanager.relationships.fluent.DependencyOfRelationshipsClient.get":"Microsoft.Relationships.DependencyOfRelationships.get","com.azure.resourcemanager.relationships.fluent.DependencyOfRelationshipsClient.getWithResponse":"Microsoft.Relationships.DependencyOfRelationships.get","com.azure.resourcemanager.relationships.fluent.OperationsClient":"Microsoft.Relationships.Operations","com.azure.resourcemanager.relationships.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.relationships.fluent.RelationshipsManagementClient":"Microsoft.Relationships","com.azure.resourcemanager.relationships.fluent.ServiceGroupMemberRelationshipsClient":"Microsoft.Relationships.ServiceGroupMemberRelationships","com.azure.resourcemanager.relationships.fluent.ServiceGroupMemberRelationshipsClient.beginCreateOrUpdate":"Microsoft.Relationships.ServiceGroupMemberRelationships.createOrUpdate","com.azure.resourcemanager.relationships.fluent.ServiceGroupMemberRelationshipsClient.beginDelete":"Microsoft.Relationships.ServiceGroupMemberRelationships.delete","com.azure.resourcemanager.relationships.fluent.ServiceGroupMemberRelationshipsClient.createOrUpdate":"Microsoft.Relationships.ServiceGroupMemberRelationships.createOrUpdate","com.azure.resourcemanager.relationships.fluent.ServiceGroupMemberRelationshipsClient.delete":"Microsoft.Relationships.ServiceGroupMemberRelationships.delete","com.azure.resourcemanager.relationships.fluent.ServiceGroupMemberRelationshipsClient.get":"Microsoft.Relationships.ServiceGroupMemberRelationships.get","com.azure.resourcemanager.relationships.fluent.ServiceGroupMemberRelationshipsClient.getWithResponse":"Microsoft.Relationships.ServiceGroupMemberRelationships.get","com.azure.resourcemanager.relationships.fluent.models.DependencyOfRelationshipInner":"Microsoft.Relationships.DependencyOfRelationship","com.azure.resourcemanager.relationships.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.relationships.fluent.models.ServiceGroupMemberRelationshipInner":"Microsoft.Relationships.ServiceGroupMemberRelationship","com.azure.resourcemanager.relationships.implementation.RelationshipsManagementClientBuilder":"Microsoft.Relationships","com.azure.resourcemanager.relationships.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.relationships.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.relationships.models.DependencyOfRelationshipProperties":"Microsoft.Relationships.DependencyOfRelationshipProperties","com.azure.resourcemanager.relationships.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.relationships.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.relationships.models.ProvisioningState":"Microsoft.Relationships.ProvisioningState","com.azure.resourcemanager.relationships.models.RelationshipMetadata":"Microsoft.Relationships.RelationshipMetadata","com.azure.resourcemanager.relationships.models.RelationshipOriginInformation":"Microsoft.Relationships.RelationshipOriginInformation","com.azure.resourcemanager.relationships.models.RelationshipOrigins":"Microsoft.Relationships.RelationshipOrigins","com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationshipProperties":"Microsoft.Relationships.ServiceGroupMemberRelationshipProperties"},"generatedFiles":["src/main/java/com/azure/resourcemanager/relationships/RelationshipsManager.java","src/main/java/com/azure/resourcemanager/relationships/fluent/DependencyOfRelationshipsClient.java","src/main/java/com/azure/resourcemanager/relationships/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/relationships/fluent/RelationshipsManagementClient.java","src/main/java/com/azure/resourcemanager/relationships/fluent/ServiceGroupMemberRelationshipsClient.java","src/main/java/com/azure/resourcemanager/relationships/fluent/models/DependencyOfRelationshipInner.java","src/main/java/com/azure/resourcemanager/relationships/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/relationships/fluent/models/ServiceGroupMemberRelationshipInner.java","src/main/java/com/azure/resourcemanager/relationships/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/relationships/fluent/package-info.java","src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipImpl.java","src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipsClientImpl.java","src/main/java/com/azure/resourcemanager/relationships/implementation/DependencyOfRelationshipsImpl.java","src/main/java/com/azure/resourcemanager/relationships/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/relationships/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/relationships/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/relationships/implementation/RelationshipsManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/relationships/implementation/RelationshipsManagementClientImpl.java","src/main/java/com/azure/resourcemanager/relationships/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipImpl.java","src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipsClientImpl.java","src/main/java/com/azure/resourcemanager/relationships/implementation/ServiceGroupMemberRelationshipsImpl.java","src/main/java/com/azure/resourcemanager/relationships/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/relationships/implementation/package-info.java","src/main/java/com/azure/resourcemanager/relationships/models/ActionType.java","src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationship.java","src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationshipProperties.java","src/main/java/com/azure/resourcemanager/relationships/models/DependencyOfRelationships.java","src/main/java/com/azure/resourcemanager/relationships/models/Operation.java","src/main/java/com/azure/resourcemanager/relationships/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/relationships/models/Operations.java","src/main/java/com/azure/resourcemanager/relationships/models/Origin.java","src/main/java/com/azure/resourcemanager/relationships/models/ProvisioningState.java","src/main/java/com/azure/resourcemanager/relationships/models/RelationshipMetadata.java","src/main/java/com/azure/resourcemanager/relationships/models/RelationshipOriginInformation.java","src/main/java/com/azure/resourcemanager/relationships/models/RelationshipOrigins.java","src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationship.java","src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationshipProperties.java","src/main/java/com/azure/resourcemanager/relationships/models/ServiceGroupMemberRelationships.java","src/main/java/com/azure/resourcemanager/relationships/models/package-info.java","src/main/java/com/azure/resourcemanager/relationships/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-relationships/proxy-config.json b/sdk/relationships/azure-resourcemanager-relationships/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-relationships/proxy-config.json new file mode 100644 index 000000000000..85b1dda1a3e5 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-relationships/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.relationships.implementation.DependencyOfRelationshipsClientImpl$DependencyOfRelationshipsService"],["com.azure.resourcemanager.relationships.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.relationships.implementation.ServiceGroupMemberRelationshipsClientImpl$ServiceGroupMemberRelationshipsService"]] \ No newline at end of file diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-relationships/reflect-config.json b/sdk/relationships/azure-resourcemanager-relationships/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-relationships/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-relationships/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/main/resources/azure-resourcemanager-relationships.properties b/sdk/relationships/azure-resourcemanager-relationships/src/main/resources/azure-resourcemanager-relationships.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/main/resources/azure-resourcemanager-relationships.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsCreateOrUpdateSamples.java b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..b306c86beef0 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsCreateOrUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.resourcemanager.relationships.models.DependencyOfRelationshipProperties; + +/** + * Samples for DependencyOfRelationships CreateOrUpdate. + */ +public final class DependencyOfRelationshipsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2023-09-01-preview/DependencyOfRelationships_CreateOrUpdate.json + */ + /** + * Sample code: DependencyOfRelationships_CreateOrUpdate. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void + dependencyOfRelationshipsCreateOrUpdate(com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.dependencyOfRelationships() + .define("relationshipOne") + .withExistingResourceUri( + "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account") + .withProperties(new DependencyOfRelationshipProperties().withTargetId( + "/subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg123/providers/Microsoft.Web/staticSites/test-site") + .withTargetTenant("72f988bf-86f1-41af-91ab-2d7cd011db47")) + .create(); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsDeleteSamples.java b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsDeleteSamples.java new file mode 100644 index 000000000000..055ad3106b7a --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +/** + * Samples for DependencyOfRelationships Delete. + */ +public final class DependencyOfRelationshipsDeleteSamples { + /* + * x-ms-original-file: 2023-09-01-preview/DependencyOfRelationships_Delete.json + */ + /** + * Sample code: DependencyOfRelationships_Delete. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void + dependencyOfRelationshipsDelete(com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.dependencyOfRelationships() + .delete( + "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account", + "relationshipOne", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsGetSamples.java b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsGetSamples.java new file mode 100644 index 000000000000..da1b4883442d --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +/** + * Samples for DependencyOfRelationships Get. + */ +public final class DependencyOfRelationshipsGetSamples { + /* + * x-ms-original-file: 2023-09-01-preview/DependencyOfRelationships_Get.json + */ + /** + * Sample code: DependencyOfRelationships_Get. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void + dependencyOfRelationshipsGet(com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.dependencyOfRelationships() + .getWithResponse( + "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account", + "relationshipOne", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/OperationsListSamples.java b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/OperationsListSamples.java new file mode 100644 index 000000000000..943fc85206ee --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2023-09-01-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void operationsList(com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsCreateOrUpdateSamples.java b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..e3f40b92a6ed --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsCreateOrUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationshipProperties; + +/** + * Samples for ServiceGroupMemberRelationships CreateOrUpdate. + */ +public final class ServiceGroupMemberRelationshipsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2023-09-01-preview/ServiceGroupMemberRelationships_CreateOrUpdate.json + */ + /** + * Sample code: ServiceGroupMemberRelationships_CreateOrUpdate. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void serviceGroupMemberRelationshipsCreateOrUpdate( + com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.serviceGroupMemberRelationships() + .define("sg1") + .withExistingResourceUri( + "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account") + .withProperties(new ServiceGroupMemberRelationshipProperties() + .withTargetId("/providers/Microsoft.Management/serviceGroups/sg1") + .withTargetTenant("72f988bf-86f1-41af-91ab-2d7cd011db47")) + .create(); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsDeleteSamples.java b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsDeleteSamples.java new file mode 100644 index 000000000000..cc95f99333de --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +/** + * Samples for ServiceGroupMemberRelationships Delete. + */ +public final class ServiceGroupMemberRelationshipsDeleteSamples { + /* + * x-ms-original-file: 2023-09-01-preview/ServiceGroupMemberRelationships_Delete.json + */ + /** + * Sample code: ServiceGroupMemberRelationships_Delete. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void + serviceGroupMemberRelationshipsDelete(com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.serviceGroupMemberRelationships() + .delete( + "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account", + "sg1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsGetSamples.java b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsGetSamples.java new file mode 100644 index 000000000000..1b0b857d2cad --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/samples/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +/** + * Samples for ServiceGroupMemberRelationships Get. + */ +public final class ServiceGroupMemberRelationshipsGetSamples { + /* + * x-ms-original-file: 2023-09-01-preview/ServiceGroupMemberRelationships_Get.json + */ + /** + * Sample code: ServiceGroupMemberRelationships_Get. + * + * @param manager Entry point to RelationshipsManager. + */ + public static void + serviceGroupMemberRelationshipsGet(com.azure.resourcemanager.relationships.RelationshipsManager manager) { + manager.serviceGroupMemberRelationships() + .getWithResponse( + "subscriptions/a925f2f7-5c63-4b7b-8799-25a5f97bc3b2/resourceGroups/testrg/providers/Microsoft.DocumentDb/databaseAccounts/test-db-account", + "sg1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipInnerTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipInnerTests.java new file mode 100644 index 000000000000..3b0398a4209d --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipInnerTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.relationships.fluent.models.DependencyOfRelationshipInner; +import com.azure.resourcemanager.relationships.models.DependencyOfRelationshipProperties; +import org.junit.jupiter.api.Assertions; + +public final class DependencyOfRelationshipInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DependencyOfRelationshipInner model = BinaryData.fromString( + "{\"properties\":{\"sourceId\":\"ijbpzvgnwzsymgl\",\"targetId\":\"uf\",\"targetTenant\":\"zk\",\"originInformation\":{\"relationshipOriginType\":\"SystemDiscoveredByRule\",\"discoveryEngine\":\"bihanuf\"},\"metadata\":{\"sourceType\":\"fcbjysagithxqha\",\"targetType\":\"ifpikxwczby\"},\"provisioningState\":\"Updating\"},\"id\":\"q\",\"name\":\"uhivyqniw\",\"type\":\"ybrk\"}") + .toObject(DependencyOfRelationshipInner.class); + Assertions.assertEquals("uf", model.properties().targetId()); + Assertions.assertEquals("zk", model.properties().targetTenant()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DependencyOfRelationshipInner model = new DependencyOfRelationshipInner() + .withProperties(new DependencyOfRelationshipProperties().withTargetId("uf").withTargetTenant("zk")); + model = BinaryData.fromObject(model).toObject(DependencyOfRelationshipInner.class); + Assertions.assertEquals("uf", model.properties().targetId()); + Assertions.assertEquals("zk", model.properties().targetTenant()); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipPropertiesTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipPropertiesTests.java new file mode 100644 index 000000000000..981a63dc50e2 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipPropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.relationships.models.DependencyOfRelationshipProperties; +import org.junit.jupiter.api.Assertions; + +public final class DependencyOfRelationshipPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DependencyOfRelationshipProperties model = BinaryData.fromString( + "{\"sourceId\":\"vd\",\"targetId\":\"mjgr\",\"targetTenant\":\"wvukx\",\"originInformation\":{\"relationshipOriginType\":\"UserExplicitlyCreated\",\"discoveryEngine\":\"dcc\"},\"metadata\":{\"sourceType\":\"nhsjcnyej\",\"targetType\":\"kryhtnapczwlokj\"},\"provisioningState\":\"Provisioning\"}") + .toObject(DependencyOfRelationshipProperties.class); + Assertions.assertEquals("mjgr", model.targetId()); + Assertions.assertEquals("wvukx", model.targetTenant()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DependencyOfRelationshipProperties model + = new DependencyOfRelationshipProperties().withTargetId("mjgr").withTargetTenant("wvukx"); + model = BinaryData.fromObject(model).toObject(DependencyOfRelationshipProperties.class); + Assertions.assertEquals("mjgr", model.targetId()); + Assertions.assertEquals("wvukx", model.targetTenant()); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsCreateOrUpdateMockTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..32c47a4def6b --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsCreateOrUpdateMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.relationships.RelationshipsManager; +import com.azure.resourcemanager.relationships.models.DependencyOfRelationship; +import com.azure.resourcemanager.relationships.models.DependencyOfRelationshipProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class DependencyOfRelationshipsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"sourceId\":\"blgphuticn\",\"targetId\":\"vkaozwyiftyhxhur\",\"targetTenant\":\"ftyxolniw\",\"originInformation\":{\"relationshipOriginType\":\"UserDiscoveredByRule\",\"discoveryEngine\":\"ukjfkgiawxklr\"},\"metadata\":{\"sourceType\":\"plwckbas\",\"targetType\":\"ypnddhsgcb\"},\"provisioningState\":\"Succeeded\"},\"id\":\"ejk\",\"name\":\"tynqgoul\",\"type\":\"ndlik\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + RelationshipsManager manager = RelationshipsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + DependencyOfRelationship response = manager.dependencyOfRelationships() + .define("lssai") + .withExistingResourceUri("wtnhxbnjbiksqr") + .withProperties( + new DependencyOfRelationshipProperties().withTargetId("wnzlljfmppeeb").withTargetTenant("gxsabkyq")) + .create(); + + Assertions.assertEquals("vkaozwyiftyhxhur", response.properties().targetId()); + Assertions.assertEquals("ftyxolniw", response.properties().targetTenant()); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsGetWithResponseMockTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsGetWithResponseMockTests.java new file mode 100644 index 000000000000..b85863ae3eb5 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/DependencyOfRelationshipsGetWithResponseMockTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.relationships.RelationshipsManager; +import com.azure.resourcemanager.relationships.models.DependencyOfRelationship; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class DependencyOfRelationshipsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"sourceId\":\"ciqihnhung\",\"targetId\":\"wjzrnfygxgisp\",\"targetTenant\":\"vtz\",\"originInformation\":{\"relationshipOriginType\":\"SystemDiscoveredByRule\",\"discoveryEngine\":\"fublj\"},\"metadata\":{\"sourceType\":\"fxqeof\",\"targetType\":\"aeqjhqjbasvms\"},\"provisioningState\":\"Succeeded\"},\"id\":\"lngsntnbybkzgcwr\",\"name\":\"clxxwrljdo\",\"type\":\"skcqvkocrcjd\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + RelationshipsManager manager = RelationshipsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + DependencyOfRelationship response = manager.dependencyOfRelationships() + .getWithResponse("heognarxzxtheo", "usivye", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("wjzrnfygxgisp", response.properties().targetId()); + Assertions.assertEquals("vtz", response.properties().targetTenant()); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationDisplayTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..ab0bf8eaaee9 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationDisplayTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.relationships.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"cdm\",\"resource\":\"rcryuanzwuxzdxta\",\"operation\":\"lhmwhfpmrqobm\",\"description\":\"kknryrtihf\"}") + .toObject(OperationDisplay.class); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationInnerTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationInnerTests.java new file mode 100644 index 000000000000..092cdfef51e7 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.relationships.fluent.models.OperationInner; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationListResultTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationListResultTests.java new file mode 100644 index 000000000000..05e84fbcb339 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.relationships.implementation.models.OperationListResult; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"hq\",\"isDataAction\":true,\"display\":{\"provider\":\"pybczmehmtzopb\",\"resource\":\"h\",\"operation\":\"pidgsybbejhphoyc\",\"description\":\"xaobhdxbmtqioqjz\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"fpownoizhwlr\",\"isDataAction\":false,\"display\":{\"provider\":\"oqijgkdmbpaz\",\"resource\":\"bc\",\"operation\":\"pdznrbtcqqjnqgl\",\"description\":\"gnufoooj\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"kfo\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("kfo", model.nextLink()); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationsListMockTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..94b5daf366ec --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/OperationsListMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.relationships.RelationshipsManager; +import com.azure.resourcemanager.relationships.models.Operation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"name\":\"xxjtfe\",\"isDataAction\":true,\"display\":{\"provider\":\"zitonpeqfpjkjl\",\"resource\":\"fpdvhpfxxypi\",\"operation\":\"nmayhuybb\",\"description\":\"odepoogin\"},\"origin\":\"user\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + RelationshipsManager manager = RelationshipsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/RelationshipMetadataTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/RelationshipMetadataTests.java new file mode 100644 index 000000000000..04bf8f762ff3 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/RelationshipMetadataTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.relationships.models.RelationshipMetadata; + +public final class RelationshipMetadataTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RelationshipMetadata model + = BinaryData.fromString("{\"sourceType\":\"jnchgej\",\"targetType\":\"podmailzydehojwy\"}") + .toObject(RelationshipMetadata.class); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/RelationshipOriginInformationTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/RelationshipOriginInformationTests.java new file mode 100644 index 000000000000..4bb9cdd30de6 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/RelationshipOriginInformationTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.relationships.models.RelationshipOriginInformation; + +public final class RelationshipOriginInformationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RelationshipOriginInformation model = BinaryData + .fromString("{\"relationshipOriginType\":\"UserExplicitlyCreated\",\"discoveryEngine\":\"vnipjox\"}") + .toObject(RelationshipOriginInformation.class); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipInnerTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipInnerTests.java new file mode 100644 index 000000000000..10e250468cc5 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipInnerTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.relationships.fluent.models.ServiceGroupMemberRelationshipInner; +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationshipProperties; +import org.junit.jupiter.api.Assertions; + +public final class ServiceGroupMemberRelationshipInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServiceGroupMemberRelationshipInner model = BinaryData.fromString( + "{\"properties\":{\"sourceId\":\"uxinpmqnjaq\",\"targetId\":\"ixjsprozvcputeg\",\"targetTenant\":\"wmfdatscmdvpjhul\",\"originInformation\":{\"relationshipOriginType\":\"UserDiscoveredByRule\",\"discoveryEngine\":\"vmkjozkrwfndiodj\"},\"metadata\":{\"sourceType\":\"slwejdpvw\",\"targetType\":\"yoqpsoaccta\"},\"provisioningState\":\"Succeeded\"},\"id\":\"j\",\"name\":\"ahbc\",\"type\":\"yffdfdos\"}") + .toObject(ServiceGroupMemberRelationshipInner.class); + Assertions.assertEquals("ixjsprozvcputeg", model.properties().targetId()); + Assertions.assertEquals("wmfdatscmdvpjhul", model.properties().targetTenant()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServiceGroupMemberRelationshipInner model = new ServiceGroupMemberRelationshipInner() + .withProperties(new ServiceGroupMemberRelationshipProperties().withTargetId("ixjsprozvcputeg") + .withTargetTenant("wmfdatscmdvpjhul")); + model = BinaryData.fromObject(model).toObject(ServiceGroupMemberRelationshipInner.class); + Assertions.assertEquals("ixjsprozvcputeg", model.properties().targetId()); + Assertions.assertEquals("wmfdatscmdvpjhul", model.properties().targetTenant()); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipPropertiesTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipPropertiesTests.java new file mode 100644 index 000000000000..1cf2e55fb86e --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipPropertiesTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationshipProperties; +import org.junit.jupiter.api.Assertions; + +public final class ServiceGroupMemberRelationshipPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServiceGroupMemberRelationshipProperties model = BinaryData.fromString( + "{\"sourceId\":\"gexpaojakhmsbz\",\"targetId\":\"hcrzevd\",\"targetTenant\":\"lxaolthqtrgqjbp\",\"originInformation\":{\"relationshipOriginType\":\"UserExplicitlyCreated\",\"discoveryEngine\":\"s\"},\"metadata\":{\"sourceType\":\"n\",\"targetType\":\"gvfcj\"},\"provisioningState\":\"Provisioning\"}") + .toObject(ServiceGroupMemberRelationshipProperties.class); + Assertions.assertEquals("hcrzevd", model.targetId()); + Assertions.assertEquals("lxaolthqtrgqjbp", model.targetTenant()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServiceGroupMemberRelationshipProperties model + = new ServiceGroupMemberRelationshipProperties().withTargetId("hcrzevd") + .withTargetTenant("lxaolthqtrgqjbp"); + model = BinaryData.fromObject(model).toObject(ServiceGroupMemberRelationshipProperties.class); + Assertions.assertEquals("hcrzevd", model.targetId()); + Assertions.assertEquals("lxaolthqtrgqjbp", model.targetTenant()); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsCreateOrUpdateMockTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..3bcd24205541 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsCreateOrUpdateMockTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.relationships.RelationshipsManager; +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationship; +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationshipProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServiceGroupMemberRelationshipsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"sourceId\":\"kcprbnw\",\"targetId\":\"xgjvtbv\",\"targetTenant\":\"sszdnru\",\"originInformation\":{\"relationshipOriginType\":\"SystemDiscoveredByRule\",\"discoveryEngine\":\"uhmuouqfprwzwbn\"},\"metadata\":{\"sourceType\":\"uitnwuiz\",\"targetType\":\"a\"},\"provisioningState\":\"Succeeded\"},\"id\":\"izuckyfihrfidfvz\",\"name\":\"dzuhtymwi\",\"type\":\"dkfthwxmnt\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + RelationshipsManager manager = RelationshipsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ServiceGroupMemberRelationship response = manager.serviceGroupMemberRelationships() + .define("bjf") + .withExistingResourceUri("bmdg") + .withProperties(new ServiceGroupMemberRelationshipProperties().withTargetId("q").withTargetTenant("ol")) + .create(); + + Assertions.assertEquals("xgjvtbv", response.properties().targetId()); + Assertions.assertEquals("sszdnru", response.properties().targetTenant()); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsGetWithResponseMockTests.java b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsGetWithResponseMockTests.java new file mode 100644 index 000000000000..6069fadc976e --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/src/test/java/com/azure/resourcemanager/relationships/generated/ServiceGroupMemberRelationshipsGetWithResponseMockTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.relationships.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.relationships.RelationshipsManager; +import com.azure.resourcemanager.relationships.models.ServiceGroupMemberRelationship; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServiceGroupMemberRelationshipsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"sourceId\":\"s\",\"targetId\":\"xybz\",\"targetTenant\":\"e\",\"originInformation\":{\"relationshipOriginType\":\"SystemDiscoveredByRule\",\"discoveryEngine\":\"tbciqfouflmm\"},\"metadata\":{\"sourceType\":\"kzsmodm\",\"targetType\":\"lougpbkw\"},\"provisioningState\":\"Canceled\"},\"id\":\"duqkt\",\"name\":\"pspwgcuertu\",\"type\":\"kdosvqw\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + RelationshipsManager manager = RelationshipsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ServiceGroupMemberRelationship response = manager.serviceGroupMemberRelationships() + .getWithResponse("yqkgfg", "bmadgak", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("xybz", response.properties().targetId()); + Assertions.assertEquals("e", response.properties().targetTenant()); + } +} diff --git a/sdk/relationships/azure-resourcemanager-relationships/tsp-location.yaml b/sdk/relationships/azure-resourcemanager-relationships/tsp-location.yaml new file mode 100644 index 000000000000..9c3cb301d930 --- /dev/null +++ b/sdk/relationships/azure-resourcemanager-relationships/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/relationships/Relationships.Management +commit: ab5c0abaf718ad3ad3328695dc8e1eb5b3bfd38c +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/relationships/ci.yml b/sdk/relationships/ci.yml new file mode 100644 index 000000000000..672bf3dfd9fb --- /dev/null +++ b/sdk/relationships/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/relationships/ci.yml + - sdk/relationships/azure-resourcemanager-relationships/ + exclude: + - sdk/relationships/pom.xml + - sdk/relationships/azure-resourcemanager-relationships/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/relationships/ci.yml + - sdk/relationships/azure-resourcemanager-relationships/ + exclude: + - sdk/relationships/pom.xml + - sdk/relationships/azure-resourcemanager-relationships/pom.xml + +parameters: + - name: release_azureresourcemanagerrelationships + displayName: azure-resourcemanager-relationships + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: relationships + Artifacts: + - name: azure-resourcemanager-relationships + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerrelationships + releaseInBatch: ${{ parameters.release_azureresourcemanagerrelationships }} diff --git a/sdk/relationships/pom.xml b/sdk/relationships/pom.xml new file mode 100644 index 000000000000..6889043f38e7 --- /dev/null +++ b/sdk/relationships/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-relationships-service + pom + 1.0.0 + + + azure-resourcemanager-relationships + + From 445d0d974d114adce341dcc9cb304320bb1c29fd Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 3 Apr 2026 06:12:32 +0000 Subject: [PATCH 2/2] Configurations: 'specification/relationships/Relationships.Management/tspconfig.yaml', API Version: 2023-09-01-preview, SDK Release Type: beta, and CommitSHA: '843ab81f0fb6e0d22bca64e1c73ffe64d1681ca9' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6103940 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../azure-resourcemanager-relationships/CHANGELOG.md | 3 ++- .../azure-resourcemanager-relationships/tsp-location.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/relationships/azure-resourcemanager-relationships/CHANGELOG.md b/sdk/relationships/azure-resourcemanager-relationships/CHANGELOG.md index bf3c33180fb2..86b0f753cf51 100644 --- a/sdk/relationships/azure-resourcemanager-relationships/CHANGELOG.md +++ b/sdk/relationships/azure-resourcemanager-relationships/CHANGELOG.md @@ -1,8 +1,9 @@ # Release History -## 1.0.0-beta.1 (2026-03-31) +## 1.0.0-beta.1 (2026-04-03) - Azure Resource Manager relationships client library for Java. This package contains Microsoft Azure SDK for relationships Management SDK. Microsoft.Relationships Resource Provider management API. Package api-version 2023-09-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added - Initial release for the azure-resourcemanager-relationships Java SDK. + diff --git a/sdk/relationships/azure-resourcemanager-relationships/tsp-location.yaml b/sdk/relationships/azure-resourcemanager-relationships/tsp-location.yaml index 9c3cb301d930..5d34478016a6 100644 --- a/sdk/relationships/azure-resourcemanager-relationships/tsp-location.yaml +++ b/sdk/relationships/azure-resourcemanager-relationships/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/relationships/Relationships.Management -commit: ab5c0abaf718ad3ad3328695dc8e1eb5b3bfd38c +commit: 843ab81f0fb6e0d22bca64e1c73ffe64d1681ca9 repo: Azure/azure-rest-api-specs additionalDirectories: