diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 6a0074c87350..b421c88bc6e7 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -418,6 +418,7 @@ com.azure.resourcemanager:azure-resourcemanager-networkcloud;1.0.0-beta.2;1.0.0- com.azure.resourcemanager:azure-resourcemanager-cosmosdbforpostgresql;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-managementgroups;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-managednetworkfabric;1.0.0;1.1.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-sphere;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-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index ec8e0f2ae458..c48f3a415d37 100644 --- a/pom.xml +++ b/pom.xml @@ -171,6 +171,7 @@ sdk/servicelinker sdk/servicenetworking sdk/signalr + sdk/sphere sdk/spring sdk/spring-experimental sdk/sqlvirtualmachine diff --git a/sdk/sphere/azure-resourcemanager-sphere/CHANGELOG.md b/sdk/sphere/azure-resourcemanager-sphere/CHANGELOG.md new file mode 100644 index 000000000000..a29a318e01d8 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-07-19) + +- Azure Resource Manager AzureSphere client library for Java. This package contains Microsoft Azure SDK for AzureSphere Management SDK. Azure Sphere resource management API. Package tag package-2022-09-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/sphere/azure-resourcemanager-sphere/README.md b/sdk/sphere/azure-resourcemanager-sphere/README.md new file mode 100644 index 000000000000..2c270ea9f71a --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/README.md @@ -0,0 +1,107 @@ +# Azure Resource Manager AzureSphere client library for Java + +Azure Resource Manager AzureSphere client library for Java. + +This package contains Microsoft Azure SDK for AzureSphere Management SDK. Azure Sphere resource management API. Package tag package-2022-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-sphere;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-sphere + 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 + +By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +AzureSphereManager manager = AzureSphereManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` 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/sphere/azure-resourcemanager-sphere/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://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[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/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fsphere%2Fazure-resourcemanager-sphere%2FREADME.png) diff --git a/sdk/sphere/azure-resourcemanager-sphere/SAMPLE.md b/sdk/sphere/azure-resourcemanager-sphere/SAMPLE.md new file mode 100644 index 000000000000..5bf2b6bf9674 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/SAMPLE.md @@ -0,0 +1,1114 @@ +# Code snippets and samples + + +## Catalogs + +- [CountDevices](#catalogs_countdevices) +- [CreateOrUpdate](#catalogs_createorupdate) +- [Delete](#catalogs_delete) +- [GetByResourceGroup](#catalogs_getbyresourcegroup) +- [List](#catalogs_list) +- [ListByResourceGroup](#catalogs_listbyresourcegroup) +- [ListDeployments](#catalogs_listdeployments) +- [ListDeviceGroups](#catalogs_listdevicegroups) +- [ListDeviceInsights](#catalogs_listdeviceinsights) +- [ListDevices](#catalogs_listdevices) +- [Update](#catalogs_update) + +## Certificates + +- [Get](#certificates_get) +- [ListByCatalog](#certificates_listbycatalog) +- [RetrieveCertChain](#certificates_retrievecertchain) +- [RetrieveProofOfPossessionNonce](#certificates_retrieveproofofpossessionnonce) + +## Deployments + +- [CreateOrUpdate](#deployments_createorupdate) +- [Delete](#deployments_delete) +- [Get](#deployments_get) +- [ListByDeviceGroup](#deployments_listbydevicegroup) + +## DeviceGroups + +- [ClaimDevices](#devicegroups_claimdevices) +- [CountDevices](#devicegroups_countdevices) +- [CreateOrUpdate](#devicegroups_createorupdate) +- [Delete](#devicegroups_delete) +- [Get](#devicegroups_get) +- [ListByProduct](#devicegroups_listbyproduct) +- [Update](#devicegroups_update) + +## Devices + +- [CreateOrUpdate](#devices_createorupdate) +- [Delete](#devices_delete) +- [GenerateCapabilityImage](#devices_generatecapabilityimage) +- [Get](#devices_get) +- [ListByDeviceGroup](#devices_listbydevicegroup) +- [Update](#devices_update) + +## Images + +- [CreateOrUpdate](#images_createorupdate) +- [Delete](#images_delete) +- [Get](#images_get) +- [ListByCatalog](#images_listbycatalog) + +## Operations + +- [List](#operations_list) + +## Products + +- [CountDevices](#products_countdevices) +- [CreateOrUpdate](#products_createorupdate) +- [Delete](#products_delete) +- [GenerateDefaultDeviceGroups](#products_generatedefaultdevicegroups) +- [Get](#products_get) +- [ListByCatalog](#products_listbycatalog) +- [Update](#products_update) +### Catalogs_CountDevices + +```java +/** Samples for Catalogs CountDevices. */ +public final class CatalogsCountDevicesSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostCountDevicesCatalog.json + */ + /** + * Sample code: Catalogs_CountDevices. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsCountDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.catalogs().countDevicesWithResponse("MyResourceGroup1", "MyCatalog1", com.azure.core.util.Context.NONE); + } +} +``` + +### Catalogs_CreateOrUpdate + +```java +/** Samples for Catalogs CreateOrUpdate. */ +public final class CatalogsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutCatalog.json + */ + /** + * Sample code: Catalogs_CreateOrUpdate. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .catalogs() + .define("MyCatalog1") + .withRegion("global") + .withExistingResourceGroup("MyResourceGroup1") + .create(); + } +} +``` + +### Catalogs_Delete + +```java +/** Samples for Catalogs Delete. */ +public final class CatalogsDeleteSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteCatalog.json + */ + /** + * Sample code: Catalogs_Delete. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.catalogs().delete("MyResourceGroup1", "MyCatalog1", com.azure.core.util.Context.NONE); + } +} +``` + +### Catalogs_GetByResourceGroup + +```java +/** Samples for Catalogs GetByResourceGroup. */ +public final class CatalogsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalog.json + */ + /** + * Sample code: Catalogs_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .catalogs() + .getByResourceGroupWithResponse("MyResourceGroup1", "MyCatalog1", com.azure.core.util.Context.NONE); + } +} +``` + +### Catalogs_List + +```java +/** Samples for Catalogs List. */ +public final class CatalogsListSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalogsSub.json + */ + /** + * Sample code: Catalogs_ListBySubscription. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsListBySubscription(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.catalogs().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Catalogs_ListByResourceGroup + +```java +/** Samples for Catalogs ListByResourceGroup. */ +public final class CatalogsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalogsRG.json + */ + /** + * Sample code: Catalogs_ListByResourceGroup. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsListByResourceGroup(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.catalogs().listByResourceGroup("MyResourceGroup1", com.azure.core.util.Context.NONE); + } +} +``` + +### Catalogs_ListDeployments + +```java +/** Samples for Catalogs ListDeployments. */ +public final class CatalogsListDeploymentsSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDeploymentsByCatalog.json + */ + /** + * Sample code: Catalogs_ListDeployments. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsListDeployments(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .catalogs() + .listDeployments( + "MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Catalogs_ListDeviceGroups + +```java +import com.azure.resourcemanager.sphere.models.ListDeviceGroupsRequest; + +/** Samples for Catalogs ListDeviceGroups. */ +public final class CatalogsListDeviceGroupsSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDeviceGroupsCatalog.json + */ + /** + * Sample code: Catalogs_ListDeviceGroups. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsListDeviceGroups(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .catalogs() + .listDeviceGroups( + "MyResourceGroup1", + "MyCatalog1", + new ListDeviceGroupsRequest().withDeviceGroupName("MyDeviceGroup1"), + null, + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Catalogs_ListDeviceInsights + +```java +/** Samples for Catalogs ListDeviceInsights. */ +public final class CatalogsListDeviceInsightsSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDeviceInsightsCatalog.json + */ + /** + * Sample code: Catalogs_ListDeviceInsights. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsListDeviceInsights(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .catalogs() + .listDeviceInsights( + "MyResourceGroup1", "MyCatalog1", null, 10, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Catalogs_ListDevices + +```java +/** Samples for Catalogs ListDevices. */ +public final class CatalogsListDevicesSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDevicesByCatalog.json + */ + /** + * Sample code: Catalogs_ListDevices. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsListDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .catalogs() + .listDevices("MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Catalogs_Update + +```java +import com.azure.resourcemanager.sphere.models.Catalog; + +/** Samples for Catalogs Update. */ +public final class CatalogsUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PatchCatalog.json + */ + /** + * Sample code: Catalogs_Update. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + Catalog resource = + manager + .catalogs() + .getByResourceGroupWithResponse("MyResourceGroup1", "MyCatalog1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + +### Certificates_Get + +```java +/** Samples for Certificates Get. */ +public final class CertificatesGetSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCertificate.json + */ + /** + * Sample code: Certificates_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void certificatesGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .certificates() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "default", com.azure.core.util.Context.NONE); + } +} +``` + +### Certificates_ListByCatalog + +```java +/** Samples for Certificates ListByCatalog. */ +public final class CertificatesListByCatalogSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCertificates.json + */ + /** + * Sample code: Certificates_ListByCatalog. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void certificatesListByCatalog(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .certificates() + .listByCatalog("MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Certificates_RetrieveCertChain + +```java +/** Samples for Certificates RetrieveCertChain. */ +public final class CertificatesRetrieveCertChainSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostRetrieveCatalogCertChain.json + */ + /** + * Sample code: Certificates_RetrieveCertChain. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void certificatesRetrieveCertChain(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .certificates() + .retrieveCertChainWithResponse( + "MyResourceGroup1", "MyCatalog1", "active", com.azure.core.util.Context.NONE); + } +} +``` + +### Certificates_RetrieveProofOfPossessionNonce + +```java +import com.azure.resourcemanager.sphere.models.ProofOfPossessionNonceRequest; + +/** Samples for Certificates RetrieveProofOfPossessionNonce. */ +public final class CertificatesRetrieveProofOfPossessionNonceSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostRetrieveProofOfPossessionNonce.json + */ + /** + * Sample code: Certificates_RetrieveProofOfPossessionNonce. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void certificatesRetrieveProofOfPossessionNonce( + com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .certificates() + .retrieveProofOfPossessionNonceWithResponse( + "MyResourceGroup1", + "MyCatalog1", + "active", + new ProofOfPossessionNonceRequest().withProofOfPossessionNonce("proofOfPossessionNonce"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Deployments_CreateOrUpdate + +```java +/** Samples for Deployments CreateOrUpdate. */ +public final class DeploymentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutDeployment.json + */ + /** + * Sample code: Deployments_CreateOrUpdate. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deploymentsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deployments() + .define("MyDeployment1") + .withExistingDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1") + .create(); + } +} +``` + +### Deployments_Delete + +```java +/** Samples for Deployments Delete. */ +public final class DeploymentsDeleteSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteDeployment.json + */ + /** + * Sample code: Deployments_Delete. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deploymentsDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deployments() + .delete( + "MyResourceGroup1", + "MyCatalog1", + "MyProductName1", + "DeviceGroupName1", + "MyDeploymentName1", + com.azure.core.util.Context.NONE); + } +} +``` + +### Deployments_Get + +```java +/** Samples for Deployments Get. */ +public final class DeploymentsGetSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeployment.json + */ + /** + * Sample code: Deployments_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deploymentsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deployments() + .getWithResponse( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + "MyDeployment1", + com.azure.core.util.Context.NONE); + } +} +``` + +### Deployments_ListByDeviceGroup + +```java +/** Samples for Deployments ListByDeviceGroup. */ +public final class DeploymentsListByDeviceGroupSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeployments.json + */ + /** + * Sample code: Deployments_ListByDeviceGroup. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deploymentsListByDeviceGroup(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deployments() + .listByDeviceGroup( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + null, + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### DeviceGroups_ClaimDevices + +```java +import com.azure.resourcemanager.sphere.models.ClaimDevicesRequest; +import java.util.Arrays; + +/** Samples for DeviceGroups ClaimDevices. */ +public final class DeviceGroupsClaimDevicesSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostClaimDevices.json + */ + /** + * Sample code: DeviceGroups_ClaimDevices. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsClaimDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deviceGroups() + .claimDevices( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "MyDeviceGroup1", + new ClaimDevicesRequest() + .withDeviceIdentifiers( + Arrays + .asList( + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")), + com.azure.core.util.Context.NONE); + } +} +``` + +### DeviceGroups_CountDevices + +```java +/** Samples for DeviceGroups CountDevices. */ +public final class DeviceGroupsCountDevicesSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostCountDevicesDeviceGroup.json + */ + /** + * Sample code: DeviceGroups_CountDevices. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsCountDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deviceGroups() + .countDevicesWithResponse( + "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", com.azure.core.util.Context.NONE); + } +} +``` + +### DeviceGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.sphere.models.OSFeedType; +import com.azure.resourcemanager.sphere.models.UpdatePolicy; + +/** Samples for DeviceGroups CreateOrUpdate. */ +public final class DeviceGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutDeviceGroup.json + */ + /** + * Sample code: DeviceGroups_CreateOrUpdate. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deviceGroups() + .define("MyDeviceGroup1") + .withExistingProduct("MyResourceGroup1", "MyCatalog1", "MyProduct1") + .withDescription("Description for MyDeviceGroup1") + .withOsFeedType(OSFeedType.RETAIL) + .withUpdatePolicy(UpdatePolicy.UPDATE_ALL) + .create(); + } +} +``` + +### DeviceGroups_Delete + +```java +/** Samples for DeviceGroups Delete. */ +public final class DeviceGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteDeviceGroup.json + */ + /** + * Sample code: DeviceGroups_Delete. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deviceGroups() + .delete("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", com.azure.core.util.Context.NONE); + } +} +``` + +### DeviceGroups_Get + +```java +/** Samples for DeviceGroups Get. */ +public final class DeviceGroupsGetSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeviceGroup.json + */ + /** + * Sample code: DeviceGroups_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deviceGroups() + .getWithResponse( + "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", com.azure.core.util.Context.NONE); + } +} +``` + +### DeviceGroups_ListByProduct + +```java +/** Samples for DeviceGroups ListByProduct. */ +public final class DeviceGroupsListByProductSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeviceGroups.json + */ + /** + * Sample code: DeviceGroups_ListByProduct. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsListByProduct(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deviceGroups() + .listByProduct( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + null, + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### DeviceGroups_Update + +```java +import com.azure.resourcemanager.sphere.models.DeviceGroup; + +/** Samples for DeviceGroups Update. */ +public final class DeviceGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PatchDeviceGroup.json + */ + /** + * Sample code: DeviceGroups_Update. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + DeviceGroup resource = + manager + .deviceGroups() + .getWithResponse( + "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + +### Devices_CreateOrUpdate + +```java +/** Samples for Devices CreateOrUpdate. */ +public final class DevicesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutDevice.json + */ + /** + * Sample code: Devices_CreateOrUpdate. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void devicesCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .devices() + .define( + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") + .withExistingDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1") + .create(); + } +} +``` + +### Devices_Delete + +```java +/** Samples for Devices Delete. */ +public final class DevicesDeleteSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteDevice.json + */ + /** + * Sample code: Devices_Delete. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void devicesDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .devices() + .delete( + "MyResourceGroup1", + "MyCatalog1", + "MyProductName1", + "DeviceGroupName1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + com.azure.core.util.Context.NONE); + } +} +``` + +### Devices_GenerateCapabilityImage + +```java +import com.azure.resourcemanager.sphere.models.CapabilityType; +import com.azure.resourcemanager.sphere.models.GenerateCapabilityImageRequest; +import java.util.Arrays; + +/** Samples for Devices GenerateCapabilityImage. */ +public final class DevicesGenerateCapabilityImageSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostGenerateDeviceCapabilityImage.json + */ + /** + * Sample code: Devices_GenerateCapabilityImage. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void devicesGenerateCapabilityImage(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .devices() + .generateCapabilityImage( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + new GenerateCapabilityImageRequest() + .withCapabilities(Arrays.asList(CapabilityType.APPLICATION_DEVELOPMENT)), + com.azure.core.util.Context.NONE); + } +} +``` + +### Devices_Get + +```java +/** Samples for Devices Get. */ +public final class DevicesGetSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDevice.json + */ + /** + * Sample code: Devices_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void devicesGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .devices() + .getWithResponse( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + com.azure.core.util.Context.NONE); + } +} +``` + +### Devices_ListByDeviceGroup + +```java +/** Samples for Devices ListByDeviceGroup. */ +public final class DevicesListByDeviceGroupSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDevices.json + */ + /** + * Sample code: Devices_ListByDeviceGroup. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void devicesListByDeviceGroup(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .devices() + .listByDeviceGroup( + "MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", com.azure.core.util.Context.NONE); + } +} +``` + +### Devices_Update + +```java +import com.azure.resourcemanager.sphere.models.Device; + +/** Samples for Devices Update. */ +public final class DevicesUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PatchDevice.json + */ + /** + * Sample code: Devices_Update. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void devicesUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + Device resource = + manager + .devices() + .getWithResponse( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "MyDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + +### Images_CreateOrUpdate + +```java +/** Samples for Images CreateOrUpdate. */ +public final class ImagesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutImage.json + */ + /** + * Sample code: Image_CreateOrUpdate. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void imageCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .images() + .define("default") + .withExistingCatalog("MyResourceGroup1", "MyCatalog1") + .withImage("bXliYXNlNjRzdHJpbmc=") + .create(); + } +} +``` + +### Images_Delete + +```java +/** Samples for Images Delete. */ +public final class ImagesDeleteSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteImage.json + */ + /** + * Sample code: Images_Delete. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void imagesDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.images().delete("MyResourceGroup1", "MyCatalog1", "imageID", com.azure.core.util.Context.NONE); + } +} +``` + +### Images_Get + +```java +/** Samples for Images Get. */ +public final class ImagesGetSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetImage.json + */ + /** + * Sample code: Images_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void imagesGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .images() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "myImageId", com.azure.core.util.Context.NONE); + } +} +``` + +### Images_ListByCatalog + +```java +/** Samples for Images ListByCatalog. */ +public final class ImagesListByCatalogSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetImages.json + */ + /** + * Sample code: Images_ListByCatalog. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void imagesListByCatalog(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .images() + .listByCatalog("MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetOperations.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void operationsList(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Products_CountDevices + +```java +/** Samples for Products CountDevices. */ +public final class ProductsCountDevicesSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostCountDevicesProduct.json + */ + /** + * Sample code: Products_CountDevices. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsCountDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .products() + .countDevicesWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", com.azure.core.util.Context.NONE); + } +} +``` + +### Products_CreateOrUpdate + +```java +/** Samples for Products CreateOrUpdate. */ +public final class ProductsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutProduct.json + */ + /** + * Sample code: Products_CreateOrUpdate. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.products().define("MyProduct1").withExistingCatalog("MyResourceGroup1", "MyCatalog1").create(); + } +} +``` + +### Products_Delete + +```java +/** Samples for Products Delete. */ +public final class ProductsDeleteSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteProduct.json + */ + /** + * Sample code: Products_Delete. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.products().delete("MyResourceGroup1", "MyCatalog1", "MyProductName1", com.azure.core.util.Context.NONE); + } +} +``` + +### Products_GenerateDefaultDeviceGroups + +```java +/** Samples for Products GenerateDefaultDeviceGroups. */ +public final class ProductsGenerateDefaultDeviceGroupsSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostGenerateDefaultDeviceGroups.json + */ + /** + * Sample code: Products_GenerateDefaultDeviceGroups. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsGenerateDefaultDeviceGroups( + com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .products() + .generateDefaultDeviceGroups( + "MyResourceGroup1", "MyCatalog1", "MyProduct1", com.azure.core.util.Context.NONE); + } +} +``` + +### Products_Get + +```java +/** Samples for Products Get. */ +public final class ProductsGetSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetProduct.json + */ + /** + * Sample code: Products_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .products() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", com.azure.core.util.Context.NONE); + } +} +``` + +### Products_ListByCatalog + +```java +/** Samples for Products ListByCatalog. */ +public final class ProductsListByCatalogSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetProducts.json + */ + /** + * Sample code: Products_ListByCatalog. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsListByCatalog(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.products().listByCatalog("MyResourceGroup1", "MyCatalog1", com.azure.core.util.Context.NONE); + } +} +``` + +### Products_Update + +```java +import com.azure.resourcemanager.sphere.models.Product; + +/** Samples for Products Update. */ +public final class ProductsUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PatchProduct.json + */ + /** + * Sample code: Products_Update. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + Product resource = + manager + .products() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + diff --git a/sdk/sphere/azure-resourcemanager-sphere/pom.xml b/sdk/sphere/azure-resourcemanager-sphere/pom.xml new file mode 100644 index 000000000000..d294891e8fa5 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-sphere + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for AzureSphere Management + This package contains Microsoft Azure SDK for AzureSphere Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Sphere resource management API. Package tag package-2022-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 + + + + com.azure + azure-core + 1.41.0 + + + com.azure + azure-core-management + 1.11.3 + + + diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/AzureSphereManager.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/AzureSphereManager.java new file mode 100644 index 000000000000..6b49b7f12dc7 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/AzureSphereManager.java @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere; + +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.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.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sphere.fluent.AzureSphereManagementClient; +import com.azure.resourcemanager.sphere.implementation.AzureSphereManagementClientBuilder; +import com.azure.resourcemanager.sphere.implementation.CatalogsImpl; +import com.azure.resourcemanager.sphere.implementation.CertificatesImpl; +import com.azure.resourcemanager.sphere.implementation.DeploymentsImpl; +import com.azure.resourcemanager.sphere.implementation.DeviceGroupsImpl; +import com.azure.resourcemanager.sphere.implementation.DevicesImpl; +import com.azure.resourcemanager.sphere.implementation.ImagesImpl; +import com.azure.resourcemanager.sphere.implementation.OperationsImpl; +import com.azure.resourcemanager.sphere.implementation.ProductsImpl; +import com.azure.resourcemanager.sphere.models.Catalogs; +import com.azure.resourcemanager.sphere.models.Certificates; +import com.azure.resourcemanager.sphere.models.Deployments; +import com.azure.resourcemanager.sphere.models.DeviceGroups; +import com.azure.resourcemanager.sphere.models.Devices; +import com.azure.resourcemanager.sphere.models.Images; +import com.azure.resourcemanager.sphere.models.Operations; +import com.azure.resourcemanager.sphere.models.Products; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to AzureSphereManager. Azure Sphere resource management API. */ +public final class AzureSphereManager { + private Operations operations; + + private Catalogs catalogs; + + private Certificates certificates; + + private Images images; + + private Products products; + + private DeviceGroups deviceGroups; + + private Deployments deployments; + + private Devices devices; + + private final AzureSphereManagementClient clientObject; + + private AzureSphereManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new AzureSphereManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of AzureSphere service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the AzureSphere service API instance. + */ + public static AzureSphereManager 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 AzureSphere service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the AzureSphere service API instance. + */ + public static AzureSphereManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new AzureSphereManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create AzureSphereManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AzureSphereManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + 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 AzureSphere service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the AzureSphere service API instance. + */ + public AzureSphereManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.sphere") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } 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 ArmChallengeAuthenticationPolicy(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 AzureSphereManager(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 Catalogs. It manages Catalog. + * + * @return Resource collection API of Catalogs. + */ + public Catalogs catalogs() { + if (this.catalogs == null) { + this.catalogs = new CatalogsImpl(clientObject.getCatalogs(), this); + } + return catalogs; + } + + /** + * Gets the resource collection API of Certificates. + * + * @return Resource collection API of Certificates. + */ + public Certificates certificates() { + if (this.certificates == null) { + this.certificates = new CertificatesImpl(clientObject.getCertificates(), this); + } + return certificates; + } + + /** + * Gets the resource collection API of Images. It manages Image. + * + * @return Resource collection API of Images. + */ + public Images images() { + if (this.images == null) { + this.images = new ImagesImpl(clientObject.getImages(), this); + } + return images; + } + + /** + * Gets the resource collection API of Products. It manages Product. + * + * @return Resource collection API of Products. + */ + public Products products() { + if (this.products == null) { + this.products = new ProductsImpl(clientObject.getProducts(), this); + } + return products; + } + + /** + * Gets the resource collection API of DeviceGroups. It manages DeviceGroup. + * + * @return Resource collection API of DeviceGroups. + */ + public DeviceGroups deviceGroups() { + if (this.deviceGroups == null) { + this.deviceGroups = new DeviceGroupsImpl(clientObject.getDeviceGroups(), this); + } + return deviceGroups; + } + + /** + * Gets the resource collection API of Deployments. It manages Deployment. + * + * @return Resource collection API of Deployments. + */ + public Deployments deployments() { + if (this.deployments == null) { + this.deployments = new DeploymentsImpl(clientObject.getDeployments(), this); + } + return deployments; + } + + /** + * Gets the resource collection API of Devices. It manages Device. + * + * @return Resource collection API of Devices. + */ + public Devices devices() { + if (this.devices == null) { + this.devices = new DevicesImpl(clientObject.getDevices(), this); + } + return devices; + } + + /** + * @return Wrapped service client AzureSphereManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public AzureSphereManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/AzureSphereManagementClient.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/AzureSphereManagementClient.java new file mode 100644 index 000000000000..82f217261953 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/AzureSphereManagementClient.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for AzureSphereManagementClient class. */ +public interface AzureSphereManagementClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the CatalogsClient object to access its operations. + * + * @return the CatalogsClient object. + */ + CatalogsClient getCatalogs(); + + /** + * Gets the CertificatesClient object to access its operations. + * + * @return the CertificatesClient object. + */ + CertificatesClient getCertificates(); + + /** + * Gets the ImagesClient object to access its operations. + * + * @return the ImagesClient object. + */ + ImagesClient getImages(); + + /** + * Gets the ProductsClient object to access its operations. + * + * @return the ProductsClient object. + */ + ProductsClient getProducts(); + + /** + * Gets the DeviceGroupsClient object to access its operations. + * + * @return the DeviceGroupsClient object. + */ + DeviceGroupsClient getDeviceGroups(); + + /** + * Gets the DeploymentsClient object to access its operations. + * + * @return the DeploymentsClient object. + */ + DeploymentsClient getDeployments(); + + /** + * Gets the DevicesClient object to access its operations. + * + * @return the DevicesClient object. + */ + DevicesClient getDevices(); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/CatalogsClient.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/CatalogsClient.java new file mode 100644 index 000000000000..b06050790d6c --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/CatalogsClient.java @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.models.CatalogInner; +import com.azure.resourcemanager.sphere.fluent.models.CountDeviceResponseInner; +import com.azure.resourcemanager.sphere.fluent.models.DeploymentInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceInsightInner; +import com.azure.resourcemanager.sphere.models.CatalogUpdate; +import com.azure.resourcemanager.sphere.models.ListDeviceGroupsRequest; + +/** An instance of this class provides access to all the operations defined in CatalogsClient. */ +public interface CatalogsClient { + /** + * List Catalog resources by subscription ID. + * + * @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 response of a Catalog list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Catalog resources by subscription 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 the response of a Catalog list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List Catalog resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Catalog list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Catalog resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a Catalog list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 Catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String catalogName, Context context); + + /** + * Get a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 Catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CatalogInner getByResourceGroup(String resourceGroupName, String catalogName); + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CatalogInner> beginCreateOrUpdate( + String resourceGroupName, String catalogName, CatalogInner resource); + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CatalogInner> beginCreateOrUpdate( + String resourceGroupName, String catalogName, CatalogInner resource, Context context); + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CatalogInner createOrUpdate(String resourceGroupName, String catalogName, CatalogInner resource); + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CatalogInner createOrUpdate(String resourceGroupName, String catalogName, CatalogInner resource, Context context); + + /** + * Update a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param properties The resource properties to be updated. + * @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 an Azure Sphere catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String catalogName, CatalogUpdate properties, Context context); + + /** + * Update a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param properties The resource properties to be updated. + * @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 an Azure Sphere catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CatalogInner update(String resourceGroupName, String catalogName, CatalogUpdate properties); + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName); + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName, Context context); + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName); + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName, Context context); + + /** + * Counts devices in catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response to the action call for count devices in a catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response countDevicesWithResponse( + String resourceGroupName, String catalogName, Context context); + + /** + * Counts devices in catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response to the action call for count devices in a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CountDeviceResponseInner countDevices(String resourceGroupName, String catalogName); + + /** + * Lists deployments for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeployments(String resourceGroupName, String catalogName); + + /** + * Lists deployments for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeployments( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * List the device groups for the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param listDeviceGroupsRequest List device groups for catalog. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeviceGroups( + String resourceGroupName, String catalogName, ListDeviceGroupsRequest listDeviceGroupsRequest); + + /** + * List the device groups for the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param listDeviceGroupsRequest List device groups for catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeviceGroups( + String resourceGroupName, + String catalogName, + ListDeviceGroupsRequest listDeviceGroupsRequest, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Lists device insights for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 paged collection of DeviceInsight items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeviceInsights(String resourceGroupName, String catalogName); + + /** + * Lists device insights for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 paged collection of DeviceInsight items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDeviceInsights( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Lists devices for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response of a Device list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDevices(String resourceGroupName, String catalogName); + + /** + * Lists devices for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a Device list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listDevices( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/CertificatesClient.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/CertificatesClient.java new file mode 100644 index 000000000000..a25275cddf21 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/CertificatesClient.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.CertificateChainResponseInner; +import com.azure.resourcemanager.sphere.fluent.models.CertificateInner; +import com.azure.resourcemanager.sphere.fluent.models.ProofOfPossessionNonceResponseInner; +import com.azure.resourcemanager.sphere.models.ProofOfPossessionNonceRequest; + +/** An instance of this class provides access to all the operations defined in CertificatesClient. */ +public interface CertificatesClient { + /** + * List Certificate resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response of a Certificate list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCatalog(String resourceGroupName, String catalogName); + + /** + * List Certificate resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a Certificate list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCatalog( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Get a Certificate. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 Certificate along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String catalogName, String serialNumber, Context context); + + /** + * Get a Certificate. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateInner get(String resourceGroupName, String catalogName, String serialNumber); + + /** + * Retrieves cert chain. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 certificate chain response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response retrieveCertChainWithResponse( + String resourceGroupName, String catalogName, String serialNumber, Context context); + + /** + * Retrieves cert chain. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 certificate chain response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateChainResponseInner retrieveCertChain(String resourceGroupName, String catalogName, String serialNumber); + + /** + * Gets the proof of possession nonce. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @param proofOfPossessionNonceRequest Proof of possession nonce request body. + * @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 proof of possession nonce along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response retrieveProofOfPossessionNonceWithResponse( + String resourceGroupName, + String catalogName, + String serialNumber, + ProofOfPossessionNonceRequest proofOfPossessionNonceRequest, + Context context); + + /** + * Gets the proof of possession nonce. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @param proofOfPossessionNonceRequest Proof of possession nonce request body. + * @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 proof of possession nonce. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProofOfPossessionNonceResponseInner retrieveProofOfPossessionNonce( + String resourceGroupName, + String catalogName, + String serialNumber, + ProofOfPossessionNonceRequest proofOfPossessionNonceRequest); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/DeploymentsClient.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/DeploymentsClient.java new file mode 100644 index 000000000000..0d59f94edfa1 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/DeploymentsClient.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.models.DeploymentInner; + +/** An instance of this class provides access to all the operations defined in DeploymentsClient. */ +public interface DeploymentsClient { + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName); + + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDeviceGroup( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device + * group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 Deployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context); + + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device + * group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 Deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentInner get( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName); + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentInner> beginCreateOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource); + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeploymentInner> beginCreateOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource, + Context context); + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentInner createOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource); + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeploymentInner createOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource, + Context context); + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName); + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context); + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName); + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/DeviceGroupsClient.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/DeviceGroupsClient.java new file mode 100644 index 000000000000..4e210133bb5c --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/DeviceGroupsClient.java @@ -0,0 +1,473 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.models.CountDeviceResponseInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner; +import com.azure.resourcemanager.sphere.models.ClaimDevicesRequest; +import com.azure.resourcemanager.sphere.models.DeviceGroupUpdate; + +/** An instance of this class provides access to all the operations defined in DeviceGroupsClient. */ +public interface DeviceGroupsClient { + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByProduct(String resourceGroupName, String catalogName, String productName); + + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByProduct( + String resourceGroupName, + String catalogName, + String productName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 DeviceGroup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context); + + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 DeviceGroup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceGroupInner get(String resourceGroupName, String catalogName, String productName, String deviceGroupName); + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeviceGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource); + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeviceGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource, + Context context); + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceGroupInner createOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource); + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceGroupInner createOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource, + Context context); + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeviceGroupInner> beginUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties); + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeviceGroupInner> beginUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties, + Context context); + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceGroupInner update( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties); + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceGroupInner update( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties, + Context context); + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName); + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context); + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName); + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context); + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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> beginClaimDevices( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest); + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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> beginClaimDevices( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest, + Context context); + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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 claimDevices( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest); + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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 claimDevices( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest, + Context context); + + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response to the action call for count devices in a catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response countDevicesWithResponse( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context); + + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response to the action call for count devices in a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CountDeviceResponseInner countDevices( + String resourceGroupName, String catalogName, String productName, String deviceGroupName); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/DevicesClient.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/DevicesClient.java new file mode 100644 index 000000000000..b053aa5cadac --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/DevicesClient.java @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.models.DeviceInner; +import com.azure.resourcemanager.sphere.fluent.models.SignedCapabilityImageResponseInner; +import com.azure.resourcemanager.sphere.models.DeviceUpdate; +import com.azure.resourcemanager.sphere.models.GenerateCapabilityImageRequest; + +/** An instance of this class provides access to all the operations defined in DevicesClient. */ +public interface DevicesClient { + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + * for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response of a Device list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName); + + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + * for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response of a Device list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context); + + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not + * belong to a device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 Device along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context); + + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not + * belong to a device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 Device. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceInner get( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName); + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeviceInner> beginCreateOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource); + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeviceInner> beginCreateOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource, + Context context); + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceInner createOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource); + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceInner createOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource, + Context context); + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeviceInner> beginUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties); + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeviceInner> beginUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties, + Context context); + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceInner update( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties); + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeviceInner update( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties, + Context context); + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName); + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context); + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName); + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context); + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SignedCapabilityImageResponseInner> + beginGenerateCapabilityImage( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest); + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SignedCapabilityImageResponseInner> + beginGenerateCapabilityImage( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest, + Context context); + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SignedCapabilityImageResponseInner generateCapabilityImage( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest); + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SignedCapabilityImageResponseInner generateCapabilityImage( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest, + Context context); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/ImagesClient.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/ImagesClient.java new file mode 100644 index 000000000000..205ceca662eb --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/ImagesClient.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.models.ImageInner; + +/** An instance of this class provides access to all the operations defined in ImagesClient. */ +public interface ImagesClient { + /** + * List Image resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response of a Image list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCatalog(String resourceGroupName, String catalogName); + + /** + * List Image resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a Image list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCatalog( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Get a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 Image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String catalogName, String imageName, Context context); + + /** + * Get a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 Image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageInner get(String resourceGroupName, String catalogName, String imageName); + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImageInner> beginCreateOrUpdate( + String resourceGroupName, String catalogName, String imageName, ImageInner resource); + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImageInner> beginCreateOrUpdate( + String resourceGroupName, String catalogName, String imageName, ImageInner resource, Context context); + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageInner createOrUpdate(String resourceGroupName, String catalogName, String imageName, ImageInner resource); + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageInner createOrUpdate( + String resourceGroupName, String catalogName, String imageName, ImageInner resource, Context context); + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName); + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName, Context context); + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName); + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName, Context context); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/OperationsClient.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/OperationsClient.java new file mode 100644 index 000000000000..628bd10d47fc --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.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.sphere.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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/ProductsClient.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/ProductsClient.java new file mode 100644 index 000000000000..bcf5c9ad4825 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/ProductsClient.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.models.CountDeviceResponseInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner; +import com.azure.resourcemanager.sphere.fluent.models.ProductInner; +import com.azure.resourcemanager.sphere.models.ProductUpdate; + +/** An instance of this class provides access to all the operations defined in ProductsClient. */ +public interface ProductsClient { + /** + * List Product resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response of a Product list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCatalog(String resourceGroupName, String catalogName); + + /** + * List Product resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response of a Product list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCatalog(String resourceGroupName, String catalogName, Context context); + + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 Product along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String catalogName, String productName, Context context); + + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 Product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProductInner get(String resourceGroupName, String catalogName, String productName); + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProductInner> beginCreateOrUpdate( + String resourceGroupName, String catalogName, String productName, ProductInner resource); + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProductInner> beginCreateOrUpdate( + String resourceGroupName, String catalogName, String productName, ProductInner resource, Context context); + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProductInner createOrUpdate( + String resourceGroupName, String catalogName, String productName, ProductInner resource); + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProductInner createOrUpdate( + String resourceGroupName, String catalogName, String productName, ProductInner resource, Context context); + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProductInner> beginUpdate( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties); + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProductInner> beginUpdate( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties, Context context); + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProductInner update(String resourceGroupName, String catalogName, String productName, ProductUpdate properties); + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProductInner update( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties, Context context); + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName); + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName, Context context); + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName); + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName, Context context); + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response to the action call for count devices in a catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response countDevicesWithResponse( + String resourceGroupName, String catalogName, String productName, Context context); + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response to the action call for count devices in a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CountDeviceResponseInner countDevices(String resourceGroupName, String catalogName, String productName); + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable generateDefaultDeviceGroups( + String resourceGroupName, String catalogName, String productName); + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable generateDefaultDeviceGroups( + String resourceGroupName, String catalogName, String productName, Context context); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CatalogInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CatalogInner.java new file mode 100644 index 000000000000..a639e4b67f15 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CatalogInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Sphere catalog. */ +@Fluent +public final class CatalogInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private CatalogProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of CatalogInner class. */ + public CatalogInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private CatalogProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public CatalogInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CatalogInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CatalogProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CatalogProperties.java new file mode 100644 index 000000000000..e5e5c035f83a --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CatalogProperties.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Catalog properties. */ +@Immutable +public final class CatalogProperties { + /* + * The status of the last operation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of CatalogProperties class. */ + public CatalogProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateChainResponseInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateChainResponseInner.java new file mode 100644 index 000000000000..e5e299011709 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateChainResponseInner.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The certificate chain response. */ +@Immutable +public final class CertificateChainResponseInner { + /* + * The certificate chain. + */ + @JsonProperty(value = "certificateChain", access = JsonProperty.Access.WRITE_ONLY) + private String certificateChain; + + /** Creates an instance of CertificateChainResponseInner class. */ + public CertificateChainResponseInner() { + } + + /** + * Get the certificateChain property: The certificate chain. + * + * @return the certificateChain value. + */ + public String certificateChain() { + return this.certificateChain; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateInner.java new file mode 100644 index 000000000000..9f50de6cf610 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sphere.models.CertificateStatus; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An certificate resource belonging to a catalog resource. */ +@Immutable +public final class CertificateInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private CertificateProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of CertificateInner class. */ + public CertificateInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private CertificateProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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 certificate property: The certificate as a UTF-8 encoded base 64 string. + * + * @return the certificate value. + */ + public String certificate() { + return this.innerProperties() == null ? null : this.innerProperties().certificate(); + } + + /** + * Get the status property: The certificate status. + * + * @return the status value. + */ + public CertificateStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the subject property: The certificate subject. + * + * @return the subject value. + */ + public String subject() { + return this.innerProperties() == null ? null : this.innerProperties().subject(); + } + + /** + * Get the thumbprint property: The certificate thumbprint. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.innerProperties() == null ? null : this.innerProperties().thumbprint(); + } + + /** + * Get the expiryUtc property: The certificate expiry date. + * + * @return the expiryUtc value. + */ + public OffsetDateTime expiryUtc() { + return this.innerProperties() == null ? null : this.innerProperties().expiryUtc(); + } + + /** + * Get the notBeforeUtc property: The certificate not before date. + * + * @return the notBeforeUtc value. + */ + public OffsetDateTime notBeforeUtc() { + return this.innerProperties() == null ? null : this.innerProperties().notBeforeUtc(); + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateProperties.java new file mode 100644 index 000000000000..94db576f28bd --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CertificateProperties.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sphere.models.CertificateStatus; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of certificate. */ +@Immutable +public class CertificateProperties { + /* + * The certificate as a UTF-8 encoded base 64 string. + */ + @JsonProperty(value = "certificate", access = JsonProperty.Access.WRITE_ONLY) + private String certificate; + + /* + * The certificate status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private CertificateStatus status; + + /* + * The certificate subject. + */ + @JsonProperty(value = "subject", access = JsonProperty.Access.WRITE_ONLY) + private String subject; + + /* + * The certificate thumbprint. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * The certificate expiry date. + */ + @JsonProperty(value = "expiryUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime expiryUtc; + + /* + * The certificate not before date. + */ + @JsonProperty(value = "notBeforeUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime notBeforeUtc; + + /* + * The status of the last operation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of CertificateProperties class. */ + public CertificateProperties() { + } + + /** + * Get the certificate property: The certificate as a UTF-8 encoded base 64 string. + * + * @return the certificate value. + */ + public String certificate() { + return this.certificate; + } + + /** + * Get the status property: The certificate status. + * + * @return the status value. + */ + public CertificateStatus status() { + return this.status; + } + + /** + * Get the subject property: The certificate subject. + * + * @return the subject value. + */ + public String subject() { + return this.subject; + } + + /** + * Get the thumbprint property: The certificate thumbprint. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the expiryUtc property: The certificate expiry date. + * + * @return the expiryUtc value. + */ + public OffsetDateTime expiryUtc() { + return this.expiryUtc; + } + + /** + * Get the notBeforeUtc property: The certificate not before date. + * + * @return the notBeforeUtc value. + */ + public OffsetDateTime notBeforeUtc() { + return this.notBeforeUtc; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CountDeviceResponseInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CountDeviceResponseInner.java new file mode 100644 index 000000000000..80c30909e9da --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/CountDeviceResponseInner.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sphere.models.CountElementsResponse; + +/** Response to the action call for count devices in a catalog. */ +@Fluent +public final class CountDeviceResponseInner extends CountElementsResponse { + /** Creates an instance of CountDeviceResponseInner class. */ + public CountDeviceResponseInner() { + } + + /** {@inheritDoc} */ + @Override + public CountDeviceResponseInner withValue(int value) { + super.withValue(value); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeploymentInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeploymentInner.java new file mode 100644 index 000000000000..ed70be5ad59c --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeploymentInner.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** An deployment resource belonging to a device group resource. */ +@Fluent +public final class DeploymentInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private DeploymentProperties innerProperties; + + /** Creates an instance of DeploymentInner class. */ + public DeploymentInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private DeploymentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the deploymentId property: Deployment ID. + * + * @return the deploymentId value. + */ + public String deploymentId() { + return this.innerProperties() == null ? null : this.innerProperties().deploymentId(); + } + + /** + * Set the deploymentId property: Deployment ID. + * + * @param deploymentId the deploymentId value to set. + * @return the DeploymentInner object itself. + */ + public DeploymentInner withDeploymentId(String deploymentId) { + if (this.innerProperties() == null) { + this.innerProperties = new DeploymentProperties(); + } + this.innerProperties().withDeploymentId(deploymentId); + return this; + } + + /** + * Get the deployedImages property: Images deployed. + * + * @return the deployedImages value. + */ + public List deployedImages() { + return this.innerProperties() == null ? null : this.innerProperties().deployedImages(); + } + + /** + * Set the deployedImages property: Images deployed. + * + * @param deployedImages the deployedImages value to set. + * @return the DeploymentInner object itself. + */ + public DeploymentInner withDeployedImages(List deployedImages) { + if (this.innerProperties() == null) { + this.innerProperties = new DeploymentProperties(); + } + this.innerProperties().withDeployedImages(deployedImages); + return this; + } + + /** + * Get the deploymentDateUtc property: Deployment date UTC. + * + * @return the deploymentDateUtc value. + */ + public OffsetDateTime deploymentDateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().deploymentDateUtc(); + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeploymentProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeploymentProperties.java new file mode 100644 index 000000000000..426c75a317fd --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeploymentProperties.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The properties of deployment. */ +@Fluent +public final class DeploymentProperties { + /* + * Deployment ID + */ + @JsonProperty(value = "deploymentId") + private String deploymentId; + + /* + * Images deployed + */ + @JsonProperty(value = "deployedImages") + private List deployedImages; + + /* + * Deployment date UTC + */ + @JsonProperty(value = "deploymentDateUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deploymentDateUtc; + + /* + * The status of the last operation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of DeploymentProperties class. */ + public DeploymentProperties() { + } + + /** + * Get the deploymentId property: Deployment ID. + * + * @return the deploymentId value. + */ + public String deploymentId() { + return this.deploymentId; + } + + /** + * Set the deploymentId property: Deployment ID. + * + * @param deploymentId the deploymentId value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withDeploymentId(String deploymentId) { + this.deploymentId = deploymentId; + return this; + } + + /** + * Get the deployedImages property: Images deployed. + * + * @return the deployedImages value. + */ + public List deployedImages() { + return this.deployedImages; + } + + /** + * Set the deployedImages property: Images deployed. + * + * @param deployedImages the deployedImages value to set. + * @return the DeploymentProperties object itself. + */ + public DeploymentProperties withDeployedImages(List deployedImages) { + this.deployedImages = deployedImages; + return this; + } + + /** + * Get the deploymentDateUtc property: Deployment date UTC. + * + * @return the deploymentDateUtc value. + */ + public OffsetDateTime deploymentDateUtc() { + return this.deploymentDateUtc; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (deployedImages() != null) { + deployedImages().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupInner.java new file mode 100644 index 000000000000..c09d49d6624e --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sphere.models.AllowCrashDumpCollection; +import com.azure.resourcemanager.sphere.models.OSFeedType; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; +import com.azure.resourcemanager.sphere.models.UpdatePolicy; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An device group resource belonging to a product resource. */ +@Fluent +public final class DeviceGroupInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private DeviceGroupProperties innerProperties; + + /** Creates an instance of DeviceGroupInner class. */ + public DeviceGroupInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private DeviceGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the description property: Description of the device group. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the device group. + * + * @param description the description value to set. + * @return the DeviceGroupInner object itself. + */ + public DeviceGroupInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new DeviceGroupProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the osFeedType property: Operating system feed type of the device group. + * + * @return the osFeedType value. + */ + public OSFeedType osFeedType() { + return this.innerProperties() == null ? null : this.innerProperties().osFeedType(); + } + + /** + * Set the osFeedType property: Operating system feed type of the device group. + * + * @param osFeedType the osFeedType value to set. + * @return the DeviceGroupInner object itself. + */ + public DeviceGroupInner withOsFeedType(OSFeedType osFeedType) { + if (this.innerProperties() == null) { + this.innerProperties = new DeviceGroupProperties(); + } + this.innerProperties().withOsFeedType(osFeedType); + return this; + } + + /** + * Get the updatePolicy property: Update policy of the device group. + * + * @return the updatePolicy value. + */ + public UpdatePolicy updatePolicy() { + return this.innerProperties() == null ? null : this.innerProperties().updatePolicy(); + } + + /** + * Set the updatePolicy property: Update policy of the device group. + * + * @param updatePolicy the updatePolicy value to set. + * @return the DeviceGroupInner object itself. + */ + public DeviceGroupInner withUpdatePolicy(UpdatePolicy updatePolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new DeviceGroupProperties(); + } + this.innerProperties().withUpdatePolicy(updatePolicy); + return this; + } + + /** + * Get the allowCrashDumpsCollection property: Flag to define if the user allows for crash dump collection. + * + * @return the allowCrashDumpsCollection value. + */ + public AllowCrashDumpCollection allowCrashDumpsCollection() { + return this.innerProperties() == null ? null : this.innerProperties().allowCrashDumpsCollection(); + } + + /** + * Set the allowCrashDumpsCollection property: Flag to define if the user allows for crash dump collection. + * + * @param allowCrashDumpsCollection the allowCrashDumpsCollection value to set. + * @return the DeviceGroupInner object itself. + */ + public DeviceGroupInner withAllowCrashDumpsCollection(AllowCrashDumpCollection allowCrashDumpsCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new DeviceGroupProperties(); + } + this.innerProperties().withAllowCrashDumpsCollection(allowCrashDumpsCollection); + return this; + } + + /** + * Get the regionalDataBoundary property: Regional data boundary for the device group. + * + * @return the regionalDataBoundary value. + */ + public RegionalDataBoundary regionalDataBoundary() { + return this.innerProperties() == null ? null : this.innerProperties().regionalDataBoundary(); + } + + /** + * Set the regionalDataBoundary property: Regional data boundary for the device group. + * + * @param regionalDataBoundary the regionalDataBoundary value to set. + * @return the DeviceGroupInner object itself. + */ + public DeviceGroupInner withRegionalDataBoundary(RegionalDataBoundary regionalDataBoundary) { + if (this.innerProperties() == null) { + this.innerProperties = new DeviceGroupProperties(); + } + this.innerProperties().withRegionalDataBoundary(regionalDataBoundary); + return this; + } + + /** + * Get the hasDeployment property: Deployment status for the device group. + * + * @return the hasDeployment value. + */ + public Boolean hasDeployment() { + return this.innerProperties() == null ? null : this.innerProperties().hasDeployment(); + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupProperties.java new file mode 100644 index 000000000000..dfab130e9fa8 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupProperties.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sphere.models.AllowCrashDumpCollection; +import com.azure.resourcemanager.sphere.models.OSFeedType; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; +import com.azure.resourcemanager.sphere.models.UpdatePolicy; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of deviceGroup. */ +@Fluent +public final class DeviceGroupProperties { + /* + * Description of the device group. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Operating system feed type of the device group. + */ + @JsonProperty(value = "osFeedType") + private OSFeedType osFeedType; + + /* + * Update policy of the device group. + */ + @JsonProperty(value = "updatePolicy") + private UpdatePolicy updatePolicy; + + /* + * Flag to define if the user allows for crash dump collection. + */ + @JsonProperty(value = "allowCrashDumpsCollection") + private AllowCrashDumpCollection allowCrashDumpsCollection; + + /* + * Regional data boundary for the device group. + */ + @JsonProperty(value = "regionalDataBoundary") + private RegionalDataBoundary regionalDataBoundary; + + /* + * Deployment status for the device group. + */ + @JsonProperty(value = "hasDeployment", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasDeployment; + + /* + * The status of the last operation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of DeviceGroupProperties class. */ + public DeviceGroupProperties() { + } + + /** + * Get the description property: Description of the device group. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the device group. + * + * @param description the description value to set. + * @return the DeviceGroupProperties object itself. + */ + public DeviceGroupProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the osFeedType property: Operating system feed type of the device group. + * + * @return the osFeedType value. + */ + public OSFeedType osFeedType() { + return this.osFeedType; + } + + /** + * Set the osFeedType property: Operating system feed type of the device group. + * + * @param osFeedType the osFeedType value to set. + * @return the DeviceGroupProperties object itself. + */ + public DeviceGroupProperties withOsFeedType(OSFeedType osFeedType) { + this.osFeedType = osFeedType; + return this; + } + + /** + * Get the updatePolicy property: Update policy of the device group. + * + * @return the updatePolicy value. + */ + public UpdatePolicy updatePolicy() { + return this.updatePolicy; + } + + /** + * Set the updatePolicy property: Update policy of the device group. + * + * @param updatePolicy the updatePolicy value to set. + * @return the DeviceGroupProperties object itself. + */ + public DeviceGroupProperties withUpdatePolicy(UpdatePolicy updatePolicy) { + this.updatePolicy = updatePolicy; + return this; + } + + /** + * Get the allowCrashDumpsCollection property: Flag to define if the user allows for crash dump collection. + * + * @return the allowCrashDumpsCollection value. + */ + public AllowCrashDumpCollection allowCrashDumpsCollection() { + return this.allowCrashDumpsCollection; + } + + /** + * Set the allowCrashDumpsCollection property: Flag to define if the user allows for crash dump collection. + * + * @param allowCrashDumpsCollection the allowCrashDumpsCollection value to set. + * @return the DeviceGroupProperties object itself. + */ + public DeviceGroupProperties withAllowCrashDumpsCollection(AllowCrashDumpCollection allowCrashDumpsCollection) { + this.allowCrashDumpsCollection = allowCrashDumpsCollection; + return this; + } + + /** + * Get the regionalDataBoundary property: Regional data boundary for the device group. + * + * @return the regionalDataBoundary value. + */ + public RegionalDataBoundary regionalDataBoundary() { + return this.regionalDataBoundary; + } + + /** + * Set the regionalDataBoundary property: Regional data boundary for the device group. + * + * @param regionalDataBoundary the regionalDataBoundary value to set. + * @return the DeviceGroupProperties object itself. + */ + public DeviceGroupProperties withRegionalDataBoundary(RegionalDataBoundary regionalDataBoundary) { + this.regionalDataBoundary = regionalDataBoundary; + return this; + } + + /** + * Get the hasDeployment property: Deployment status for the device group. + * + * @return the hasDeployment value. + */ + public Boolean hasDeployment() { + return this.hasDeployment; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupUpdateProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupUpdateProperties.java new file mode 100644 index 000000000000..055f245fd236 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceGroupUpdateProperties.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sphere.models.AllowCrashDumpCollection; +import com.azure.resourcemanager.sphere.models.OSFeedType; +import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; +import com.azure.resourcemanager.sphere.models.UpdatePolicy; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The updatable properties of the DeviceGroup. */ +@Fluent +public final class DeviceGroupUpdateProperties { + /* + * Description of the device group. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Operating system feed type of the device group. + */ + @JsonProperty(value = "osFeedType") + private OSFeedType osFeedType; + + /* + * Update policy of the device group. + */ + @JsonProperty(value = "updatePolicy") + private UpdatePolicy updatePolicy; + + /* + * Flag to define if the user allows for crash dump collection. + */ + @JsonProperty(value = "allowCrashDumpsCollection") + private AllowCrashDumpCollection allowCrashDumpsCollection; + + /* + * Regional data boundary for the device group. + */ + @JsonProperty(value = "regionalDataBoundary") + private RegionalDataBoundary regionalDataBoundary; + + /** Creates an instance of DeviceGroupUpdateProperties class. */ + public DeviceGroupUpdateProperties() { + } + + /** + * Get the description property: Description of the device group. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the device group. + * + * @param description the description value to set. + * @return the DeviceGroupUpdateProperties object itself. + */ + public DeviceGroupUpdateProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the osFeedType property: Operating system feed type of the device group. + * + * @return the osFeedType value. + */ + public OSFeedType osFeedType() { + return this.osFeedType; + } + + /** + * Set the osFeedType property: Operating system feed type of the device group. + * + * @param osFeedType the osFeedType value to set. + * @return the DeviceGroupUpdateProperties object itself. + */ + public DeviceGroupUpdateProperties withOsFeedType(OSFeedType osFeedType) { + this.osFeedType = osFeedType; + return this; + } + + /** + * Get the updatePolicy property: Update policy of the device group. + * + * @return the updatePolicy value. + */ + public UpdatePolicy updatePolicy() { + return this.updatePolicy; + } + + /** + * Set the updatePolicy property: Update policy of the device group. + * + * @param updatePolicy the updatePolicy value to set. + * @return the DeviceGroupUpdateProperties object itself. + */ + public DeviceGroupUpdateProperties withUpdatePolicy(UpdatePolicy updatePolicy) { + this.updatePolicy = updatePolicy; + return this; + } + + /** + * Get the allowCrashDumpsCollection property: Flag to define if the user allows for crash dump collection. + * + * @return the allowCrashDumpsCollection value. + */ + public AllowCrashDumpCollection allowCrashDumpsCollection() { + return this.allowCrashDumpsCollection; + } + + /** + * Set the allowCrashDumpsCollection property: Flag to define if the user allows for crash dump collection. + * + * @param allowCrashDumpsCollection the allowCrashDumpsCollection value to set. + * @return the DeviceGroupUpdateProperties object itself. + */ + public DeviceGroupUpdateProperties withAllowCrashDumpsCollection( + AllowCrashDumpCollection allowCrashDumpsCollection) { + this.allowCrashDumpsCollection = allowCrashDumpsCollection; + return this; + } + + /** + * Get the regionalDataBoundary property: Regional data boundary for the device group. + * + * @return the regionalDataBoundary value. + */ + public RegionalDataBoundary regionalDataBoundary() { + return this.regionalDataBoundary; + } + + /** + * Set the regionalDataBoundary property: Regional data boundary for the device group. + * + * @param regionalDataBoundary the regionalDataBoundary value to set. + * @return the DeviceGroupUpdateProperties object itself. + */ + public DeviceGroupUpdateProperties withRegionalDataBoundary(RegionalDataBoundary regionalDataBoundary) { + this.regionalDataBoundary = regionalDataBoundary; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInner.java new file mode 100644 index 000000000000..4d6a8dfe174b --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInner.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An device resource belonging to a device group resource. */ +@Fluent +public final class DeviceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private DeviceProperties innerProperties; + + /** Creates an instance of DeviceInner class. */ + public DeviceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private DeviceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the deviceId property: Device ID. + * + * @return the deviceId value. + */ + public String deviceId() { + return this.innerProperties() == null ? null : this.innerProperties().deviceId(); + } + + /** + * Set the deviceId property: Device ID. + * + * @param deviceId the deviceId value to set. + * @return the DeviceInner object itself. + */ + public DeviceInner withDeviceId(String deviceId) { + if (this.innerProperties() == null) { + this.innerProperties = new DeviceProperties(); + } + this.innerProperties().withDeviceId(deviceId); + return this; + } + + /** + * Get the chipSku property: SKU of the chip. + * + * @return the chipSku value. + */ + public String chipSku() { + return this.innerProperties() == null ? null : this.innerProperties().chipSku(); + } + + /** + * Get the lastAvailableOsVersion property: OS version available for installation when update requested. + * + * @return the lastAvailableOsVersion value. + */ + public String lastAvailableOsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().lastAvailableOsVersion(); + } + + /** + * Get the lastInstalledOsVersion property: OS version running on device when update requested. + * + * @return the lastInstalledOsVersion value. + */ + public String lastInstalledOsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().lastInstalledOsVersion(); + } + + /** + * Get the lastOsUpdateUtc property: Time when update requested and new OS version available. + * + * @return the lastOsUpdateUtc value. + */ + public OffsetDateTime lastOsUpdateUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastOsUpdateUtc(); + } + + /** + * Get the lastUpdateRequestUtc property: Time when update was last requested. + * + * @return the lastUpdateRequestUtc value. + */ + public OffsetDateTime lastUpdateRequestUtc() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdateRequestUtc(); + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInsightInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInsightInner.java new file mode 100644 index 000000000000..4290335b8721 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceInsightInner.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Device insight report. */ +@Fluent +public final class DeviceInsightInner { + /* + * Device ID + */ + @JsonProperty(value = "deviceId", required = true) + private String deviceId; + + /* + * Event description + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * Event start timestamp + */ + @JsonProperty(value = "startTimestampUtc", required = true) + private OffsetDateTime startTimestampUtc; + + /* + * Event end timestamp + */ + @JsonProperty(value = "endTimestampUtc", required = true) + private OffsetDateTime endTimestampUtc; + + /* + * Event category + */ + @JsonProperty(value = "eventCategory", required = true) + private String eventCategory; + + /* + * Event class + */ + @JsonProperty(value = "eventClass", required = true) + private String eventClass; + + /* + * Event type + */ + @JsonProperty(value = "eventType", required = true) + private String eventType; + + /* + * Event count + */ + @JsonProperty(value = "eventCount", required = true) + private int eventCount; + + /** Creates an instance of DeviceInsightInner class. */ + public DeviceInsightInner() { + } + + /** + * Get the deviceId property: Device ID. + * + * @return the deviceId value. + */ + public String deviceId() { + return this.deviceId; + } + + /** + * Set the deviceId property: Device ID. + * + * @param deviceId the deviceId value to set. + * @return the DeviceInsightInner object itself. + */ + public DeviceInsightInner withDeviceId(String deviceId) { + this.deviceId = deviceId; + return this; + } + + /** + * Get the description property: Event description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Event description. + * + * @param description the description value to set. + * @return the DeviceInsightInner object itself. + */ + public DeviceInsightInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the startTimestampUtc property: Event start timestamp. + * + * @return the startTimestampUtc value. + */ + public OffsetDateTime startTimestampUtc() { + return this.startTimestampUtc; + } + + /** + * Set the startTimestampUtc property: Event start timestamp. + * + * @param startTimestampUtc the startTimestampUtc value to set. + * @return the DeviceInsightInner object itself. + */ + public DeviceInsightInner withStartTimestampUtc(OffsetDateTime startTimestampUtc) { + this.startTimestampUtc = startTimestampUtc; + return this; + } + + /** + * Get the endTimestampUtc property: Event end timestamp. + * + * @return the endTimestampUtc value. + */ + public OffsetDateTime endTimestampUtc() { + return this.endTimestampUtc; + } + + /** + * Set the endTimestampUtc property: Event end timestamp. + * + * @param endTimestampUtc the endTimestampUtc value to set. + * @return the DeviceInsightInner object itself. + */ + public DeviceInsightInner withEndTimestampUtc(OffsetDateTime endTimestampUtc) { + this.endTimestampUtc = endTimestampUtc; + return this; + } + + /** + * Get the eventCategory property: Event category. + * + * @return the eventCategory value. + */ + public String eventCategory() { + return this.eventCategory; + } + + /** + * Set the eventCategory property: Event category. + * + * @param eventCategory the eventCategory value to set. + * @return the DeviceInsightInner object itself. + */ + public DeviceInsightInner withEventCategory(String eventCategory) { + this.eventCategory = eventCategory; + return this; + } + + /** + * Get the eventClass property: Event class. + * + * @return the eventClass value. + */ + public String eventClass() { + return this.eventClass; + } + + /** + * Set the eventClass property: Event class. + * + * @param eventClass the eventClass value to set. + * @return the DeviceInsightInner object itself. + */ + public DeviceInsightInner withEventClass(String eventClass) { + this.eventClass = eventClass; + return this; + } + + /** + * Get the eventType property: Event type. + * + * @return the eventType value. + */ + public String eventType() { + return this.eventType; + } + + /** + * Set the eventType property: Event type. + * + * @param eventType the eventType value to set. + * @return the DeviceInsightInner object itself. + */ + public DeviceInsightInner withEventType(String eventType) { + this.eventType = eventType; + return this; + } + + /** + * Get the eventCount property: Event count. + * + * @return the eventCount value. + */ + public int eventCount() { + return this.eventCount; + } + + /** + * Set the eventCount property: Event count. + * + * @param eventCount the eventCount value to set. + * @return the DeviceInsightInner object itself. + */ + public DeviceInsightInner withEventCount(int eventCount) { + this.eventCount = eventCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (deviceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property deviceId in model DeviceInsightInner")); + } + if (description() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property description in model DeviceInsightInner")); + } + if (startTimestampUtc() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property startTimestampUtc in model DeviceInsightInner")); + } + if (endTimestampUtc() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property endTimestampUtc in model DeviceInsightInner")); + } + if (eventCategory() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property eventCategory in model DeviceInsightInner")); + } + if (eventClass() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property eventClass in model DeviceInsightInner")); + } + if (eventType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property eventType in model DeviceInsightInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DeviceInsightInner.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceProperties.java new file mode 100644 index 000000000000..007b9a67c80d --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceProperties.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of device. */ +@Fluent +public final class DeviceProperties { + /* + * Device ID + */ + @JsonProperty(value = "deviceId") + private String deviceId; + + /* + * SKU of the chip + */ + @JsonProperty(value = "chipSku", access = JsonProperty.Access.WRITE_ONLY) + private String chipSku; + + /* + * OS version available for installation when update requested + */ + @JsonProperty(value = "lastAvailableOsVersion", access = JsonProperty.Access.WRITE_ONLY) + private String lastAvailableOsVersion; + + /* + * OS version running on device when update requested + */ + @JsonProperty(value = "lastInstalledOsVersion", access = JsonProperty.Access.WRITE_ONLY) + private String lastInstalledOsVersion; + + /* + * Time when update requested and new OS version available + */ + @JsonProperty(value = "lastOsUpdateUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastOsUpdateUtc; + + /* + * Time when update was last requested + */ + @JsonProperty(value = "lastUpdateRequestUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdateRequestUtc; + + /* + * The status of the last operation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of DeviceProperties class. */ + public DeviceProperties() { + } + + /** + * Get the deviceId property: Device ID. + * + * @return the deviceId value. + */ + public String deviceId() { + return this.deviceId; + } + + /** + * Set the deviceId property: Device ID. + * + * @param deviceId the deviceId value to set. + * @return the DeviceProperties object itself. + */ + public DeviceProperties withDeviceId(String deviceId) { + this.deviceId = deviceId; + return this; + } + + /** + * Get the chipSku property: SKU of the chip. + * + * @return the chipSku value. + */ + public String chipSku() { + return this.chipSku; + } + + /** + * Get the lastAvailableOsVersion property: OS version available for installation when update requested. + * + * @return the lastAvailableOsVersion value. + */ + public String lastAvailableOsVersion() { + return this.lastAvailableOsVersion; + } + + /** + * Get the lastInstalledOsVersion property: OS version running on device when update requested. + * + * @return the lastInstalledOsVersion value. + */ + public String lastInstalledOsVersion() { + return this.lastInstalledOsVersion; + } + + /** + * Get the lastOsUpdateUtc property: Time when update requested and new OS version available. + * + * @return the lastOsUpdateUtc value. + */ + public OffsetDateTime lastOsUpdateUtc() { + return this.lastOsUpdateUtc; + } + + /** + * Get the lastUpdateRequestUtc property: Time when update was last requested. + * + * @return the lastUpdateRequestUtc value. + */ + public OffsetDateTime lastUpdateRequestUtc() { + return this.lastUpdateRequestUtc; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceUpdateProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceUpdateProperties.java new file mode 100644 index 000000000000..d89b5654acf6 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/DeviceUpdateProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The updatable properties of the Device. */ +@Fluent +public final class DeviceUpdateProperties { + /* + * Device group id + */ + @JsonProperty(value = "deviceGroupId") + private String deviceGroupId; + + /** Creates an instance of DeviceUpdateProperties class. */ + public DeviceUpdateProperties() { + } + + /** + * Get the deviceGroupId property: Device group id. + * + * @return the deviceGroupId value. + */ + public String deviceGroupId() { + return this.deviceGroupId; + } + + /** + * Set the deviceGroupId property: Device group id. + * + * @param deviceGroupId the deviceGroupId value to set. + * @return the DeviceUpdateProperties object itself. + */ + public DeviceUpdateProperties withDeviceGroupId(String deviceGroupId) { + this.deviceGroupId = deviceGroupId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ImageInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ImageInner.java new file mode 100644 index 000000000000..7f5a89784b1f --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ImageInner.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sphere.models.ImageType; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An image resource belonging to a catalog resource. */ +@Fluent +public final class ImageInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private ImageProperties innerProperties; + + /** Creates an instance of ImageInner class. */ + public ImageInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private ImageProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the image property: Image as a UTF-8 encoded base 64 string on image create. This field contains the image + * URI on image reads. + * + * @return the image value. + */ + public String image() { + return this.innerProperties() == null ? null : this.innerProperties().image(); + } + + /** + * Set the image property: Image as a UTF-8 encoded base 64 string on image create. This field contains the image + * URI on image reads. + * + * @param image the image value to set. + * @return the ImageInner object itself. + */ + public ImageInner withImage(String image) { + if (this.innerProperties() == null) { + this.innerProperties = new ImageProperties(); + } + this.innerProperties().withImage(image); + return this; + } + + /** + * Get the imageId property: Image ID. + * + * @return the imageId value. + */ + public String imageId() { + return this.innerProperties() == null ? null : this.innerProperties().imageId(); + } + + /** + * Set the imageId property: Image ID. + * + * @param imageId the imageId value to set. + * @return the ImageInner object itself. + */ + public ImageInner withImageId(String imageId) { + if (this.innerProperties() == null) { + this.innerProperties = new ImageProperties(); + } + this.innerProperties().withImageId(imageId); + return this; + } + + /** + * Get the imageName property: Image name. + * + * @return the imageName value. + */ + public String imageName() { + return this.innerProperties() == null ? null : this.innerProperties().imageName(); + } + + /** + * Get the regionalDataBoundary property: Regional data boundary for an image. + * + * @return the regionalDataBoundary value. + */ + public RegionalDataBoundary regionalDataBoundary() { + return this.innerProperties() == null ? null : this.innerProperties().regionalDataBoundary(); + } + + /** + * Set the regionalDataBoundary property: Regional data boundary for an image. + * + * @param regionalDataBoundary the regionalDataBoundary value to set. + * @return the ImageInner object itself. + */ + public ImageInner withRegionalDataBoundary(RegionalDataBoundary regionalDataBoundary) { + if (this.innerProperties() == null) { + this.innerProperties = new ImageProperties(); + } + this.innerProperties().withRegionalDataBoundary(regionalDataBoundary); + return this; + } + + /** + * Get the uri property: Location the image. + * + * @return the uri value. + */ + public String uri() { + return this.innerProperties() == null ? null : this.innerProperties().uri(); + } + + /** + * Get the description property: The image description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the componentId property: The image component id. + * + * @return the componentId value. + */ + public String componentId() { + return this.innerProperties() == null ? null : this.innerProperties().componentId(); + } + + /** + * Get the imageType property: The image type. + * + * @return the imageType value. + */ + public ImageType imageType() { + return this.innerProperties() == null ? null : this.innerProperties().imageType(); + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ImageProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ImageProperties.java new file mode 100644 index 000000000000..26464c8d0a60 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ImageProperties.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sphere.models.ImageType; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of image. */ +@Fluent +public final class ImageProperties { + /* + * Image as a UTF-8 encoded base 64 string on image create. This field contains the image URI on image reads. + */ + @JsonProperty(value = "image") + private String image; + + /* + * Image ID + */ + @JsonProperty(value = "imageId") + private String imageId; + + /* + * Image name + */ + @JsonProperty(value = "imageName", access = JsonProperty.Access.WRITE_ONLY) + private String imageName; + + /* + * Regional data boundary for an image + */ + @JsonProperty(value = "regionalDataBoundary") + private RegionalDataBoundary regionalDataBoundary; + + /* + * Location the image + */ + @JsonProperty(value = "uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /* + * The image description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The image component id. + */ + @JsonProperty(value = "componentId", access = JsonProperty.Access.WRITE_ONLY) + private String componentId; + + /* + * The image type. + */ + @JsonProperty(value = "imageType", access = JsonProperty.Access.WRITE_ONLY) + private ImageType imageType; + + /* + * The status of the last operation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of ImageProperties class. */ + public ImageProperties() { + } + + /** + * Get the image property: Image as a UTF-8 encoded base 64 string on image create. This field contains the image + * URI on image reads. + * + * @return the image value. + */ + public String image() { + return this.image; + } + + /** + * Set the image property: Image as a UTF-8 encoded base 64 string on image create. This field contains the image + * URI on image reads. + * + * @param image the image value to set. + * @return the ImageProperties object itself. + */ + public ImageProperties withImage(String image) { + this.image = image; + return this; + } + + /** + * Get the imageId property: Image ID. + * + * @return the imageId value. + */ + public String imageId() { + return this.imageId; + } + + /** + * Set the imageId property: Image ID. + * + * @param imageId the imageId value to set. + * @return the ImageProperties object itself. + */ + public ImageProperties withImageId(String imageId) { + this.imageId = imageId; + return this; + } + + /** + * Get the imageName property: Image name. + * + * @return the imageName value. + */ + public String imageName() { + return this.imageName; + } + + /** + * Get the regionalDataBoundary property: Regional data boundary for an image. + * + * @return the regionalDataBoundary value. + */ + public RegionalDataBoundary regionalDataBoundary() { + return this.regionalDataBoundary; + } + + /** + * Set the regionalDataBoundary property: Regional data boundary for an image. + * + * @param regionalDataBoundary the regionalDataBoundary value to set. + * @return the ImageProperties object itself. + */ + public ImageProperties withRegionalDataBoundary(RegionalDataBoundary regionalDataBoundary) { + this.regionalDataBoundary = regionalDataBoundary; + return this; + } + + /** + * Get the uri property: Location the image. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Get the description property: The image description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the componentId property: The image component id. + * + * @return the componentId value. + */ + public String componentId() { + return this.componentId; + } + + /** + * Get the imageType property: The image type. + * + * @return the imageType value. + */ + public ImageType imageType() { + return this.imageType; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/OperationInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/OperationInner.java new file mode 100644 index 000000000000..239055d7f070 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/OperationInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sphere.models.ActionType; +import com.azure.resourcemanager.sphere.models.OperationDisplay; +import com.azure.resourcemanager.sphere.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + *

Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** Creates an instance of OperationInner class. */ + public 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 ARM/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; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * 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: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductInner.java new file mode 100644 index 000000000000..c5a3f9cc1d70 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductInner.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An product resource belonging to a catalog resource. */ +@Fluent +public final class ProductInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private ProductProperties innerProperties; + + /** Creates an instance of ProductInner class. */ + public ProductInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private ProductProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the description property: Description of the product. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the product. + * + * @param description the description value to set. + * @return the ProductInner object itself. + */ + public ProductInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductProperties.java new file mode 100644 index 000000000000..c9e8cd2176f7 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductProperties.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of product. */ +@Fluent +public final class ProductProperties { + /* + * Description of the product + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * The status of the last operation. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of ProductProperties class. */ + public ProductProperties() { + } + + /** + * Get the description property: Description of the product. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the product. + * + * @param description the description value to set. + * @return the ProductProperties object itself. + */ + public ProductProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (description() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property description in model ProductProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ProductProperties.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductUpdateProperties.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductUpdateProperties.java new file mode 100644 index 000000000000..77e75f019861 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProductUpdateProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The updatable properties of the Product. */ +@Fluent +public final class ProductUpdateProperties { + /* + * Description of the product + */ + @JsonProperty(value = "description") + private String description; + + /** Creates an instance of ProductUpdateProperties class. */ + public ProductUpdateProperties() { + } + + /** + * Get the description property: Description of the product. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the product. + * + * @param description the description value to set. + * @return the ProductUpdateProperties object itself. + */ + public ProductUpdateProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProofOfPossessionNonceResponseInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProofOfPossessionNonceResponseInner.java new file mode 100644 index 000000000000..ee5f94ce18c2 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/ProofOfPossessionNonceResponseInner.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Immutable; + +/** Result of the action to generate a proof of possession nonce. */ +@Immutable +public final class ProofOfPossessionNonceResponseInner extends CertificateProperties { + /** Creates an instance of ProofOfPossessionNonceResponseInner class. */ + public ProofOfPossessionNonceResponseInner() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/SignedCapabilityImageResponseInner.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/SignedCapabilityImageResponseInner.java new file mode 100644 index 000000000000..1822b0e45722 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/SignedCapabilityImageResponseInner.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Signed device capability image response. */ +@Immutable +public final class SignedCapabilityImageResponseInner { + /* + * The signed device capability image as a UTF-8 encoded base 64 string. + */ + @JsonProperty(value = "image", access = JsonProperty.Access.WRITE_ONLY) + private String image; + + /** Creates an instance of SignedCapabilityImageResponseInner class. */ + public SignedCapabilityImageResponseInner() { + } + + /** + * Get the image property: The signed device capability image as a UTF-8 encoded base 64 string. + * + * @return the image value. + */ + public String image() { + return this.image; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/package-info.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/package-info.java new file mode 100644 index 000000000000..6c295b60279c --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for AzureSphereManagementClient. Azure Sphere resource management API. */ +package com.azure.resourcemanager.sphere.fluent.models; diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/package-info.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/package-info.java new file mode 100644 index 000000000000..9853cc0ca23a --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for AzureSphereManagementClient. Azure Sphere resource management API. */ +package com.azure.resourcemanager.sphere.fluent; diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/AzureSphereManagementClientBuilder.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/AzureSphereManagementClientBuilder.java new file mode 100644 index 000000000000..6f5c108a3bba --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/AzureSphereManagementClientBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.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 AzureSphereManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {AzureSphereManagementClientImpl.class}) +public final class AzureSphereManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the AzureSphereManagementClientBuilder. + */ + public AzureSphereManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AzureSphereManagementClientBuilder. + */ + public AzureSphereManagementClientBuilder 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 AzureSphereManagementClientBuilder. + */ + public AzureSphereManagementClientBuilder 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 AzureSphereManagementClientBuilder. + */ + public AzureSphereManagementClientBuilder 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 AzureSphereManagementClientBuilder. + */ + public AzureSphereManagementClientBuilder 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 AzureSphereManagementClientBuilder. + */ + public AzureSphereManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AzureSphereManagementClientImpl with the provided parameters. + * + * @return an instance of AzureSphereManagementClientImpl. + */ + public AzureSphereManagementClientImpl 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(); + AzureSphereManagementClientImpl client = + new AzureSphereManagementClientImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/AzureSphereManagementClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/AzureSphereManagementClientImpl.java new file mode 100644 index 000000000000..251919142566 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/AzureSphereManagementClientImpl.java @@ -0,0 +1,388 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.annotation.ServiceClient; +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.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.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.sphere.fluent.AzureSphereManagementClient; +import com.azure.resourcemanager.sphere.fluent.CatalogsClient; +import com.azure.resourcemanager.sphere.fluent.CertificatesClient; +import com.azure.resourcemanager.sphere.fluent.DeploymentsClient; +import com.azure.resourcemanager.sphere.fluent.DeviceGroupsClient; +import com.azure.resourcemanager.sphere.fluent.DevicesClient; +import com.azure.resourcemanager.sphere.fluent.ImagesClient; +import com.azure.resourcemanager.sphere.fluent.OperationsClient; +import com.azure.resourcemanager.sphere.fluent.ProductsClient; +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 AzureSphereManagementClientImpl type. */ +@ServiceClient(builder = AzureSphereManagementClientBuilder.class) +public final class AzureSphereManagementClientImpl implements AzureSphereManagementClient { + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + 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 CatalogsClient object to access its operations. */ + private final CatalogsClient catalogs; + + /** + * Gets the CatalogsClient object to access its operations. + * + * @return the CatalogsClient object. + */ + public CatalogsClient getCatalogs() { + return this.catalogs; + } + + /** The CertificatesClient object to access its operations. */ + private final CertificatesClient certificates; + + /** + * Gets the CertificatesClient object to access its operations. + * + * @return the CertificatesClient object. + */ + public CertificatesClient getCertificates() { + return this.certificates; + } + + /** The ImagesClient object to access its operations. */ + private final ImagesClient images; + + /** + * Gets the ImagesClient object to access its operations. + * + * @return the ImagesClient object. + */ + public ImagesClient getImages() { + return this.images; + } + + /** The ProductsClient object to access its operations. */ + private final ProductsClient products; + + /** + * Gets the ProductsClient object to access its operations. + * + * @return the ProductsClient object. + */ + public ProductsClient getProducts() { + return this.products; + } + + /** The DeviceGroupsClient object to access its operations. */ + private final DeviceGroupsClient deviceGroups; + + /** + * Gets the DeviceGroupsClient object to access its operations. + * + * @return the DeviceGroupsClient object. + */ + public DeviceGroupsClient getDeviceGroups() { + return this.deviceGroups; + } + + /** The DeploymentsClient object to access its operations. */ + private final DeploymentsClient deployments; + + /** + * Gets the DeploymentsClient object to access its operations. + * + * @return the DeploymentsClient object. + */ + public DeploymentsClient getDeployments() { + return this.deployments; + } + + /** The DevicesClient object to access its operations. */ + private final DevicesClient devices; + + /** + * Gets the DevicesClient object to access its operations. + * + * @return the DevicesClient object. + */ + public DevicesClient getDevices() { + return this.devices; + } + + /** + * Initializes an instance of AzureSphereManagementClient 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 subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + AzureSphereManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2022-09-01-preview"; + this.operations = new OperationsClientImpl(this); + this.catalogs = new CatalogsClientImpl(this); + this.certificates = new CertificatesClientImpl(this); + this.images = new ImagesClientImpl(this); + this.products = new ProductsClientImpl(this); + this.deviceGroups = new DeviceGroupsClientImpl(this); + this.deployments = new DeploymentsClientImpl(this); + this.devices = new DevicesClientImpl(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 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(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(AzureSphereManagementClientImpl.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogImpl.java new file mode 100644 index 000000000000..e36df7131263 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogImpl.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.CatalogInner; +import com.azure.resourcemanager.sphere.models.Catalog; +import com.azure.resourcemanager.sphere.models.CatalogUpdate; +import com.azure.resourcemanager.sphere.models.CountDeviceResponse; +import com.azure.resourcemanager.sphere.models.Deployment; +import com.azure.resourcemanager.sphere.models.Device; +import com.azure.resourcemanager.sphere.models.DeviceGroup; +import com.azure.resourcemanager.sphere.models.DeviceInsight; +import com.azure.resourcemanager.sphere.models.ListDeviceGroupsRequest; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import java.util.Collections; +import java.util.Map; + +public final class CatalogImpl implements Catalog, Catalog.Definition, Catalog.Update { + private CatalogInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public CatalogInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String catalogName; + + private CatalogUpdate updateProperties; + + public CatalogImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Catalog create() { + this.innerObject = + serviceManager + .serviceClient() + .getCatalogs() + .createOrUpdate(resourceGroupName, catalogName, this.innerModel(), Context.NONE); + return this; + } + + public Catalog create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCatalogs() + .createOrUpdate(resourceGroupName, catalogName, this.innerModel(), context); + return this; + } + + CatalogImpl(String name, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = new CatalogInner(); + this.serviceManager = serviceManager; + this.catalogName = name; + } + + public CatalogImpl update() { + this.updateProperties = new CatalogUpdate(); + return this; + } + + public Catalog apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCatalogs() + .updateWithResponse(resourceGroupName, catalogName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public Catalog apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCatalogs() + .updateWithResponse(resourceGroupName, catalogName, updateProperties, context) + .getValue(); + return this; + } + + CatalogImpl(CatalogInner innerObject, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.catalogName = Utils.getValueFromIdByName(innerObject.id(), "catalogs"); + } + + public Catalog refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCatalogs() + .getByResourceGroupWithResponse(resourceGroupName, catalogName, Context.NONE) + .getValue(); + return this; + } + + public Catalog refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCatalogs() + .getByResourceGroupWithResponse(resourceGroupName, catalogName, context) + .getValue(); + return this; + } + + public Response countDevicesWithResponse(Context context) { + return serviceManager.catalogs().countDevicesWithResponse(resourceGroupName, catalogName, context); + } + + public CountDeviceResponse countDevices() { + return serviceManager.catalogs().countDevices(resourceGroupName, catalogName); + } + + public PagedIterable listDeployments() { + return serviceManager.catalogs().listDeployments(resourceGroupName, catalogName); + } + + public PagedIterable listDeployments( + String filter, Integer top, Integer skip, Integer maxpagesize, Context context) { + return serviceManager + .catalogs() + .listDeployments(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context); + } + + public PagedIterable listDeviceGroups(ListDeviceGroupsRequest listDeviceGroupsRequest) { + return serviceManager.catalogs().listDeviceGroups(resourceGroupName, catalogName, listDeviceGroupsRequest); + } + + public PagedIterable listDeviceGroups( + ListDeviceGroupsRequest listDeviceGroupsRequest, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return serviceManager + .catalogs() + .listDeviceGroups( + resourceGroupName, catalogName, listDeviceGroupsRequest, filter, top, skip, maxpagesize, context); + } + + public PagedIterable listDeviceInsights() { + return serviceManager.catalogs().listDeviceInsights(resourceGroupName, catalogName); + } + + public PagedIterable listDeviceInsights( + String filter, Integer top, Integer skip, Integer maxpagesize, Context context) { + return serviceManager + .catalogs() + .listDeviceInsights(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context); + } + + public PagedIterable listDevices() { + return serviceManager.catalogs().listDevices(resourceGroupName, catalogName); + } + + public PagedIterable listDevices( + String filter, Integer top, Integer skip, Integer maxpagesize, Context context) { + return serviceManager + .catalogs() + .listDevices(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context); + } + + public CatalogImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CatalogImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CatalogImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogsClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogsClientImpl.java new file mode 100644 index 000000000000..aab63c3693db --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogsClientImpl.java @@ -0,0 +1,3079 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.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.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +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.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.management.polling.PollResult; +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.sphere.fluent.CatalogsClient; +import com.azure.resourcemanager.sphere.fluent.models.CatalogInner; +import com.azure.resourcemanager.sphere.fluent.models.CountDeviceResponseInner; +import com.azure.resourcemanager.sphere.fluent.models.DeploymentInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceInsightInner; +import com.azure.resourcemanager.sphere.models.CatalogListResult; +import com.azure.resourcemanager.sphere.models.CatalogUpdate; +import com.azure.resourcemanager.sphere.models.DeploymentListResult; +import com.azure.resourcemanager.sphere.models.DeviceGroupListResult; +import com.azure.resourcemanager.sphere.models.DeviceListResult; +import com.azure.resourcemanager.sphere.models.ListDeviceGroupsRequest; +import com.azure.resourcemanager.sphere.models.PagedDeviceInsight; +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 CatalogsClient. */ +public final class CatalogsClientImpl implements CatalogsClient { + /** The proxy service used to perform REST calls. */ + private final CatalogsService service; + + /** The service client containing this operation class. */ + private final AzureSphereManagementClientImpl client; + + /** + * Initializes an instance of CatalogsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CatalogsClientImpl(AzureSphereManagementClientImpl client) { + this.service = RestProxy.create(CatalogsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureSphereManagementClientCatalogs to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureSphereManagemen") + public interface CatalogsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureSphere/catalogs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @BodyParam("application/json") CatalogInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @BodyParam("application/json") CatalogUpdate properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/countDevices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> countDevices( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeployments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeployments( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, + @QueryParam("$maxpagesize") Integer maxpagesize, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeviceGroups( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, + @QueryParam("$maxpagesize") Integer maxpagesize, + @BodyParam("application/json") ListDeviceGroupsRequest listDeviceGroupsRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceInsights") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeviceInsights( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, + @QueryParam("$maxpagesize") Integer maxpagesize, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDevices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDevices( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, + @QueryParam("$maxpagesize") Integer maxpagesize, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeploymentsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeviceGroupsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDeviceInsightsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDevicesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List Catalog resources by subscription ID. + * + * @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 of a Catalog list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + 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 Catalog resources by subscription ID. + * + * @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 of a Catalog list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Catalog resources by subscription ID. + * + * @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 of a Catalog list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Catalog resources by subscription ID. + * + * @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 of a Catalog list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List Catalog resources by subscription ID. + * + * @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 of a Catalog list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List Catalog resources by subscription ID. + * + * @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 of a Catalog list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List Catalog resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Catalog list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + 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 Catalog resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Catalog list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Catalog resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Catalog list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Catalog resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Catalog list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List Catalog resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Catalog list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List Catalog resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Catalog list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 Catalog along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String catalogName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 Catalog along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String catalogName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + accept, + context); + } + + /** + * Get a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 Catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String catalogName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, catalogName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 Catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String catalogName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, catalogName, context).block(); + } + + /** + * Get a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 Catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CatalogInner getByResourceGroup(String resourceGroupName, String catalogName) { + return getByResourceGroupWithResponse(resourceGroupName, catalogName, Context.NONE).getValue(); + } + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String catalogName, CatalogInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String catalogName, CatalogInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + resource, + accept, + context); + } + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CatalogInner> beginCreateOrUpdateAsync( + String resourceGroupName, String catalogName, CatalogInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, catalogName, resource); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CatalogInner.class, CatalogInner.class, this.client.getContext()); + } + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 PollerFlux} for polling of an Azure Sphere catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CatalogInner> beginCreateOrUpdateAsync( + String resourceGroupName, String catalogName, CatalogInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, catalogName, resource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CatalogInner.class, CatalogInner.class, context); + } + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CatalogInner> beginCreateOrUpdate( + String resourceGroupName, String catalogName, CatalogInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, catalogName, resource).getSyncPoller(); + } + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CatalogInner> beginCreateOrUpdate( + String resourceGroupName, String catalogName, CatalogInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, catalogName, resource, context).getSyncPoller(); + } + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String catalogName, CatalogInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, catalogName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String catalogName, CatalogInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, catalogName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CatalogInner createOrUpdate(String resourceGroupName, String catalogName, CatalogInner resource) { + return createOrUpdateAsync(resourceGroupName, catalogName, resource).block(); + } + + /** + * Create a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 an Azure Sphere catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CatalogInner createOrUpdate( + String resourceGroupName, String catalogName, CatalogInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, catalogName, resource, context).block(); + } + + /** + * Update a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Sphere catalog along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String catalogName, CatalogUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param properties The resource properties to be updated. + * @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 an Azure Sphere catalog along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String catalogName, CatalogUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + properties, + accept, + context); + } + + /** + * Update a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Sphere catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String catalogName, CatalogUpdate properties) { + return updateWithResponseAsync(resourceGroupName, catalogName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param properties The resource properties to be updated. + * @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 an Azure Sphere catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String catalogName, CatalogUpdate properties, Context context) { + return updateWithResponseAsync(resourceGroupName, catalogName, properties, context).block(); + } + + /** + * Update a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Sphere catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CatalogInner update(String resourceGroupName, String catalogName, CatalogUpdate properties) { + return updateWithResponse(resourceGroupName, catalogName, properties, Context.NONE).getValue(); + } + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String catalogName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + accept, + context); + } + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, catalogName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String catalogName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, catalogName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName) { + return this.beginDeleteAsync(resourceGroupName, catalogName).getSyncPoller(); + } + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName, Context context) { + return this.beginDeleteAsync(resourceGroupName, catalogName, context).getSyncPoller(); + } + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName) { + return beginDeleteAsync(resourceGroupName, catalogName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String catalogName, Context context) { + return beginDeleteAsync(resourceGroupName, catalogName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName) { + deleteAsync(resourceGroupName, catalogName).block(); + } + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName, Context context) { + deleteAsync(resourceGroupName, catalogName, context).block(); + } + + /** + * Counts devices in catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response to the action call for count devices in a catalog along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> countDevicesWithResponseAsync( + String resourceGroupName, String catalogName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .countDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Counts devices in catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response to the action call for count devices in a catalog along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> countDevicesWithResponseAsync( + String resourceGroupName, String catalogName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .countDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + accept, + context); + } + + /** + * Counts devices in catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response to the action call for count devices in a catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono countDevicesAsync(String resourceGroupName, String catalogName) { + return countDevicesWithResponseAsync(resourceGroupName, catalogName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Counts devices in catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response to the action call for count devices in a catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response countDevicesWithResponse( + String resourceGroupName, String catalogName, Context context) { + return countDevicesWithResponseAsync(resourceGroupName, catalogName, context).block(); + } + + /** + * Counts devices in catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response to the action call for count devices in a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CountDeviceResponseInner countDevices(String resourceGroupName, String catalogName) { + return countDevicesWithResponse(resourceGroupName, catalogName, Context.NONE).getValue(); + } + + /** + * Lists deployments for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Deployment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsSinglePageAsync( + String resourceGroupName, String catalogName, String filter, Integer top, Integer skip, Integer maxpagesize) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listDeployments( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + filter, + top, + skip, + maxpagesize, + 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())); + } + + /** + * Lists deployments for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Deployment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsSinglePageAsync( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeployments( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + filter, + top, + skip, + maxpagesize, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists deployments for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Deployment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAsync( + String resourceGroupName, String catalogName, String filter, Integer top, Integer skip, Integer maxpagesize) { + return new PagedFlux<>( + () -> listDeploymentsSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize), + nextLink -> listDeploymentsNextSinglePageAsync(nextLink)); + } + + /** + * Lists deployments for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Deployment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAsync(String resourceGroupName, String catalogName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedFlux<>( + () -> listDeploymentsSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize), + nextLink -> listDeploymentsNextSinglePageAsync(nextLink)); + } + + /** + * Lists deployments for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Deployment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeploymentsAsync( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedFlux<>( + () -> + listDeploymentsSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context), + nextLink -> listDeploymentsNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists deployments for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeployments(String resourceGroupName, String catalogName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedIterable<>( + listDeploymentsAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize)); + } + + /** + * Lists deployments for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeployments( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedIterable<>( + listDeploymentsAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context)); + } + + /** + * List the device groups for the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param listDeviceGroupsRequest List device groups for catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a DeviceGroup list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeviceGroupsSinglePageAsync( + String resourceGroupName, + String catalogName, + ListDeviceGroupsRequest listDeviceGroupsRequest, + String filter, + Integer top, + Integer skip, + Integer maxpagesize) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (listDeviceGroupsRequest == null) { + return Mono + .error( + new IllegalArgumentException("Parameter listDeviceGroupsRequest is required and cannot be null.")); + } else { + listDeviceGroupsRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listDeviceGroups( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + filter, + top, + skip, + maxpagesize, + listDeviceGroupsRequest, + 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 device groups for the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param listDeviceGroupsRequest List device groups for catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a DeviceGroup list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeviceGroupsSinglePageAsync( + String resourceGroupName, + String catalogName, + ListDeviceGroupsRequest listDeviceGroupsRequest, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (listDeviceGroupsRequest == null) { + return Mono + .error( + new IllegalArgumentException("Parameter listDeviceGroupsRequest is required and cannot be null.")); + } else { + listDeviceGroupsRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeviceGroups( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + filter, + top, + skip, + maxpagesize, + listDeviceGroupsRequest, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the device groups for the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param listDeviceGroupsRequest List device groups for catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeviceGroupsAsync( + String resourceGroupName, + String catalogName, + ListDeviceGroupsRequest listDeviceGroupsRequest, + String filter, + Integer top, + Integer skip, + Integer maxpagesize) { + return new PagedFlux<>( + () -> + listDeviceGroupsSinglePageAsync( + resourceGroupName, catalogName, listDeviceGroupsRequest, filter, top, skip, maxpagesize), + nextLink -> listDeviceGroupsNextSinglePageAsync(nextLink)); + } + + /** + * List the device groups for the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param listDeviceGroupsRequest List device groups for catalog. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeviceGroupsAsync( + String resourceGroupName, String catalogName, ListDeviceGroupsRequest listDeviceGroupsRequest) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedFlux<>( + () -> + listDeviceGroupsSinglePageAsync( + resourceGroupName, catalogName, listDeviceGroupsRequest, filter, top, skip, maxpagesize), + nextLink -> listDeviceGroupsNextSinglePageAsync(nextLink)); + } + + /** + * List the device groups for the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param listDeviceGroupsRequest List device groups for catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeviceGroupsAsync( + String resourceGroupName, + String catalogName, + ListDeviceGroupsRequest listDeviceGroupsRequest, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedFlux<>( + () -> + listDeviceGroupsSinglePageAsync( + resourceGroupName, catalogName, listDeviceGroupsRequest, filter, top, skip, maxpagesize, context), + nextLink -> listDeviceGroupsNextSinglePageAsync(nextLink, context)); + } + + /** + * List the device groups for the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param listDeviceGroupsRequest List device groups for catalog. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeviceGroups( + String resourceGroupName, String catalogName, ListDeviceGroupsRequest listDeviceGroupsRequest) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedIterable<>( + listDeviceGroupsAsync( + resourceGroupName, catalogName, listDeviceGroupsRequest, filter, top, skip, maxpagesize)); + } + + /** + * List the device groups for the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param listDeviceGroupsRequest List device groups for catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeviceGroups( + String resourceGroupName, + String catalogName, + ListDeviceGroupsRequest listDeviceGroupsRequest, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedIterable<>( + listDeviceGroupsAsync( + resourceGroupName, catalogName, listDeviceGroupsRequest, filter, top, skip, maxpagesize, context)); + } + + /** + * Lists device insights for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 paged collection of DeviceInsight items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeviceInsightsSinglePageAsync( + String resourceGroupName, String catalogName, String filter, Integer top, Integer skip, Integer maxpagesize) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listDeviceInsights( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + filter, + top, + skip, + maxpagesize, + 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())); + } + + /** + * Lists device insights for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 paged collection of DeviceInsight items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeviceInsightsSinglePageAsync( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeviceInsights( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + filter, + top, + skip, + maxpagesize, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists device insights for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 paged collection of DeviceInsight items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeviceInsightsAsync( + String resourceGroupName, String catalogName, String filter, Integer top, Integer skip, Integer maxpagesize) { + return new PagedFlux<>( + () -> listDeviceInsightsSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize), + nextLink -> listDeviceInsightsNextSinglePageAsync(nextLink)); + } + + /** + * Lists device insights for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 paged collection of DeviceInsight items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeviceInsightsAsync(String resourceGroupName, String catalogName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedFlux<>( + () -> listDeviceInsightsSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize), + nextLink -> listDeviceInsightsNextSinglePageAsync(nextLink)); + } + + /** + * Lists device insights for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 paged collection of DeviceInsight items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDeviceInsightsAsync( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedFlux<>( + () -> + listDeviceInsightsSinglePageAsync( + resourceGroupName, catalogName, filter, top, skip, maxpagesize, context), + nextLink -> listDeviceInsightsNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists device insights for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 paged collection of DeviceInsight items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeviceInsights(String resourceGroupName, String catalogName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedIterable<>( + listDeviceInsightsAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize)); + } + + /** + * Lists device insights for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 paged collection of DeviceInsight items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeviceInsights( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedIterable<>( + listDeviceInsightsAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context)); + } + + /** + * Lists devices for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Device list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDevicesSinglePageAsync( + String resourceGroupName, String catalogName, String filter, Integer top, Integer skip, Integer maxpagesize) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + filter, + top, + skip, + maxpagesize, + 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())); + } + + /** + * Lists devices for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Device list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDevicesSinglePageAsync( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + filter, + top, + skip, + maxpagesize, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists devices for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Device list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDevicesAsync( + String resourceGroupName, String catalogName, String filter, Integer top, Integer skip, Integer maxpagesize) { + return new PagedFlux<>( + () -> listDevicesSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize), + nextLink -> listDevicesNextSinglePageAsync(nextLink)); + } + + /** + * Lists devices for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Device list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDevicesAsync(String resourceGroupName, String catalogName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedFlux<>( + () -> listDevicesSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize), + nextLink -> listDevicesNextSinglePageAsync(nextLink)); + } + + /** + * Lists devices for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Device list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listDevicesAsync( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedFlux<>( + () -> listDevicesSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context), + nextLink -> listDevicesNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists devices for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Device list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDevices(String resourceGroupName, String catalogName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedIterable<>(listDevicesAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize)); + } + + /** + * Lists devices for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Device list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDevices( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedIterable<>( + listDevicesAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 of a Catalog list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(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 + *

The nextLink parameter. + * @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 of a Catalog list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + 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 + *

The nextLink parameter. + * @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 of a Catalog list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(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 + *

The nextLink parameter. + * @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 of a Catalog list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + 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 + *

The nextLink parameter. + * @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 of a Deployment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listDeploymentsNext(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 + *

The nextLink parameter. + * @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 of a Deployment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeploymentsNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeploymentsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + 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 + *

The nextLink parameter. + * @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 of a DeviceGroup list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeviceGroupsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listDeviceGroupsNext(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 + *

The nextLink parameter. + * @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 of a DeviceGroup list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeviceGroupsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeviceGroupsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + 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 + *

The nextLink parameter. + * @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 paged collection of DeviceInsight items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeviceInsightsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listDeviceInsightsNext(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 + *

The nextLink parameter. + * @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 paged collection of DeviceInsight items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDeviceInsightsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDeviceInsightsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + 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 + *

The nextLink parameter. + * @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 of a Device list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDevicesNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listDevicesNext(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 + *

The nextLink parameter. + * @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 of a Device list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDevicesNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listDevicesNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogsImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogsImpl.java new file mode 100644 index 000000000000..7204f29b10d9 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CatalogsImpl.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.CatalogsClient; +import com.azure.resourcemanager.sphere.fluent.models.CatalogInner; +import com.azure.resourcemanager.sphere.fluent.models.CountDeviceResponseInner; +import com.azure.resourcemanager.sphere.fluent.models.DeploymentInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceInsightInner; +import com.azure.resourcemanager.sphere.models.Catalog; +import com.azure.resourcemanager.sphere.models.Catalogs; +import com.azure.resourcemanager.sphere.models.CountDeviceResponse; +import com.azure.resourcemanager.sphere.models.Deployment; +import com.azure.resourcemanager.sphere.models.Device; +import com.azure.resourcemanager.sphere.models.DeviceGroup; +import com.azure.resourcemanager.sphere.models.DeviceInsight; +import com.azure.resourcemanager.sphere.models.ListDeviceGroupsRequest; + +public final class CatalogsImpl implements Catalogs { + private static final ClientLogger LOGGER = new ClientLogger(CatalogsImpl.class); + + private final CatalogsClient innerClient; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public CatalogsImpl( + CatalogsClient innerClient, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new CatalogImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new CatalogImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new CatalogImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new CatalogImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String catalogName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, catalogName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CatalogImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Catalog getByResourceGroup(String resourceGroupName, String catalogName) { + CatalogInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, catalogName); + if (inner != null) { + return new CatalogImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String catalogName) { + this.serviceClient().delete(resourceGroupName, catalogName); + } + + public void delete(String resourceGroupName, String catalogName, Context context) { + this.serviceClient().delete(resourceGroupName, catalogName, context); + } + + public Response countDevicesWithResponse( + String resourceGroupName, String catalogName, Context context) { + Response inner = + this.serviceClient().countDevicesWithResponse(resourceGroupName, catalogName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CountDeviceResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CountDeviceResponse countDevices(String resourceGroupName, String catalogName) { + CountDeviceResponseInner inner = this.serviceClient().countDevices(resourceGroupName, catalogName); + if (inner != null) { + return new CountDeviceResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listDeployments(String resourceGroupName, String catalogName) { + PagedIterable inner = this.serviceClient().listDeployments(resourceGroupName, catalogName); + return Utils.mapPage(inner, inner1 -> new DeploymentImpl(inner1, this.manager())); + } + + public PagedIterable listDeployments( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listDeployments(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context); + return Utils.mapPage(inner, inner1 -> new DeploymentImpl(inner1, this.manager())); + } + + public PagedIterable listDeviceGroups( + String resourceGroupName, String catalogName, ListDeviceGroupsRequest listDeviceGroupsRequest) { + PagedIterable inner = + this.serviceClient().listDeviceGroups(resourceGroupName, catalogName, listDeviceGroupsRequest); + return Utils.mapPage(inner, inner1 -> new DeviceGroupImpl(inner1, this.manager())); + } + + public PagedIterable listDeviceGroups( + String resourceGroupName, + String catalogName, + ListDeviceGroupsRequest listDeviceGroupsRequest, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listDeviceGroups( + resourceGroupName, catalogName, listDeviceGroupsRequest, filter, top, skip, maxpagesize, context); + return Utils.mapPage(inner, inner1 -> new DeviceGroupImpl(inner1, this.manager())); + } + + public PagedIterable listDeviceInsights(String resourceGroupName, String catalogName) { + PagedIterable inner = + this.serviceClient().listDeviceInsights(resourceGroupName, catalogName); + return Utils.mapPage(inner, inner1 -> new DeviceInsightImpl(inner1, this.manager())); + } + + public PagedIterable listDeviceInsights( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listDeviceInsights(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context); + return Utils.mapPage(inner, inner1 -> new DeviceInsightImpl(inner1, this.manager())); + } + + public PagedIterable listDevices(String resourceGroupName, String catalogName) { + PagedIterable inner = this.serviceClient().listDevices(resourceGroupName, catalogName); + return Utils.mapPage(inner, inner1 -> new DeviceImpl(inner1, this.manager())); + } + + public PagedIterable listDevices( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + PagedIterable inner = + this.serviceClient().listDevices(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context); + return Utils.mapPage(inner, inner1 -> new DeviceImpl(inner1, this.manager())); + } + + public Catalog getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, catalogName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, catalogName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + this.delete(resourceGroupName, catalogName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + this.delete(resourceGroupName, catalogName, context); + } + + private CatalogsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } + + public CatalogImpl define(String name) { + return new CatalogImpl(name, this.manager()); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificateChainResponseImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificateChainResponseImpl.java new file mode 100644 index 000000000000..c4f161c52488 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificateChainResponseImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.resourcemanager.sphere.fluent.models.CertificateChainResponseInner; +import com.azure.resourcemanager.sphere.models.CertificateChainResponse; + +public final class CertificateChainResponseImpl implements CertificateChainResponse { + private CertificateChainResponseInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + CertificateChainResponseImpl( + CertificateChainResponseInner innerObject, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String certificateChain() { + return this.innerModel().certificateChain(); + } + + public CertificateChainResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificateImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificateImpl.java new file mode 100644 index 000000000000..89bed5e2be67 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificateImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sphere.fluent.models.CertificateInner; +import com.azure.resourcemanager.sphere.models.Certificate; +import com.azure.resourcemanager.sphere.models.CertificateStatus; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import java.time.OffsetDateTime; + +public final class CertificateImpl implements Certificate { + private CertificateInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + CertificateImpl(CertificateInner innerObject, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String certificate() { + return this.innerModel().certificate(); + } + + public CertificateStatus status() { + return this.innerModel().status(); + } + + public String subject() { + return this.innerModel().subject(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public OffsetDateTime expiryUtc() { + return this.innerModel().expiryUtc(); + } + + public OffsetDateTime notBeforeUtc() { + return this.innerModel().notBeforeUtc(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public CertificateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificatesClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificatesClientImpl.java new file mode 100644 index 000000000000..317dfa9c52f3 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificatesClientImpl.java @@ -0,0 +1,982 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.annotation.BodyParam; +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.Post; +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.sphere.fluent.CertificatesClient; +import com.azure.resourcemanager.sphere.fluent.models.CertificateChainResponseInner; +import com.azure.resourcemanager.sphere.fluent.models.CertificateInner; +import com.azure.resourcemanager.sphere.fluent.models.ProofOfPossessionNonceResponseInner; +import com.azure.resourcemanager.sphere.models.CertificateListResult; +import com.azure.resourcemanager.sphere.models.ProofOfPossessionNonceRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CertificatesClient. */ +public final class CertificatesClientImpl implements CertificatesClient { + /** The proxy service used to perform REST calls. */ + private final CertificatesService service; + + /** The service client containing this operation class. */ + private final AzureSphereManagementClientImpl client; + + /** + * Initializes an instance of CertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CertificatesClientImpl(AzureSphereManagementClientImpl client) { + this.service = + RestProxy.create(CertificatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureSphereManagementClientCertificates to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureSphereManagemen") + public interface CertificatesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCatalog( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, + @QueryParam("$maxpagesize") Integer maxpagesize, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("serialNumber") String serialNumber, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveCertChain") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> retrieveCertChain( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("serialNumber") String serialNumber, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveProofOfPossessionNonce") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> retrieveProofOfPossessionNonce( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("serialNumber") String serialNumber, + @BodyParam("application/json") ProofOfPossessionNonceRequest proofOfPossessionNonceRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCatalogNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List Certificate resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Certificate list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCatalogSinglePageAsync( + String resourceGroupName, String catalogName, String filter, Integer top, Integer skip, Integer maxpagesize) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCatalog( + this.client.getEndpoint(), + filter, + top, + skip, + maxpagesize, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + 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 Certificate resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Certificate list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCatalogSinglePageAsync( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCatalog( + this.client.getEndpoint(), + filter, + top, + skip, + maxpagesize, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Certificate resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Certificate list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCatalogAsync( + String resourceGroupName, String catalogName, String filter, Integer top, Integer skip, Integer maxpagesize) { + return new PagedFlux<>( + () -> listByCatalogSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize), + nextLink -> listByCatalogNextSinglePageAsync(nextLink)); + } + + /** + * List Certificate resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Certificate list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCatalogAsync(String resourceGroupName, String catalogName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedFlux<>( + () -> listByCatalogSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize), + nextLink -> listByCatalogNextSinglePageAsync(nextLink)); + } + + /** + * List Certificate resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Certificate list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCatalogAsync( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedFlux<>( + () -> listByCatalogSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context), + nextLink -> listByCatalogNextSinglePageAsync(nextLink, context)); + } + + /** + * List Certificate resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Certificate list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCatalog(String resourceGroupName, String catalogName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedIterable<>(listByCatalogAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize)); + } + + /** + * List Certificate resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Certificate list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCatalog( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedIterable<>( + listByCatalogAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context)); + } + + /** + * Get a Certificate. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 Certificate along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String catalogName, String serialNumber) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (serialNumber == null) { + return Mono.error(new IllegalArgumentException("Parameter serialNumber is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + serialNumber, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Certificate. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 Certificate along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String catalogName, String serialNumber, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (serialNumber == null) { + return Mono.error(new IllegalArgumentException("Parameter serialNumber is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + serialNumber, + accept, + context); + } + + /** + * Get a Certificate. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 Certificate on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String catalogName, String serialNumber) { + return getWithResponseAsync(resourceGroupName, catalogName, serialNumber) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Certificate. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 Certificate along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String catalogName, String serialNumber, Context context) { + return getWithResponseAsync(resourceGroupName, catalogName, serialNumber, context).block(); + } + + /** + * Get a Certificate. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 Certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateInner get(String resourceGroupName, String catalogName, String serialNumber) { + return getWithResponse(resourceGroupName, catalogName, serialNumber, Context.NONE).getValue(); + } + + /** + * Retrieves cert chain. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 certificate chain response along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> retrieveCertChainWithResponseAsync( + String resourceGroupName, String catalogName, String serialNumber) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (serialNumber == null) { + return Mono.error(new IllegalArgumentException("Parameter serialNumber is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .retrieveCertChain( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + serialNumber, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves cert chain. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 certificate chain response along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> retrieveCertChainWithResponseAsync( + String resourceGroupName, String catalogName, String serialNumber, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (serialNumber == null) { + return Mono.error(new IllegalArgumentException("Parameter serialNumber is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .retrieveCertChain( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + serialNumber, + accept, + context); + } + + /** + * Retrieves cert chain. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 certificate chain response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveCertChainAsync( + String resourceGroupName, String catalogName, String serialNumber) { + return retrieveCertChainWithResponseAsync(resourceGroupName, catalogName, serialNumber) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves cert chain. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 certificate chain response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response retrieveCertChainWithResponse( + String resourceGroupName, String catalogName, String serialNumber, Context context) { + return retrieveCertChainWithResponseAsync(resourceGroupName, catalogName, serialNumber, context).block(); + } + + /** + * Retrieves cert chain. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 certificate chain response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateChainResponseInner retrieveCertChain( + String resourceGroupName, String catalogName, String serialNumber) { + return retrieveCertChainWithResponse(resourceGroupName, catalogName, serialNumber, Context.NONE).getValue(); + } + + /** + * Gets the proof of possession nonce. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @param proofOfPossessionNonceRequest Proof of possession nonce request body. + * @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 proof of possession nonce along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> retrieveProofOfPossessionNonceWithResponseAsync( + String resourceGroupName, + String catalogName, + String serialNumber, + ProofOfPossessionNonceRequest proofOfPossessionNonceRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (serialNumber == null) { + return Mono.error(new IllegalArgumentException("Parameter serialNumber is required and cannot be null.")); + } + if (proofOfPossessionNonceRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter proofOfPossessionNonceRequest is required and cannot be null.")); + } else { + proofOfPossessionNonceRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .retrieveProofOfPossessionNonce( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + serialNumber, + proofOfPossessionNonceRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the proof of possession nonce. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @param proofOfPossessionNonceRequest Proof of possession nonce request body. + * @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 proof of possession nonce along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> retrieveProofOfPossessionNonceWithResponseAsync( + String resourceGroupName, + String catalogName, + String serialNumber, + ProofOfPossessionNonceRequest proofOfPossessionNonceRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (serialNumber == null) { + return Mono.error(new IllegalArgumentException("Parameter serialNumber is required and cannot be null.")); + } + if (proofOfPossessionNonceRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter proofOfPossessionNonceRequest is required and cannot be null.")); + } else { + proofOfPossessionNonceRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .retrieveProofOfPossessionNonce( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + serialNumber, + proofOfPossessionNonceRequest, + accept, + context); + } + + /** + * Gets the proof of possession nonce. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @param proofOfPossessionNonceRequest Proof of possession nonce request body. + * @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 proof of possession nonce on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveProofOfPossessionNonceAsync( + String resourceGroupName, + String catalogName, + String serialNumber, + ProofOfPossessionNonceRequest proofOfPossessionNonceRequest) { + return retrieveProofOfPossessionNonceWithResponseAsync( + resourceGroupName, catalogName, serialNumber, proofOfPossessionNonceRequest) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the proof of possession nonce. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @param proofOfPossessionNonceRequest Proof of possession nonce request body. + * @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 proof of possession nonce along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response retrieveProofOfPossessionNonceWithResponse( + String resourceGroupName, + String catalogName, + String serialNumber, + ProofOfPossessionNonceRequest proofOfPossessionNonceRequest, + Context context) { + return retrieveProofOfPossessionNonceWithResponseAsync( + resourceGroupName, catalogName, serialNumber, proofOfPossessionNonceRequest, context) + .block(); + } + + /** + * Gets the proof of possession nonce. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @param proofOfPossessionNonceRequest Proof of possession nonce request body. + * @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 proof of possession nonce. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProofOfPossessionNonceResponseInner retrieveProofOfPossessionNonce( + String resourceGroupName, + String catalogName, + String serialNumber, + ProofOfPossessionNonceRequest proofOfPossessionNonceRequest) { + return retrieveProofOfPossessionNonceWithResponse( + resourceGroupName, catalogName, serialNumber, proofOfPossessionNonceRequest, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 of a Certificate list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCatalogNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByCatalogNext(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 + *

The nextLink parameter. + * @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 of a Certificate list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCatalogNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCatalogNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificatesImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificatesImpl.java new file mode 100644 index 000000000000..d8edb696338e --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CertificatesImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.CertificatesClient; +import com.azure.resourcemanager.sphere.fluent.models.CertificateChainResponseInner; +import com.azure.resourcemanager.sphere.fluent.models.CertificateInner; +import com.azure.resourcemanager.sphere.fluent.models.ProofOfPossessionNonceResponseInner; +import com.azure.resourcemanager.sphere.models.Certificate; +import com.azure.resourcemanager.sphere.models.CertificateChainResponse; +import com.azure.resourcemanager.sphere.models.Certificates; +import com.azure.resourcemanager.sphere.models.ProofOfPossessionNonceRequest; +import com.azure.resourcemanager.sphere.models.ProofOfPossessionNonceResponse; + +public final class CertificatesImpl implements Certificates { + private static final ClientLogger LOGGER = new ClientLogger(CertificatesImpl.class); + + private final CertificatesClient innerClient; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public CertificatesImpl( + CertificatesClient innerClient, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCatalog(String resourceGroupName, String catalogName) { + PagedIterable inner = this.serviceClient().listByCatalog(resourceGroupName, catalogName); + return Utils.mapPage(inner, inner1 -> new CertificateImpl(inner1, this.manager())); + } + + public PagedIterable listByCatalog( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + PagedIterable inner = + this.serviceClient().listByCatalog(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context); + return Utils.mapPage(inner, inner1 -> new CertificateImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String catalogName, String serialNumber, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, catalogName, serialNumber, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Certificate get(String resourceGroupName, String catalogName, String serialNumber) { + CertificateInner inner = this.serviceClient().get(resourceGroupName, catalogName, serialNumber); + if (inner != null) { + return new CertificateImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response retrieveCertChainWithResponse( + String resourceGroupName, String catalogName, String serialNumber, Context context) { + Response inner = + this.serviceClient().retrieveCertChainWithResponse(resourceGroupName, catalogName, serialNumber, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateChainResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CertificateChainResponse retrieveCertChain( + String resourceGroupName, String catalogName, String serialNumber) { + CertificateChainResponseInner inner = + this.serviceClient().retrieveCertChain(resourceGroupName, catalogName, serialNumber); + if (inner != null) { + return new CertificateChainResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response retrieveProofOfPossessionNonceWithResponse( + String resourceGroupName, + String catalogName, + String serialNumber, + ProofOfPossessionNonceRequest proofOfPossessionNonceRequest, + Context context) { + Response inner = + this + .serviceClient() + .retrieveProofOfPossessionNonceWithResponse( + resourceGroupName, catalogName, serialNumber, proofOfPossessionNonceRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProofOfPossessionNonceResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ProofOfPossessionNonceResponse retrieveProofOfPossessionNonce( + String resourceGroupName, + String catalogName, + String serialNumber, + ProofOfPossessionNonceRequest proofOfPossessionNonceRequest) { + ProofOfPossessionNonceResponseInner inner = + this + .serviceClient() + .retrieveProofOfPossessionNonce( + resourceGroupName, catalogName, serialNumber, proofOfPossessionNonceRequest); + if (inner != null) { + return new ProofOfPossessionNonceResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private CertificatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CountDeviceResponseImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CountDeviceResponseImpl.java new file mode 100644 index 000000000000..fb2b9e03cdc0 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/CountDeviceResponseImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.resourcemanager.sphere.fluent.models.CountDeviceResponseInner; +import com.azure.resourcemanager.sphere.models.CountDeviceResponse; + +public final class CountDeviceResponseImpl implements CountDeviceResponse { + private CountDeviceResponseInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + CountDeviceResponseImpl( + CountDeviceResponseInner innerObject, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public int value() { + return this.innerModel().value(); + } + + public CountDeviceResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentImpl.java new file mode 100644 index 000000000000..1f1923be9b2b --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentImpl.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.DeploymentInner; +import com.azure.resourcemanager.sphere.fluent.models.ImageInner; +import com.azure.resourcemanager.sphere.models.Deployment; +import com.azure.resourcemanager.sphere.models.Image; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class DeploymentImpl implements Deployment, Deployment.Definition, Deployment.Update { + private DeploymentInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String deploymentId() { + return this.innerModel().deploymentId(); + } + + public List deployedImages() { + List inner = this.innerModel().deployedImages(); + if (inner != null) { + return Collections + .unmodifiableList( + inner.stream().map(inner1 -> new ImageImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime deploymentDateUtc() { + return this.innerModel().deploymentDateUtc(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DeploymentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String catalogName; + + private String productName; + + private String deviceGroupName; + + private String deploymentName; + + public DeploymentImpl withExistingDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + this.resourceGroupName = resourceGroupName; + this.catalogName = catalogName; + this.productName = productName; + this.deviceGroupName = deviceGroupName; + return this; + } + + public Deployment create() { + this.innerObject = + serviceManager + .serviceClient() + .getDeployments() + .createOrUpdate( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + this.innerModel(), + Context.NONE); + return this; + } + + public Deployment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDeployments() + .createOrUpdate( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + this.innerModel(), + context); + return this; + } + + DeploymentImpl(String name, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = new DeploymentInner(); + this.serviceManager = serviceManager; + this.deploymentName = name; + } + + public DeploymentImpl update() { + return this; + } + + public Deployment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDeployments() + .createOrUpdate( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + this.innerModel(), + Context.NONE); + return this; + } + + public Deployment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDeployments() + .createOrUpdate( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + this.innerModel(), + context); + return this; + } + + DeploymentImpl(DeploymentInner innerObject, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.catalogName = Utils.getValueFromIdByName(innerObject.id(), "catalogs"); + this.productName = Utils.getValueFromIdByName(innerObject.id(), "products"); + this.deviceGroupName = Utils.getValueFromIdByName(innerObject.id(), "deviceGroups"); + this.deploymentName = Utils.getValueFromIdByName(innerObject.id(), "deployments"); + } + + public Deployment refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDeployments() + .getWithResponse( + resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, Context.NONE) + .getValue(); + return this; + } + + public Deployment refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDeployments() + .getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, context) + .getValue(); + return this; + } + + public DeploymentImpl withDeploymentId(String deploymentId) { + this.innerModel().withDeploymentId(deploymentId); + return this; + } + + public DeploymentImpl withDeployedImages(List deployedImages) { + this.innerModel().withDeployedImages(deployedImages); + return this; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentsClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentsClientImpl.java new file mode 100644 index 000000000000..8e614c30d24c --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentsClientImpl.java @@ -0,0 +1,1557 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.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.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.management.polling.PollResult; +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.sphere.fluent.DeploymentsClient; +import com.azure.resourcemanager.sphere.fluent.models.DeploymentInner; +import com.azure.resourcemanager.sphere.models.DeploymentListResult; +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 DeploymentsClient. */ +public final class DeploymentsClientImpl implements DeploymentsClient { + /** The proxy service used to perform REST calls. */ + private final DeploymentsService service; + + /** The service client containing this operation class. */ + private final AzureSphereManagementClientImpl client; + + /** + * Initializes an instance of DeploymentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeploymentsClientImpl(AzureSphereManagementClientImpl client) { + this.service = + RestProxy.create(DeploymentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureSphereManagementClientDeployments to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureSphereManagemen") + public interface DeploymentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDeviceGroup( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, + @QueryParam("$maxpagesize") Integer maxpagesize, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @PathParam("deploymentName") String deploymentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @PathParam("deploymentName") String deploymentName, + @BodyParam("application/json") DeploymentInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @PathParam("deploymentName") String deploymentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDeviceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Deployment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDeviceGroupSinglePageAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDeviceGroup( + this.client.getEndpoint(), + filter, + top, + skip, + maxpagesize, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + 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 Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Deployment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDeviceGroupSinglePageAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDeviceGroup( + this.client.getEndpoint(), + filter, + top, + skip, + maxpagesize, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Deployment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDeviceGroupAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize) { + return new PagedFlux<>( + () -> + listByDeviceGroupSinglePageAsync( + resourceGroupName, catalogName, productName, deviceGroupName, filter, top, skip, maxpagesize), + nextLink -> listByDeviceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 of a Deployment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDeviceGroupAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedFlux<>( + () -> + listByDeviceGroupSinglePageAsync( + resourceGroupName, catalogName, productName, deviceGroupName, filter, top, skip, maxpagesize), + nextLink -> listByDeviceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Deployment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDeviceGroupAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedFlux<>( + () -> + listByDeviceGroupSinglePageAsync( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + filter, + top, + skip, + maxpagesize, + context), + nextLink -> listByDeviceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedIterable<>( + listByDeviceGroupAsync( + resourceGroupName, catalogName, productName, deviceGroupName, filter, top, skip, maxpagesize)); + } + + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDeviceGroup( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedIterable<>( + listByDeviceGroupAsync( + resourceGroupName, catalogName, productName, deviceGroupName, filter, top, skip, maxpagesize, context)); + } + + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device + * group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 Deployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device + * group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 Deployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + accept, + context); + } + + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device + * group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 Deployment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName) { + return getWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device + * group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 Deployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context) { + return getWithResponseAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, context) + .block(); + } + + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device + * group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 Deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentInner get( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName) { + return getWithResponse( + resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, Context.NONE) + .getValue(); + } + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + resource, + accept, + context); + } + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, resource); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeploymentInner.class, + DeploymentInner.class, + this.client.getContext()); + } + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 PollerFlux} for polling of an deployment resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeploymentInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, resource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DeploymentInner.class, DeploymentInner.class, context); + } + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentInner> beginCreateOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource) { + return this + .beginCreateOrUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, resource) + .getSyncPoller(); + } + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeploymentInner> beginCreateOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource, + Context context) { + return this + .beginCreateOrUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, resource, context) + .getSyncPoller(); + } + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource) { + return beginCreateOrUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentInner createOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource) { + return createOrUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, resource) + .block(); + } + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 an deployment resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeploymentInner createOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + DeploymentInner resource, + Context context) { + return createOrUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, resource, context) + .block(); + } + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deploymentName == null) { + return Mono.error(new IllegalArgumentException("Parameter deploymentName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + accept, + context); + } + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName) { + return this + .beginDeleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName) + .getSyncPoller(); + } + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context) { + return this + .beginDeleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, context) + .getSyncPoller(); + } + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName) { + return beginDeleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context) { + return beginDeleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName) { + deleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName).block(); + } + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context) { + deleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 of a Deployment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDeviceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDeviceGroupNext(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 + *

The nextLink parameter. + * @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 of a Deployment list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDeviceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDeviceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentsImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentsImpl.java new file mode 100644 index 000000000000..eb743c5dd580 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeploymentsImpl.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.DeploymentsClient; +import com.azure.resourcemanager.sphere.fluent.models.DeploymentInner; +import com.azure.resourcemanager.sphere.models.Deployment; +import com.azure.resourcemanager.sphere.models.Deployments; + +public final class DeploymentsImpl implements Deployments { + private static final ClientLogger LOGGER = new ClientLogger(DeploymentsImpl.class); + + private final DeploymentsClient innerClient; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public DeploymentsImpl( + DeploymentsClient innerClient, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + PagedIterable inner = + this.serviceClient().listByDeviceGroup(resourceGroupName, catalogName, productName, deviceGroupName); + return Utils.mapPage(inner, inner1 -> new DeploymentImpl(inner1, this.manager())); + } + + public PagedIterable listByDeviceGroup( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDeviceGroup( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + filter, + top, + skip, + maxpagesize, + context); + return Utils.mapPage(inner, inner1 -> new DeploymentImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeploymentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Deployment get( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName) { + DeploymentInner inner = + this.serviceClient().get(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName); + if (inner != null) { + return new DeploymentImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName) { + this.serviceClient().delete(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName); + } + + public void delete( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context) { + this + .serviceClient() + .delete(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, context); + } + + public Deployment getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + String deviceGroupName = Utils.getValueFromIdByName(id, "deviceGroups"); + if (deviceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deviceGroups'.", id))); + } + String deploymentName = Utils.getValueFromIdByName(id, "deployments"); + if (deploymentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id))); + } + return this + .getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + String deviceGroupName = Utils.getValueFromIdByName(id, "deviceGroups"); + if (deviceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deviceGroups'.", id))); + } + String deploymentName = Utils.getValueFromIdByName(id, "deployments"); + if (deploymentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id))); + } + return this + .getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + String deviceGroupName = Utils.getValueFromIdByName(id, "deviceGroups"); + if (deviceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deviceGroups'.", id))); + } + String deploymentName = Utils.getValueFromIdByName(id, "deployments"); + if (deploymentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id))); + } + this.delete(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + String deviceGroupName = Utils.getValueFromIdByName(id, "deviceGroups"); + if (deviceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deviceGroups'.", id))); + } + String deploymentName = Utils.getValueFromIdByName(id, "deployments"); + if (deploymentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deployments'.", id))); + } + this.delete(resourceGroupName, catalogName, productName, deviceGroupName, deploymentName, context); + } + + private DeploymentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } + + public DeploymentImpl define(String name) { + return new DeploymentImpl(name, this.manager()); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupImpl.java new file mode 100644 index 000000000000..b62722fd63ee --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner; +import com.azure.resourcemanager.sphere.models.AllowCrashDumpCollection; +import com.azure.resourcemanager.sphere.models.ClaimDevicesRequest; +import com.azure.resourcemanager.sphere.models.CountDeviceResponse; +import com.azure.resourcemanager.sphere.models.DeviceGroup; +import com.azure.resourcemanager.sphere.models.DeviceGroupUpdate; +import com.azure.resourcemanager.sphere.models.OSFeedType; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; +import com.azure.resourcemanager.sphere.models.UpdatePolicy; + +public final class DeviceGroupImpl implements DeviceGroup, DeviceGroup.Definition, DeviceGroup.Update { + private DeviceGroupInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String description() { + return this.innerModel().description(); + } + + public OSFeedType osFeedType() { + return this.innerModel().osFeedType(); + } + + public UpdatePolicy updatePolicy() { + return this.innerModel().updatePolicy(); + } + + public AllowCrashDumpCollection allowCrashDumpsCollection() { + return this.innerModel().allowCrashDumpsCollection(); + } + + public RegionalDataBoundary regionalDataBoundary() { + return this.innerModel().regionalDataBoundary(); + } + + public Boolean hasDeployment() { + return this.innerModel().hasDeployment(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DeviceGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String catalogName; + + private String productName; + + private String deviceGroupName; + + private DeviceGroupUpdate updateProperties; + + public DeviceGroupImpl withExistingProduct(String resourceGroupName, String catalogName, String productName) { + this.resourceGroupName = resourceGroupName; + this.catalogName = catalogName; + this.productName = productName; + return this; + } + + public DeviceGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getDeviceGroups() + .createOrUpdate( + resourceGroupName, catalogName, productName, deviceGroupName, this.innerModel(), Context.NONE); + return this; + } + + public DeviceGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDeviceGroups() + .createOrUpdate( + resourceGroupName, catalogName, productName, deviceGroupName, this.innerModel(), context); + return this; + } + + DeviceGroupImpl(String name, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = new DeviceGroupInner(); + this.serviceManager = serviceManager; + this.deviceGroupName = name; + } + + public DeviceGroupImpl update() { + this.updateProperties = new DeviceGroupUpdate(); + return this; + } + + public DeviceGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDeviceGroups() + .update(resourceGroupName, catalogName, productName, deviceGroupName, updateProperties, Context.NONE); + return this; + } + + public DeviceGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDeviceGroups() + .update(resourceGroupName, catalogName, productName, deviceGroupName, updateProperties, context); + return this; + } + + DeviceGroupImpl(DeviceGroupInner innerObject, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.catalogName = Utils.getValueFromIdByName(innerObject.id(), "catalogs"); + this.productName = Utils.getValueFromIdByName(innerObject.id(), "products"); + this.deviceGroupName = Utils.getValueFromIdByName(innerObject.id(), "deviceGroups"); + } + + public DeviceGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDeviceGroups() + .getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, Context.NONE) + .getValue(); + return this; + } + + public DeviceGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDeviceGroups() + .getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, context) + .getValue(); + return this; + } + + public void claimDevices(ClaimDevicesRequest claimDevicesRequest) { + serviceManager + .deviceGroups() + .claimDevices(resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest); + } + + public void claimDevices(ClaimDevicesRequest claimDevicesRequest, Context context) { + serviceManager + .deviceGroups() + .claimDevices(resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest, context); + } + + public Response countDevicesWithResponse(Context context) { + return serviceManager + .deviceGroups() + .countDevicesWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, context); + } + + public CountDeviceResponse countDevices() { + return serviceManager.deviceGroups().countDevices(resourceGroupName, catalogName, productName, deviceGroupName); + } + + public DeviceGroupImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateProperties.withDescription(description); + return this; + } + } + + public DeviceGroupImpl withOsFeedType(OSFeedType osFeedType) { + if (isInCreateMode()) { + this.innerModel().withOsFeedType(osFeedType); + return this; + } else { + this.updateProperties.withOsFeedType(osFeedType); + return this; + } + } + + public DeviceGroupImpl withUpdatePolicy(UpdatePolicy updatePolicy) { + if (isInCreateMode()) { + this.innerModel().withUpdatePolicy(updatePolicy); + return this; + } else { + this.updateProperties.withUpdatePolicy(updatePolicy); + return this; + } + } + + public DeviceGroupImpl withAllowCrashDumpsCollection(AllowCrashDumpCollection allowCrashDumpsCollection) { + if (isInCreateMode()) { + this.innerModel().withAllowCrashDumpsCollection(allowCrashDumpsCollection); + return this; + } else { + this.updateProperties.withAllowCrashDumpsCollection(allowCrashDumpsCollection); + return this; + } + } + + public DeviceGroupImpl withRegionalDataBoundary(RegionalDataBoundary regionalDataBoundary) { + if (isInCreateMode()) { + this.innerModel().withRegionalDataBoundary(regionalDataBoundary); + return this; + } else { + this.updateProperties.withRegionalDataBoundary(regionalDataBoundary); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupsClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupsClientImpl.java new file mode 100644 index 000000000000..2e01c5ca4e09 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupsClientImpl.java @@ -0,0 +1,2319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.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.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +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.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.management.polling.PollResult; +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.sphere.fluent.DeviceGroupsClient; +import com.azure.resourcemanager.sphere.fluent.models.CountDeviceResponseInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner; +import com.azure.resourcemanager.sphere.models.ClaimDevicesRequest; +import com.azure.resourcemanager.sphere.models.DeviceGroupListResult; +import com.azure.resourcemanager.sphere.models.DeviceGroupUpdate; +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 DeviceGroupsClient. */ +public final class DeviceGroupsClientImpl implements DeviceGroupsClient { + /** The proxy service used to perform REST calls. */ + private final DeviceGroupsService service; + + /** The service client containing this operation class. */ + private final AzureSphereManagementClientImpl client; + + /** + * Initializes an instance of DeviceGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeviceGroupsClientImpl(AzureSphereManagementClientImpl client) { + this.service = + RestProxy.create(DeviceGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureSphereManagementClientDeviceGroups to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureSphereManagemen") + public interface DeviceGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByProduct( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, + @QueryParam("$maxpagesize") Integer maxpagesize, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @BodyParam("application/json") DeviceGroupInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @BodyParam("application/json") DeviceGroupUpdate properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> claimDevices( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @BodyParam("application/json") ClaimDevicesRequest claimDevicesRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/countDevices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> countDevices( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByProductNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a DeviceGroup list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProductSinglePageAsync( + String resourceGroupName, + String catalogName, + String productName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByProduct( + this.client.getEndpoint(), + filter, + top, + skip, + maxpagesize, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + 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 DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a DeviceGroup list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProductSinglePageAsync( + String resourceGroupName, + String catalogName, + String productName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByProduct( + this.client.getEndpoint(), + filter, + top, + skip, + maxpagesize, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProductAsync( + String resourceGroupName, + String catalogName, + String productName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize) { + return new PagedFlux<>( + () -> + listByProductSinglePageAsync( + resourceGroupName, catalogName, productName, filter, top, skip, maxpagesize), + nextLink -> listByProductNextSinglePageAsync(nextLink)); + } + + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProductAsync( + String resourceGroupName, String catalogName, String productName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedFlux<>( + () -> + listByProductSinglePageAsync( + resourceGroupName, catalogName, productName, filter, top, skip, maxpagesize), + nextLink -> listByProductNextSinglePageAsync(nextLink)); + } + + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByProductAsync( + String resourceGroupName, + String catalogName, + String productName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedFlux<>( + () -> + listByProductSinglePageAsync( + resourceGroupName, catalogName, productName, filter, top, skip, maxpagesize, context), + nextLink -> listByProductNextSinglePageAsync(nextLink, context)); + } + + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByProduct( + String resourceGroupName, String catalogName, String productName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedIterable<>( + listByProductAsync(resourceGroupName, catalogName, productName, filter, top, skip, maxpagesize)); + } + + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByProduct( + String resourceGroupName, + String catalogName, + String productName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedIterable<>( + listByProductAsync(resourceGroupName, catalogName, productName, filter, top, skip, maxpagesize, context)); + } + + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 DeviceGroup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 DeviceGroup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + accept, + context); + } + + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 DeviceGroup on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + return getWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 DeviceGroup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName, context).block(); + } + + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 DeviceGroup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceGroupInner get( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + return getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, Context.NONE).getValue(); + } + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + resource, + accept, + context); + } + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeviceGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName, resource); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeviceGroupInner.class, + DeviceGroupInner.class, + this.client.getContext()); + } + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 PollerFlux} for polling of an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeviceGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, catalogName, productName, deviceGroupName, resource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DeviceGroupInner.class, DeviceGroupInner.class, context); + } + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeviceGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, resource) + .getSyncPoller(); + } + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeviceGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource, + Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, resource, context) + .getSyncPoller(); + } + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceGroupInner createOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource) { + return createOrUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, resource).block(); + } + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceGroupInner createOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupInner resource, + Context context) { + return createOrUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, resource, context) + .block(); + } + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an device group resource belonging to a product resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @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 an device group resource belonging to a product resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + properties, + accept, + context); + } + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeviceGroupInner> beginUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName, properties); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeviceGroupInner.class, + DeviceGroupInner.class, + this.client.getContext()); + } + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @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 PollerFlux} for polling of an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeviceGroupInner> beginUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName, properties, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DeviceGroupInner.class, DeviceGroupInner.class, context); + } + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeviceGroupInner> beginUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties) { + return this + .beginUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, properties) + .getSyncPoller(); + } + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeviceGroupInner> beginUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties, + Context context) { + return this + .beginUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, properties, context) + .getSyncPoller(); + } + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an device group resource belonging to a product resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties) { + return beginUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, properties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @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 an device group resource belonging to a product resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties, + Context context) { + return beginUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, properties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceGroupInner update( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties) { + return updateAsync(resourceGroupName, catalogName, productName, deviceGroupName, properties).block(); + } + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @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 an device group resource belonging to a product resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceGroupInner update( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + DeviceGroupUpdate properties, + Context context) { + return updateAsync(resourceGroupName, catalogName, productName, deviceGroupName, properties, context).block(); + } + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + accept, + context); + } + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName) { + return this.beginDeleteAsync(resourceGroupName, catalogName, productName, deviceGroupName).getSyncPoller(); + } + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + return this + .beginDeleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, context) + .getSyncPoller(); + } + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName) { + return beginDeleteAsync(resourceGroupName, catalogName, productName, deviceGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName) { + deleteAsync(resourceGroupName, catalogName, productName, deviceGroupName).block(); + } + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + deleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, context).block(); + } + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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>> claimDevicesWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (claimDevicesRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter claimDevicesRequest is required and cannot be null.")); + } else { + claimDevicesRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .claimDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + claimDevicesRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> claimDevicesWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (claimDevicesRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter claimDevicesRequest is required and cannot be null.")); + } else { + claimDevicesRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .claimDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + claimDevicesRequest, + accept, + context); + } + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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> beginClaimDevicesAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest) { + Mono>> mono = + claimDevicesWithResponseAsync( + resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginClaimDevicesAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + claimDevicesWithResponseAsync( + resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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> beginClaimDevices( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest) { + return this + .beginClaimDevicesAsync(resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest) + .getSyncPoller(); + } + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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> beginClaimDevices( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest, + Context context) { + return this + .beginClaimDevicesAsync( + resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest, context) + .getSyncPoller(); + } + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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 claimDevicesAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest) { + return beginClaimDevicesAsync(resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono claimDevicesAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest, + Context context) { + return beginClaimDevicesAsync( + resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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 claimDevices( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest) { + claimDevicesAsync(resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest).block(); + } + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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 claimDevices( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest, + Context context) { + claimDevicesAsync(resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest, context) + .block(); + } + + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response to the action call for count devices in a catalog along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> countDevicesWithResponseAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .countDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response to the action call for count devices in a catalog along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> countDevicesWithResponseAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .countDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + accept, + context); + } + + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response to the action call for count devices in a catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono countDevicesAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + return countDevicesWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response to the action call for count devices in a catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response countDevicesWithResponse( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + return countDevicesWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName, context) + .block(); + } + + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response to the action call for count devices in a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CountDeviceResponseInner countDevices( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + return countDevicesWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 of a DeviceGroup list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProductNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByProductNext(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 + *

The nextLink parameter. + * @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 of a DeviceGroup list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByProductNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByProductNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupsImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupsImpl.java new file mode 100644 index 000000000000..3e768fc39155 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceGroupsImpl.java @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.DeviceGroupsClient; +import com.azure.resourcemanager.sphere.fluent.models.CountDeviceResponseInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner; +import com.azure.resourcemanager.sphere.models.ClaimDevicesRequest; +import com.azure.resourcemanager.sphere.models.CountDeviceResponse; +import com.azure.resourcemanager.sphere.models.DeviceGroup; +import com.azure.resourcemanager.sphere.models.DeviceGroups; + +public final class DeviceGroupsImpl implements DeviceGroups { + private static final ClientLogger LOGGER = new ClientLogger(DeviceGroupsImpl.class); + + private final DeviceGroupsClient innerClient; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public DeviceGroupsImpl( + DeviceGroupsClient innerClient, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByProduct(String resourceGroupName, String catalogName, String productName) { + PagedIterable inner = + this.serviceClient().listByProduct(resourceGroupName, catalogName, productName); + return Utils.mapPage(inner, inner1 -> new DeviceGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByProduct( + String resourceGroupName, + String catalogName, + String productName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByProduct(resourceGroupName, catalogName, productName, filter, top, skip, maxpagesize, context); + return Utils.mapPage(inner, inner1 -> new DeviceGroupImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeviceGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DeviceGroup get(String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + DeviceGroupInner inner = this.serviceClient().get(resourceGroupName, catalogName, productName, deviceGroupName); + if (inner != null) { + return new DeviceGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + this.serviceClient().delete(resourceGroupName, catalogName, productName, deviceGroupName); + } + + public void delete( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, catalogName, productName, deviceGroupName, context); + } + + public void claimDevices( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest) { + this + .serviceClient() + .claimDevices(resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest); + } + + public void claimDevices( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest, + Context context) { + this + .serviceClient() + .claimDevices(resourceGroupName, catalogName, productName, deviceGroupName, claimDevicesRequest, context); + } + + public Response countDevicesWithResponse( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + Response inner = + this + .serviceClient() + .countDevicesWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CountDeviceResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CountDeviceResponse countDevices( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + CountDeviceResponseInner inner = + this.serviceClient().countDevices(resourceGroupName, catalogName, productName, deviceGroupName); + if (inner != null) { + return new CountDeviceResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeviceGroup getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + String deviceGroupName = Utils.getValueFromIdByName(id, "deviceGroups"); + if (deviceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deviceGroups'.", id))); + } + return this + .getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + String deviceGroupName = Utils.getValueFromIdByName(id, "deviceGroups"); + if (deviceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deviceGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + String deviceGroupName = Utils.getValueFromIdByName(id, "deviceGroups"); + if (deviceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deviceGroups'.", id))); + } + this.delete(resourceGroupName, catalogName, productName, deviceGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + String deviceGroupName = Utils.getValueFromIdByName(id, "deviceGroups"); + if (deviceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deviceGroups'.", id))); + } + this.delete(resourceGroupName, catalogName, productName, deviceGroupName, context); + } + + private DeviceGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } + + public DeviceGroupImpl define(String name) { + return new DeviceGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceImpl.java new file mode 100644 index 000000000000..a7b8dd47135f --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.DeviceInner; +import com.azure.resourcemanager.sphere.models.Device; +import com.azure.resourcemanager.sphere.models.DeviceUpdate; +import com.azure.resourcemanager.sphere.models.GenerateCapabilityImageRequest; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.azure.resourcemanager.sphere.models.SignedCapabilityImageResponse; +import java.time.OffsetDateTime; + +public final class DeviceImpl implements Device, Device.Definition, Device.Update { + private DeviceInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String deviceId() { + return this.innerModel().deviceId(); + } + + public String chipSku() { + return this.innerModel().chipSku(); + } + + public String lastAvailableOsVersion() { + return this.innerModel().lastAvailableOsVersion(); + } + + public String lastInstalledOsVersion() { + return this.innerModel().lastInstalledOsVersion(); + } + + public OffsetDateTime lastOsUpdateUtc() { + return this.innerModel().lastOsUpdateUtc(); + } + + public OffsetDateTime lastUpdateRequestUtc() { + return this.innerModel().lastUpdateRequestUtc(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DeviceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String catalogName; + + private String productName; + + private String deviceGroupName; + + private String deviceName; + + private DeviceUpdate updateProperties; + + public DeviceImpl withExistingDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + this.resourceGroupName = resourceGroupName; + this.catalogName = catalogName; + this.productName = productName; + this.deviceGroupName = deviceGroupName; + return this; + } + + public Device create() { + this.innerObject = + serviceManager + .serviceClient() + .getDevices() + .createOrUpdate( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + this.innerModel(), + Context.NONE); + return this; + } + + public Device create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDevices() + .createOrUpdate( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + this.innerModel(), + context); + return this; + } + + DeviceImpl(String name, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = new DeviceInner(); + this.serviceManager = serviceManager; + this.deviceName = name; + } + + public DeviceImpl update() { + this.updateProperties = new DeviceUpdate(); + return this; + } + + public Device apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDevices() + .update( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + updateProperties, + Context.NONE); + return this; + } + + public Device apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDevices() + .update( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + updateProperties, + context); + return this; + } + + DeviceImpl(DeviceInner innerObject, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.catalogName = Utils.getValueFromIdByName(innerObject.id(), "catalogs"); + this.productName = Utils.getValueFromIdByName(innerObject.id(), "products"); + this.deviceGroupName = Utils.getValueFromIdByName(innerObject.id(), "deviceGroups"); + this.deviceName = Utils.getValueFromIdByName(innerObject.id(), "devices"); + } + + public Device refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDevices() + .getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, Context.NONE) + .getValue(); + return this; + } + + public Device refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDevices() + .getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, context) + .getValue(); + return this; + } + + public SignedCapabilityImageResponse generateCapabilityImage( + GenerateCapabilityImageRequest generateDeviceCapabilityRequest) { + return serviceManager + .devices() + .generateCapabilityImage( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest); + } + + public SignedCapabilityImageResponse generateCapabilityImage( + GenerateCapabilityImageRequest generateDeviceCapabilityRequest, Context context) { + return serviceManager + .devices() + .generateCapabilityImage( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest, + context); + } + + public DeviceImpl withDeviceId(String deviceId) { + this.innerModel().withDeviceId(deviceId); + return this; + } + + public DeviceImpl withDeviceGroupId(String deviceGroupId) { + this.updateProperties.withDeviceGroupId(deviceGroupId); + return this; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceInsightImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceInsightImpl.java new file mode 100644 index 000000000000..8ad28a336131 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DeviceInsightImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.resourcemanager.sphere.fluent.models.DeviceInsightInner; +import com.azure.resourcemanager.sphere.models.DeviceInsight; +import java.time.OffsetDateTime; + +public final class DeviceInsightImpl implements DeviceInsight { + private DeviceInsightInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + DeviceInsightImpl( + DeviceInsightInner innerObject, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String deviceId() { + return this.innerModel().deviceId(); + } + + public String description() { + return this.innerModel().description(); + } + + public OffsetDateTime startTimestampUtc() { + return this.innerModel().startTimestampUtc(); + } + + public OffsetDateTime endTimestampUtc() { + return this.innerModel().endTimestampUtc(); + } + + public String eventCategory() { + return this.innerModel().eventCategory(); + } + + public String eventClass() { + return this.innerModel().eventClass(); + } + + public String eventType() { + return this.innerModel().eventType(); + } + + public int eventCount() { + return this.innerModel().eventCount(); + } + + public DeviceInsightInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DevicesClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DevicesClientImpl.java new file mode 100644 index 000000000000..ab9b3fdad973 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DevicesClientImpl.java @@ -0,0 +1,2266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.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.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +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.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.management.polling.PollResult; +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.sphere.fluent.DevicesClient; +import com.azure.resourcemanager.sphere.fluent.models.DeviceInner; +import com.azure.resourcemanager.sphere.fluent.models.SignedCapabilityImageResponseInner; +import com.azure.resourcemanager.sphere.models.DeviceListResult; +import com.azure.resourcemanager.sphere.models.DeviceUpdate; +import com.azure.resourcemanager.sphere.models.GenerateCapabilityImageRequest; +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 DevicesClient. */ +public final class DevicesClientImpl implements DevicesClient { + /** The proxy service used to perform REST calls. */ + private final DevicesService service; + + /** The service client containing this operation class. */ + private final AzureSphereManagementClientImpl client; + + /** + * Initializes an instance of DevicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DevicesClientImpl(AzureSphereManagementClientImpl client) { + this.service = RestProxy.create(DevicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureSphereManagementClientDevices to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureSphereManagemen") + public interface DevicesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDeviceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @PathParam("deviceName") String deviceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @PathParam("deviceName") String deviceName, + @BodyParam("application/json") DeviceInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @PathParam("deviceName") String deviceName, + @BodyParam("application/json") DeviceUpdate properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @PathParam("deviceName") String deviceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> generateCapabilityImage( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @PathParam("deviceGroupName") String deviceGroupName, + @PathParam("deviceName") String deviceName, + @BodyParam("application/json") GenerateCapabilityImageRequest generateDeviceCapabilityRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDeviceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + * for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 of a Device list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDeviceGroupSinglePageAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDeviceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + 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 Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + * for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 of a Device list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDeviceGroupSinglePageAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDeviceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + * for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 of a Device list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDeviceGroupAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + return new PagedFlux<>( + () -> listByDeviceGroupSinglePageAsync(resourceGroupName, catalogName, productName, deviceGroupName), + nextLink -> listByDeviceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + * for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 of a Device list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDeviceGroupAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + return new PagedFlux<>( + () -> + listByDeviceGroupSinglePageAsync(resourceGroupName, catalogName, productName, deviceGroupName, context), + nextLink -> listByDeviceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + * for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 of a Device list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + return new PagedIterable<>( + listByDeviceGroupAsync(resourceGroupName, catalogName, productName, deviceGroupName)); + } + + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + * for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 of a Device list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + return new PagedIterable<>( + listByDeviceGroupAsync(resourceGroupName, catalogName, productName, deviceGroupName, context)); + } + + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not + * belong to a device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 Device along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter deviceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not + * belong to a device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 Device along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter deviceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + accept, + context); + } + + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not + * belong to a device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 Device on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName) { + return getWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not + * belong to a device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 Device along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context) { + return getWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, context) + .block(); + } + + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not + * belong to a device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 Device. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceInner get( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName) { + return getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, Context.NONE) + .getValue(); + } + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter deviceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter deviceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + resource, + accept, + context); + } + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeviceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deviceName, resource); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DeviceInner.class, DeviceInner.class, this.client.getContext()); + } + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 PollerFlux} for polling of an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeviceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deviceName, resource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DeviceInner.class, DeviceInner.class, context); + } + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeviceInner> beginCreateOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource) { + return this + .beginCreateOrUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deviceName, resource) + .getSyncPoller(); + } + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeviceInner> beginCreateOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource, + Context context) { + return this + .beginCreateOrUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deviceName, resource, context) + .getSyncPoller(); + } + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource) { + return beginCreateOrUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deviceName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deviceName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceInner createOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource) { + return createOrUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, resource) + .block(); + } + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a device to the + * catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceInner createOrUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceInner resource, + Context context) { + return createOrUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deviceName, resource, context) + .block(); + } + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an device resource belonging to a device group resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter deviceName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @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 an device resource belonging to a device group resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter deviceName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + properties, + accept, + context); + } + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeviceInner> beginUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deviceName, properties); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DeviceInner.class, DeviceInner.class, this.client.getContext()); + } + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @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 PollerFlux} for polling of an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeviceInner> beginUpdateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deviceName, properties, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DeviceInner.class, DeviceInner.class, context); + } + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeviceInner> beginUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties) { + return this + .beginUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, properties) + .getSyncPoller(); + } + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeviceInner> beginUpdate( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties, + Context context) { + return this + .beginUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deviceName, properties, context) + .getSyncPoller(); + } + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an device resource belonging to a device group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties) { + return beginUpdateAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, properties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @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 an device resource belonging to a device group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties, + Context context) { + return beginUpdateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deviceName, properties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceInner update( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties) { + return updateAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, properties) + .block(); + } + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a device to the + * catalog level. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param properties The resource properties to be updated. + * @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 an device resource belonging to a device group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeviceInner update( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + DeviceUpdate properties, + Context context) { + return updateAsync( + resourceGroupName, catalogName, productName, deviceGroupName, deviceName, properties, context) + .block(); + } + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter deviceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter deviceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + accept, + context); + } + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName) { + return this + .beginDeleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName) + .getSyncPoller(); + } + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context) { + return this + .beginDeleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, context) + .getSyncPoller(); + } + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName) { + return beginDeleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context) { + return beginDeleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName) { + deleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName).block(); + } + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context) { + deleteAsync(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, context).block(); + } + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> generateCapabilityImageWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter deviceName is required and cannot be null.")); + } + if (generateDeviceCapabilityRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter generateDeviceCapabilityRequest is required and cannot be null.")); + } else { + generateDeviceCapabilityRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .generateCapabilityImage( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> generateCapabilityImageWithResponseAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (deviceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deviceGroupName is required and cannot be null.")); + } + if (deviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter deviceName is required and cannot be null.")); + } + if (generateDeviceCapabilityRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter generateDeviceCapabilityRequest is required and cannot be null.")); + } else { + generateDeviceCapabilityRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .generateCapabilityImage( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest, + accept, + context); + } + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SignedCapabilityImageResponseInner> + beginGenerateCapabilityImageAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest) { + Mono>> mono = + generateCapabilityImageWithResponseAsync( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SignedCapabilityImageResponseInner.class, + SignedCapabilityImageResponseInner.class, + this.client.getContext()); + } + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 PollerFlux} for polling of signed device capability image response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SignedCapabilityImageResponseInner> + beginGenerateCapabilityImageAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + generateCapabilityImageWithResponseAsync( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SignedCapabilityImageResponseInner.class, + SignedCapabilityImageResponseInner.class, + context); + } + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SignedCapabilityImageResponseInner> + beginGenerateCapabilityImage( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest) { + return this + .beginGenerateCapabilityImageAsync( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest) + .getSyncPoller(); + } + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SignedCapabilityImageResponseInner> + beginGenerateCapabilityImage( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest, + Context context) { + return this + .beginGenerateCapabilityImageAsync( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest, + context) + .getSyncPoller(); + } + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateCapabilityImageAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest) { + return beginGenerateCapabilityImageAsync( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateCapabilityImageAsync( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest, + Context context) { + return beginGenerateCapabilityImageAsync( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SignedCapabilityImageResponseInner generateCapabilityImage( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest) { + return generateCapabilityImageAsync( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest) + .block(); + } + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SignedCapabilityImageResponseInner generateCapabilityImage( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest, + Context context) { + return generateCapabilityImageAsync( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest, + context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 of a Device list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDeviceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDeviceGroupNext(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 + *

The nextLink parameter. + * @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 of a Device list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDeviceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDeviceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DevicesImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DevicesImpl.java new file mode 100644 index 000000000000..2da011f018f7 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/DevicesImpl.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.DevicesClient; +import com.azure.resourcemanager.sphere.fluent.models.DeviceInner; +import com.azure.resourcemanager.sphere.fluent.models.SignedCapabilityImageResponseInner; +import com.azure.resourcemanager.sphere.models.Device; +import com.azure.resourcemanager.sphere.models.Devices; +import com.azure.resourcemanager.sphere.models.GenerateCapabilityImageRequest; +import com.azure.resourcemanager.sphere.models.SignedCapabilityImageResponse; + +public final class DevicesImpl implements Devices { + private static final ClientLogger LOGGER = new ClientLogger(DevicesImpl.class); + + private final DevicesClient innerClient; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public DevicesImpl(DevicesClient innerClient, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName) { + PagedIterable inner = + this.serviceClient().listByDeviceGroup(resourceGroupName, catalogName, productName, deviceGroupName); + return Utils.mapPage(inner, inner1 -> new DeviceImpl(inner1, this.manager())); + } + + public PagedIterable listByDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDeviceGroup(resourceGroupName, catalogName, productName, deviceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DeviceImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeviceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Device get( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName) { + DeviceInner inner = + this.serviceClient().get(resourceGroupName, catalogName, productName, deviceGroupName, deviceName); + if (inner != null) { + return new DeviceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName) { + this.serviceClient().delete(resourceGroupName, catalogName, productName, deviceGroupName, deviceName); + } + + public void delete( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context) { + this.serviceClient().delete(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, context); + } + + public SignedCapabilityImageResponse generateCapabilityImage( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest) { + SignedCapabilityImageResponseInner inner = + this + .serviceClient() + .generateCapabilityImage( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest); + if (inner != null) { + return new SignedCapabilityImageResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public SignedCapabilityImageResponse generateCapabilityImage( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest, + Context context) { + SignedCapabilityImageResponseInner inner = + this + .serviceClient() + .generateCapabilityImage( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest, + context); + if (inner != null) { + return new SignedCapabilityImageResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Device getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + String deviceGroupName = Utils.getValueFromIdByName(id, "deviceGroups"); + if (deviceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deviceGroups'.", id))); + } + String deviceName = Utils.getValueFromIdByName(id, "devices"); + if (deviceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devices'.", id))); + } + return this + .getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + String deviceGroupName = Utils.getValueFromIdByName(id, "deviceGroups"); + if (deviceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deviceGroups'.", id))); + } + String deviceName = Utils.getValueFromIdByName(id, "devices"); + if (deviceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devices'.", id))); + } + return this.getWithResponse(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + String deviceGroupName = Utils.getValueFromIdByName(id, "deviceGroups"); + if (deviceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deviceGroups'.", id))); + } + String deviceName = Utils.getValueFromIdByName(id, "devices"); + if (deviceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devices'.", id))); + } + this.delete(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + String deviceGroupName = Utils.getValueFromIdByName(id, "deviceGroups"); + if (deviceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'deviceGroups'.", id))); + } + String deviceName = Utils.getValueFromIdByName(id, "devices"); + if (deviceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'devices'.", id))); + } + this.delete(resourceGroupName, catalogName, productName, deviceGroupName, deviceName, context); + } + + private DevicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } + + public DeviceImpl define(String name) { + return new DeviceImpl(name, this.manager()); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImageImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImageImpl.java new file mode 100644 index 000000000000..a1d69b14dd2a --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImageImpl.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.ImageInner; +import com.azure.resourcemanager.sphere.models.Image; +import com.azure.resourcemanager.sphere.models.ImageType; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import com.azure.resourcemanager.sphere.models.RegionalDataBoundary; + +public final class ImageImpl implements Image, Image.Definition, Image.Update { + private ImageInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String image() { + return this.innerModel().image(); + } + + public String imageId() { + return this.innerModel().imageId(); + } + + public String imageName() { + return this.innerModel().imageName(); + } + + public RegionalDataBoundary regionalDataBoundary() { + return this.innerModel().regionalDataBoundary(); + } + + public String uri() { + return this.innerModel().uri(); + } + + public String description() { + return this.innerModel().description(); + } + + public String componentId() { + return this.innerModel().componentId(); + } + + public ImageType imageType() { + return this.innerModel().imageType(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ImageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String catalogName; + + private String imageName; + + public ImageImpl withExistingCatalog(String resourceGroupName, String catalogName) { + this.resourceGroupName = resourceGroupName; + this.catalogName = catalogName; + return this; + } + + public Image create() { + this.innerObject = + serviceManager + .serviceClient() + .getImages() + .createOrUpdate(resourceGroupName, catalogName, imageName, this.innerModel(), Context.NONE); + return this; + } + + public Image create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getImages() + .createOrUpdate(resourceGroupName, catalogName, imageName, this.innerModel(), context); + return this; + } + + ImageImpl(String name, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = new ImageInner(); + this.serviceManager = serviceManager; + this.imageName = name; + } + + public ImageImpl update() { + return this; + } + + public Image apply() { + this.innerObject = + serviceManager + .serviceClient() + .getImages() + .createOrUpdate(resourceGroupName, catalogName, imageName, this.innerModel(), Context.NONE); + return this; + } + + public Image apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getImages() + .createOrUpdate(resourceGroupName, catalogName, imageName, this.innerModel(), context); + return this; + } + + ImageImpl(ImageInner innerObject, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.catalogName = Utils.getValueFromIdByName(innerObject.id(), "catalogs"); + this.imageName = Utils.getValueFromIdByName(innerObject.id(), "images"); + } + + public Image refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getImages() + .getWithResponse(resourceGroupName, catalogName, imageName, Context.NONE) + .getValue(); + return this; + } + + public Image refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getImages() + .getWithResponse(resourceGroupName, catalogName, imageName, context) + .getValue(); + return this; + } + + public ImageImpl withImage(String image) { + this.innerModel().withImage(image); + return this; + } + + public ImageImpl withImageId(String imageId) { + this.innerModel().withImageId(imageId); + return this; + } + + public ImageImpl withRegionalDataBoundary(RegionalDataBoundary regionalDataBoundary) { + this.innerModel().withRegionalDataBoundary(regionalDataBoundary); + return this; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImagesClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImagesClientImpl.java new file mode 100644 index 000000000000..fa5d3497afd0 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImagesClientImpl.java @@ -0,0 +1,1161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.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.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.management.polling.PollResult; +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.sphere.fluent.ImagesClient; +import com.azure.resourcemanager.sphere.fluent.models.ImageInner; +import com.azure.resourcemanager.sphere.models.ImageListResult; +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 ImagesClient. */ +public final class ImagesClientImpl implements ImagesClient { + /** The proxy service used to perform REST calls. */ + private final ImagesService service; + + /** The service client containing this operation class. */ + private final AzureSphereManagementClientImpl client; + + /** + * Initializes an instance of ImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ImagesClientImpl(AzureSphereManagementClientImpl client) { + this.service = RestProxy.create(ImagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureSphereManagementClientImages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureSphereManagemen") + public interface ImagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCatalog( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, + @QueryParam("$maxpagesize") Integer maxpagesize, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("imageName") String imageName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("imageName") String imageName, + @BodyParam("application/json") ImageInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("imageName") String imageName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCatalogNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List Image resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Image list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCatalogSinglePageAsync( + String resourceGroupName, String catalogName, String filter, Integer top, Integer skip, Integer maxpagesize) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCatalog( + this.client.getEndpoint(), + filter, + top, + skip, + maxpagesize, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + 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 Image resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Image list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCatalogSinglePageAsync( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCatalog( + this.client.getEndpoint(), + filter, + top, + skip, + maxpagesize, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Image resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Image list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCatalogAsync( + String resourceGroupName, String catalogName, String filter, Integer top, Integer skip, Integer maxpagesize) { + return new PagedFlux<>( + () -> listByCatalogSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize), + nextLink -> listByCatalogNextSinglePageAsync(nextLink)); + } + + /** + * List Image resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Image list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCatalogAsync(String resourceGroupName, String catalogName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedFlux<>( + () -> listByCatalogSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize), + nextLink -> listByCatalogNextSinglePageAsync(nextLink)); + } + + /** + * List Image resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Image list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCatalogAsync( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedFlux<>( + () -> listByCatalogSinglePageAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context), + nextLink -> listByCatalogNextSinglePageAsync(nextLink, context)); + } + + /** + * List Image resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Image list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCatalog(String resourceGroupName, String catalogName) { + final String filter = null; + final Integer top = null; + final Integer skip = null; + final Integer maxpagesize = null; + return new PagedIterable<>(listByCatalogAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize)); + } + + /** + * List Image resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 of a Image list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCatalog( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + return new PagedIterable<>( + listByCatalogAsync(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context)); + } + + /** + * Get a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 Image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String catalogName, String imageName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + imageName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 Image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String catalogName, String imageName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + imageName, + accept, + context); + } + + /** + * Get a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 Image on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String catalogName, String imageName) { + return getWithResponseAsync(resourceGroupName, catalogName, imageName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 Image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String catalogName, String imageName, Context context) { + return getWithResponseAsync(resourceGroupName, catalogName, imageName, context).block(); + } + + /** + * Get a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 Image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageInner get(String resourceGroupName, String catalogName, String imageName) { + return getWithResponse(resourceGroupName, catalogName, imageName, Context.NONE).getValue(); + } + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String catalogName, String imageName, ImageInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + imageName, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String catalogName, String imageName, ImageInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + imageName, + resource, + accept, + context); + } + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ImageInner> beginCreateOrUpdateAsync( + String resourceGroupName, String catalogName, String imageName, ImageInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, catalogName, imageName, resource); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ImageInner.class, ImageInner.class, this.client.getContext()); + } + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 PollerFlux} for polling of an image resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ImageInner> beginCreateOrUpdateAsync( + String resourceGroupName, String catalogName, String imageName, ImageInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, catalogName, imageName, resource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ImageInner.class, ImageInner.class, context); + } + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ImageInner> beginCreateOrUpdate( + String resourceGroupName, String catalogName, String imageName, ImageInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, catalogName, imageName, resource).getSyncPoller(); + } + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ImageInner> beginCreateOrUpdate( + String resourceGroupName, String catalogName, String imageName, ImageInner resource, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, catalogName, imageName, resource, context) + .getSyncPoller(); + } + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String catalogName, String imageName, ImageInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, catalogName, imageName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String catalogName, String imageName, ImageInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, catalogName, imageName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageInner createOrUpdate( + String resourceGroupName, String catalogName, String imageName, ImageInner resource) { + return createOrUpdateAsync(resourceGroupName, catalogName, imageName, resource).block(); + } + + /** + * Create a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 an image resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageInner createOrUpdate( + String resourceGroupName, String catalogName, String imageName, ImageInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, catalogName, imageName, resource, context).block(); + } + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + imageName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String catalogName, String imageName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (imageName == null) { + return Mono.error(new IllegalArgumentException("Parameter imageName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + imageName, + accept, + context); + } + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, catalogName, imageName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String catalogName, String imageName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, catalogName, imageName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName) { + return this.beginDeleteAsync(resourceGroupName, catalogName, imageName).getSyncPoller(); + } + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName, Context context) { + return this.beginDeleteAsync(resourceGroupName, catalogName, imageName, context).getSyncPoller(); + } + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName) { + return beginDeleteAsync(resourceGroupName, catalogName, imageName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String catalogName, String imageName, Context context) { + return beginDeleteAsync(resourceGroupName, catalogName, imageName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName) { + deleteAsync(resourceGroupName, catalogName, imageName).block(); + } + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName, Context context) { + deleteAsync(resourceGroupName, catalogName, imageName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 of a Image list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCatalogNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByCatalogNext(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 + *

The nextLink parameter. + * @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 of a Image list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCatalogNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCatalogNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImagesImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImagesImpl.java new file mode 100644 index 000000000000..827d4f6b672f --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ImagesImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.ImagesClient; +import com.azure.resourcemanager.sphere.fluent.models.ImageInner; +import com.azure.resourcemanager.sphere.models.Image; +import com.azure.resourcemanager.sphere.models.Images; + +public final class ImagesImpl implements Images { + private static final ClientLogger LOGGER = new ClientLogger(ImagesImpl.class); + + private final ImagesClient innerClient; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public ImagesImpl(ImagesClient innerClient, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCatalog(String resourceGroupName, String catalogName) { + PagedIterable inner = this.serviceClient().listByCatalog(resourceGroupName, catalogName); + return Utils.mapPage(inner, inner1 -> new ImageImpl(inner1, this.manager())); + } + + public PagedIterable listByCatalog( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context) { + PagedIterable inner = + this.serviceClient().listByCatalog(resourceGroupName, catalogName, filter, top, skip, maxpagesize, context); + return Utils.mapPage(inner, inner1 -> new ImageImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String catalogName, String imageName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, catalogName, imageName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ImageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Image get(String resourceGroupName, String catalogName, String imageName) { + ImageInner inner = this.serviceClient().get(resourceGroupName, catalogName, imageName); + if (inner != null) { + return new ImageImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String catalogName, String imageName) { + this.serviceClient().delete(resourceGroupName, catalogName, imageName); + } + + public void delete(String resourceGroupName, String catalogName, String imageName, Context context) { + this.serviceClient().delete(resourceGroupName, catalogName, imageName, context); + } + + public Image getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String imageName = Utils.getValueFromIdByName(id, "images"); + if (imageName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + return this.getWithResponse(resourceGroupName, catalogName, imageName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String imageName = Utils.getValueFromIdByName(id, "images"); + if (imageName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + return this.getWithResponse(resourceGroupName, catalogName, imageName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String imageName = Utils.getValueFromIdByName(id, "images"); + if (imageName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + this.delete(resourceGroupName, catalogName, imageName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String imageName = Utils.getValueFromIdByName(id, "images"); + if (imageName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'images'.", id))); + } + this.delete(resourceGroupName, catalogName, imageName, context); + } + + private ImagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } + + public ImageImpl define(String name) { + return new ImageImpl(name, this.manager()); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationImpl.java new file mode 100644 index 000000000000..eb1c440b1b19 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.resourcemanager.sphere.fluent.models.OperationInner; +import com.azure.resourcemanager.sphere.models.ActionType; +import com.azure.resourcemanager.sphere.models.Operation; +import com.azure.resourcemanager.sphere.models.OperationDisplay; +import com.azure.resourcemanager.sphere.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.sphere.AzureSphereManager 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.sphere.AzureSphereManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationsClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..ddee369b0405 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationsClientImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.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.sphere.fluent.OperationsClient; +import com.azure.resourcemanager.sphere.fluent.models.OperationInner; +import com.azure.resourcemanager.sphere.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 AzureSphereManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(AzureSphereManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureSphereManagementClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureSphereManagemen") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.AzureSphere/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") 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("$host") 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() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * + * @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} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * + * @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 + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, 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 as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * 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<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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 + *

The nextLink parameter. + * @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} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationsImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationsImpl.java new file mode 100644 index 000000000000..6ae70f084153 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.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.sphere.fluent.OperationsClient; +import com.azure.resourcemanager.sphere.fluent.models.OperationInner; +import com.azure.resourcemanager.sphere.models.Operation; +import com.azure.resourcemanager.sphere.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.sphere.AzureSphereManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductImpl.java new file mode 100644 index 000000000000..26314d6c9732 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.ProductInner; +import com.azure.resourcemanager.sphere.models.CountDeviceResponse; +import com.azure.resourcemanager.sphere.models.DeviceGroup; +import com.azure.resourcemanager.sphere.models.Product; +import com.azure.resourcemanager.sphere.models.ProductUpdate; +import com.azure.resourcemanager.sphere.models.ProvisioningState; + +public final class ProductImpl implements Product, Product.Definition, Product.Update { + private ProductInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String description() { + return this.innerModel().description(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ProductInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String catalogName; + + private String productName; + + private ProductUpdate updateProperties; + + public ProductImpl withExistingCatalog(String resourceGroupName, String catalogName) { + this.resourceGroupName = resourceGroupName; + this.catalogName = catalogName; + return this; + } + + public Product create() { + this.innerObject = + serviceManager + .serviceClient() + .getProducts() + .createOrUpdate(resourceGroupName, catalogName, productName, this.innerModel(), Context.NONE); + return this; + } + + public Product create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProducts() + .createOrUpdate(resourceGroupName, catalogName, productName, this.innerModel(), context); + return this; + } + + ProductImpl(String name, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = new ProductInner(); + this.serviceManager = serviceManager; + this.productName = name; + } + + public ProductImpl update() { + this.updateProperties = new ProductUpdate(); + return this; + } + + public Product apply() { + this.innerObject = + serviceManager + .serviceClient() + .getProducts() + .update(resourceGroupName, catalogName, productName, updateProperties, Context.NONE); + return this; + } + + public Product apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProducts() + .update(resourceGroupName, catalogName, productName, updateProperties, context); + return this; + } + + ProductImpl(ProductInner innerObject, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.catalogName = Utils.getValueFromIdByName(innerObject.id(), "catalogs"); + this.productName = Utils.getValueFromIdByName(innerObject.id(), "products"); + } + + public Product refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getProducts() + .getWithResponse(resourceGroupName, catalogName, productName, Context.NONE) + .getValue(); + return this; + } + + public Product refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getProducts() + .getWithResponse(resourceGroupName, catalogName, productName, context) + .getValue(); + return this; + } + + public Response countDevicesWithResponse(Context context) { + return serviceManager.products().countDevicesWithResponse(resourceGroupName, catalogName, productName, context); + } + + public CountDeviceResponse countDevices() { + return serviceManager.products().countDevices(resourceGroupName, catalogName, productName); + } + + public PagedIterable generateDefaultDeviceGroups() { + return serviceManager.products().generateDefaultDeviceGroups(resourceGroupName, catalogName, productName); + } + + public PagedIterable generateDefaultDeviceGroups(Context context) { + return serviceManager + .products() + .generateDefaultDeviceGroups(resourceGroupName, catalogName, productName, context); + } + + public ProductImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateProperties.withDescription(description); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductsClientImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductsClientImpl.java new file mode 100644 index 000000000000..1a9ea5f50753 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductsClientImpl.java @@ -0,0 +1,1873 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.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.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +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.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.management.polling.PollResult; +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.sphere.fluent.ProductsClient; +import com.azure.resourcemanager.sphere.fluent.models.CountDeviceResponseInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner; +import com.azure.resourcemanager.sphere.fluent.models.ProductInner; +import com.azure.resourcemanager.sphere.models.DeviceGroupListResult; +import com.azure.resourcemanager.sphere.models.ProductListResult; +import com.azure.resourcemanager.sphere.models.ProductUpdate; +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 ProductsClient. */ +public final class ProductsClientImpl implements ProductsClient { + /** The proxy service used to perform REST calls. */ + private final ProductsService service; + + /** The service client containing this operation class. */ + private final AzureSphereManagementClientImpl client; + + /** + * Initializes an instance of ProductsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProductsClientImpl(AzureSphereManagementClientImpl client) { + this.service = RestProxy.create(ProductsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureSphereManagementClientProducts to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureSphereManagemen") + public interface ProductsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCatalog( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @BodyParam("application/json") ProductInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @BodyParam("application/json") ProductUpdate properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/countDevices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> countDevices( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/generateDefaultDeviceGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> generateDefaultDeviceGroups( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("catalogName") String catalogName, + @PathParam("productName") String productName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCatalogNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> generateDefaultDeviceGroupsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List Product resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Product list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCatalogSinglePageAsync( + String resourceGroupName, String catalogName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCatalog( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + 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 Product resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Product list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCatalogSinglePageAsync( + String resourceGroupName, String catalogName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCatalog( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Product resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Product list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCatalogAsync(String resourceGroupName, String catalogName) { + return new PagedFlux<>( + () -> listByCatalogSinglePageAsync(resourceGroupName, catalogName), + nextLink -> listByCatalogNextSinglePageAsync(nextLink)); + } + + /** + * List Product resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Product list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCatalogAsync(String resourceGroupName, String catalogName, Context context) { + return new PagedFlux<>( + () -> listByCatalogSinglePageAsync(resourceGroupName, catalogName, context), + nextLink -> listByCatalogNextSinglePageAsync(nextLink, context)); + } + + /** + * List Product resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Product list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCatalog(String resourceGroupName, String catalogName) { + return new PagedIterable<>(listByCatalogAsync(resourceGroupName, catalogName)); + } + + /** + * List Product resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 of a Product list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCatalog(String resourceGroupName, String catalogName, Context context) { + return new PagedIterable<>(listByCatalogAsync(resourceGroupName, catalogName, context)); + } + + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 Product along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String catalogName, String productName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 Product along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String catalogName, String productName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + accept, + context); + } + + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 Product on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String catalogName, String productName) { + return getWithResponseAsync(resourceGroupName, catalogName, productName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 Product along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String catalogName, String productName, Context context) { + return getWithResponseAsync(resourceGroupName, catalogName, productName, context).block(); + } + + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 Product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProductInner get(String resourceGroupName, String catalogName, String productName) { + return getWithResponse(resourceGroupName, catalogName, productName, Context.NONE).getValue(); + } + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String catalogName, String productName, ProductInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String catalogName, String productName, ProductInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + resource, + accept, + context); + } + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProductInner> beginCreateOrUpdateAsync( + String resourceGroupName, String catalogName, String productName, ProductInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, catalogName, productName, resource); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ProductInner.class, ProductInner.class, this.client.getContext()); + } + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 PollerFlux} for polling of an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProductInner> beginCreateOrUpdateAsync( + String resourceGroupName, String catalogName, String productName, ProductInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, catalogName, productName, resource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ProductInner.class, ProductInner.class, context); + } + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProductInner> beginCreateOrUpdate( + String resourceGroupName, String catalogName, String productName, ProductInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, catalogName, productName, resource).getSyncPoller(); + } + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProductInner> beginCreateOrUpdate( + String resourceGroupName, String catalogName, String productName, ProductInner resource, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, catalogName, productName, resource, context) + .getSyncPoller(); + } + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String catalogName, String productName, ProductInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, catalogName, productName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String catalogName, String productName, ProductInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, catalogName, productName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProductInner createOrUpdate( + String resourceGroupName, String catalogName, String productName, ProductInner resource) { + return createOrUpdateAsync(resourceGroupName, catalogName, productName, resource).block(); + } + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProductInner createOrUpdate( + String resourceGroupName, String catalogName, String productName, ProductInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, catalogName, productName, resource, context).block(); + } + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an product resource belonging to a catalog resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @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 an product resource belonging to a catalog resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + properties, + accept, + context); + } + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProductInner> beginUpdateAsync( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, catalogName, productName, properties); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ProductInner.class, ProductInner.class, this.client.getContext()); + } + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @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 PollerFlux} for polling of an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProductInner> beginUpdateAsync( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, catalogName, productName, properties, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ProductInner.class, ProductInner.class, context); + } + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProductInner> beginUpdate( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, catalogName, productName, properties).getSyncPoller(); + } + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProductInner> beginUpdate( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, catalogName, productName, properties, context).getSyncPoller(); + } + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an product resource belonging to a catalog resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties) { + return beginUpdateAsync(resourceGroupName, catalogName, productName, properties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @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 an product resource belonging to a catalog resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, catalogName, productName, properties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProductInner update( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties) { + return updateAsync(resourceGroupName, catalogName, productName, properties).block(); + } + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @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 an product resource belonging to a catalog resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProductInner update( + String resourceGroupName, String catalogName, String productName, ProductUpdate properties, Context context) { + return updateAsync(resourceGroupName, catalogName, productName, properties, context).block(); + } + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String catalogName, String productName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + accept, + context); + } + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, catalogName, productName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String catalogName, String productName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, catalogName, productName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName) { + return this.beginDeleteAsync(resourceGroupName, catalogName, productName).getSyncPoller(); + } + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName, Context context) { + return this.beginDeleteAsync(resourceGroupName, catalogName, productName, context).getSyncPoller(); + } + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName) { + return beginDeleteAsync(resourceGroupName, catalogName, productName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String catalogName, String productName, Context context) { + return beginDeleteAsync(resourceGroupName, catalogName, productName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName) { + deleteAsync(resourceGroupName, catalogName, productName).block(); + } + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName, Context context) { + deleteAsync(resourceGroupName, catalogName, productName, context).block(); + } + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response to the action call for count devices in a catalog along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> countDevicesWithResponseAsync( + String resourceGroupName, String catalogName, String productName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .countDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response to the action call for count devices in a catalog along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> countDevicesWithResponseAsync( + String resourceGroupName, String catalogName, String productName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .countDevices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + accept, + context); + } + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response to the action call for count devices in a catalog on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono countDevicesAsync( + String resourceGroupName, String catalogName, String productName) { + return countDevicesWithResponseAsync(resourceGroupName, catalogName, productName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response to the action call for count devices in a catalog along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response countDevicesWithResponse( + String resourceGroupName, String catalogName, String productName, Context context) { + return countDevicesWithResponseAsync(resourceGroupName, catalogName, productName, context).block(); + } + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response to the action call for count devices in a catalog. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CountDeviceResponseInner countDevices(String resourceGroupName, String catalogName, String productName) { + return countDevicesWithResponse(resourceGroupName, catalogName, productName, Context.NONE).getValue(); + } + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 of a DeviceGroup list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateDefaultDeviceGroupsSinglePageAsync( + String resourceGroupName, String catalogName, String productName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .generateDefaultDeviceGroups( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + 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())); + } + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 of a DeviceGroup list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateDefaultDeviceGroupsSinglePageAsync( + String resourceGroupName, String catalogName, String productName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (catalogName == null) { + return Mono.error(new IllegalArgumentException("Parameter catalogName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .generateDefaultDeviceGroups( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + catalogName, + productName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux generateDefaultDeviceGroupsAsync( + String resourceGroupName, String catalogName, String productName) { + return new PagedFlux<>( + () -> generateDefaultDeviceGroupsSinglePageAsync(resourceGroupName, catalogName, productName), + nextLink -> generateDefaultDeviceGroupsNextSinglePageAsync(nextLink)); + } + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux generateDefaultDeviceGroupsAsync( + String resourceGroupName, String catalogName, String productName, Context context) { + return new PagedFlux<>( + () -> generateDefaultDeviceGroupsSinglePageAsync(resourceGroupName, catalogName, productName, context), + nextLink -> generateDefaultDeviceGroupsNextSinglePageAsync(nextLink, context)); + } + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable generateDefaultDeviceGroups( + String resourceGroupName, String catalogName, String productName) { + return new PagedIterable<>(generateDefaultDeviceGroupsAsync(resourceGroupName, catalogName, productName)); + } + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable generateDefaultDeviceGroups( + String resourceGroupName, String catalogName, String productName, Context context) { + return new PagedIterable<>( + generateDefaultDeviceGroupsAsync(resourceGroupName, catalogName, productName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 of a Product list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCatalogNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByCatalogNext(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 + *

The nextLink parameter. + * @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 of a Product list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCatalogNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCatalogNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + 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 + *

The nextLink parameter. + * @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 of a DeviceGroup list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateDefaultDeviceGroupsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.generateDefaultDeviceGroupsNext(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 + *

The nextLink parameter. + * @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 of a DeviceGroup list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateDefaultDeviceGroupsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .generateDefaultDeviceGroupsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductsImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductsImpl.java new file mode 100644 index 000000000000..c58e2369b00c --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProductsImpl.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.core.http.rest.PagedIterable; +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.sphere.fluent.ProductsClient; +import com.azure.resourcemanager.sphere.fluent.models.CountDeviceResponseInner; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner; +import com.azure.resourcemanager.sphere.fluent.models.ProductInner; +import com.azure.resourcemanager.sphere.models.CountDeviceResponse; +import com.azure.resourcemanager.sphere.models.DeviceGroup; +import com.azure.resourcemanager.sphere.models.Product; +import com.azure.resourcemanager.sphere.models.Products; + +public final class ProductsImpl implements Products { + private static final ClientLogger LOGGER = new ClientLogger(ProductsImpl.class); + + private final ProductsClient innerClient; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + public ProductsImpl( + ProductsClient innerClient, com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCatalog(String resourceGroupName, String catalogName) { + PagedIterable inner = this.serviceClient().listByCatalog(resourceGroupName, catalogName); + return Utils.mapPage(inner, inner1 -> new ProductImpl(inner1, this.manager())); + } + + public PagedIterable listByCatalog(String resourceGroupName, String catalogName, Context context) { + PagedIterable inner = this.serviceClient().listByCatalog(resourceGroupName, catalogName, context); + return Utils.mapPage(inner, inner1 -> new ProductImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String catalogName, String productName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, catalogName, productName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProductImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Product get(String resourceGroupName, String catalogName, String productName) { + ProductInner inner = this.serviceClient().get(resourceGroupName, catalogName, productName); + if (inner != null) { + return new ProductImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String catalogName, String productName) { + this.serviceClient().delete(resourceGroupName, catalogName, productName); + } + + public void delete(String resourceGroupName, String catalogName, String productName, Context context) { + this.serviceClient().delete(resourceGroupName, catalogName, productName, context); + } + + public Response countDevicesWithResponse( + String resourceGroupName, String catalogName, String productName, Context context) { + Response inner = + this.serviceClient().countDevicesWithResponse(resourceGroupName, catalogName, productName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CountDeviceResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CountDeviceResponse countDevices(String resourceGroupName, String catalogName, String productName) { + CountDeviceResponseInner inner = this.serviceClient().countDevices(resourceGroupName, catalogName, productName); + if (inner != null) { + return new CountDeviceResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable generateDefaultDeviceGroups( + String resourceGroupName, String catalogName, String productName) { + PagedIterable inner = + this.serviceClient().generateDefaultDeviceGroups(resourceGroupName, catalogName, productName); + return Utils.mapPage(inner, inner1 -> new DeviceGroupImpl(inner1, this.manager())); + } + + public PagedIterable generateDefaultDeviceGroups( + String resourceGroupName, String catalogName, String productName, Context context) { + PagedIterable inner = + this.serviceClient().generateDefaultDeviceGroups(resourceGroupName, catalogName, productName, context); + return Utils.mapPage(inner, inner1 -> new DeviceGroupImpl(inner1, this.manager())); + } + + public Product getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + return this.getWithResponse(resourceGroupName, catalogName, productName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + return this.getWithResponse(resourceGroupName, catalogName, productName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + this.delete(resourceGroupName, catalogName, productName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String catalogName = Utils.getValueFromIdByName(id, "catalogs"); + if (catalogName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'catalogs'.", id))); + } + String productName = Utils.getValueFromIdByName(id, "products"); + if (productName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'products'.", id))); + } + this.delete(resourceGroupName, catalogName, productName, context); + } + + private ProductsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } + + public ProductImpl define(String name) { + return new ProductImpl(name, this.manager()); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProofOfPossessionNonceResponseImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProofOfPossessionNonceResponseImpl.java new file mode 100644 index 000000000000..ac1feb2ee3e3 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/ProofOfPossessionNonceResponseImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.resourcemanager.sphere.fluent.models.ProofOfPossessionNonceResponseInner; +import com.azure.resourcemanager.sphere.models.CertificateStatus; +import com.azure.resourcemanager.sphere.models.ProofOfPossessionNonceResponse; +import com.azure.resourcemanager.sphere.models.ProvisioningState; +import java.time.OffsetDateTime; + +public final class ProofOfPossessionNonceResponseImpl implements ProofOfPossessionNonceResponse { + private ProofOfPossessionNonceResponseInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + ProofOfPossessionNonceResponseImpl( + ProofOfPossessionNonceResponseInner innerObject, + com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String certificate() { + return this.innerModel().certificate(); + } + + public CertificateStatus status() { + return this.innerModel().status(); + } + + public String subject() { + return this.innerModel().subject(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public OffsetDateTime expiryUtc() { + return this.innerModel().expiryUtc(); + } + + public OffsetDateTime notBeforeUtc() { + return this.innerModel().notBeforeUtc(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public ProofOfPossessionNonceResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/SignedCapabilityImageResponseImpl.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/SignedCapabilityImageResponseImpl.java new file mode 100644 index 000000000000..95d73dc3ec3e --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/SignedCapabilityImageResponseImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.implementation; + +import com.azure.resourcemanager.sphere.fluent.models.SignedCapabilityImageResponseInner; +import com.azure.resourcemanager.sphere.models.SignedCapabilityImageResponse; + +public final class SignedCapabilityImageResponseImpl implements SignedCapabilityImageResponse { + private SignedCapabilityImageResponseInner innerObject; + + private final com.azure.resourcemanager.sphere.AzureSphereManager serviceManager; + + SignedCapabilityImageResponseImpl( + SignedCapabilityImageResponseInner innerObject, + com.azure.resourcemanager.sphere.AzureSphereManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String image() { + return this.innerModel().image(); + } + + public SignedCapabilityImageResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sphere.AzureSphereManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/Utils.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/Utils.java new file mode 100644 index 000000000000..505f4413ce8d --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.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 Utils { + 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.size() > 0 && 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, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + 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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/package-info.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/package-info.java new file mode 100644 index 000000000000..0f24134af586 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for AzureSphereManagementClient. Azure Sphere resource management API. */ +package com.azure.resourcemanager.sphere.implementation; diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ActionType.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ActionType.java new file mode 100644 index 000000000000..16187bc8760c --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ActionType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + 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. + */ + @JsonCreator + 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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/AllowCrashDumpCollection.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/AllowCrashDumpCollection.java new file mode 100644 index 000000000000..421f6c355637 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/AllowCrashDumpCollection.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Allow crash dumps values. */ +public final class AllowCrashDumpCollection extends ExpandableStringEnum { + /** Static value Enabled for AllowCrashDumpCollection. */ + public static final AllowCrashDumpCollection ENABLED = fromString("Enabled"); + + /** Static value Disabled for AllowCrashDumpCollection. */ + public static final AllowCrashDumpCollection DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of AllowCrashDumpCollection value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AllowCrashDumpCollection() { + } + + /** + * Creates or finds a AllowCrashDumpCollection from its string representation. + * + * @param name a name to look for. + * @return the corresponding AllowCrashDumpCollection. + */ + @JsonCreator + public static AllowCrashDumpCollection fromString(String name) { + return fromString(name, AllowCrashDumpCollection.class); + } + + /** + * Gets known AllowCrashDumpCollection values. + * + * @return known AllowCrashDumpCollection values. + */ + public static Collection values() { + return values(AllowCrashDumpCollection.class); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CapabilityType.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CapabilityType.java new file mode 100644 index 000000000000..20606302764a --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CapabilityType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Capability image type. */ +public final class CapabilityType extends ExpandableStringEnum { + /** Static value ApplicationDevelopment for CapabilityType. */ + public static final CapabilityType APPLICATION_DEVELOPMENT = fromString("ApplicationDevelopment"); + + /** Static value FieldServicing for CapabilityType. */ + public static final CapabilityType FIELD_SERVICING = fromString("FieldServicing"); + + /** + * Creates a new instance of CapabilityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CapabilityType() { + } + + /** + * Creates or finds a CapabilityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CapabilityType. + */ + @JsonCreator + public static CapabilityType fromString(String name) { + return fromString(name, CapabilityType.class); + } + + /** + * Gets known CapabilityType values. + * + * @return known CapabilityType values. + */ + public static Collection values() { + return values(CapabilityType.class); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Catalog.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Catalog.java new file mode 100644 index 000000000000..f93fe02c2a04 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Catalog.java @@ -0,0 +1,351 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.CatalogInner; +import java.util.Map; + +/** An immutable client-side representation of Catalog. */ +public interface Catalog { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sphere.fluent.models.CatalogInner object. + * + * @return the inner object. + */ + CatalogInner innerModel(); + + /** The entirety of the Catalog definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + + /** The Catalog definition stages. */ + interface DefinitionStages { + /** The first stage of the Catalog definition. */ + interface Blank extends WithLocation { + } + + /** The stage of the Catalog definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** The stage of the Catalog definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the Catalog 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.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + Catalog create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Catalog create(Context context); + } + + /** The stage of the Catalog definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + + /** + * Begins update for the Catalog resource. + * + * @return the stage of resource update. + */ + Catalog.Update update(); + + /** The template for Catalog update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Catalog apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Catalog apply(Context context); + } + + /** The Catalog update stages. */ + interface UpdateStages { + /** The stage of the Catalog update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Catalog refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Catalog refresh(Context context); + + /** + * Counts devices in catalog. + * + * @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 response to the action call for count devices in a catalog along with {@link Response}. + */ + Response countDevicesWithResponse(Context context); + + /** + * Counts devices in catalog. + * + * @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 response to the action call for count devices in a catalog. + */ + CountDeviceResponse countDevices(); + + /** + * Lists deployments for catalog. + * + * @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 response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listDeployments(); + + /** + * Lists deployments for catalog. + * + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listDeployments( + String filter, Integer top, Integer skip, Integer maxpagesize, Context context); + + /** + * List the device groups for the catalog. + * + * @param listDeviceGroupsRequest List device groups for catalog. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listDeviceGroups(ListDeviceGroupsRequest listDeviceGroupsRequest); + + /** + * List the device groups for the catalog. + * + * @param listDeviceGroupsRequest List device groups for catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listDeviceGroups( + ListDeviceGroupsRequest listDeviceGroupsRequest, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Lists device insights for catalog. + * + * @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 paged collection of DeviceInsight items as paginated response with {@link PagedIterable}. + */ + PagedIterable listDeviceInsights(); + + /** + * Lists device insights for catalog. + * + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 paged collection of DeviceInsight items as paginated response with {@link PagedIterable}. + */ + PagedIterable listDeviceInsights( + String filter, Integer top, Integer skip, Integer maxpagesize, Context context); + + /** + * Lists devices for catalog. + * + * @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 response of a Device list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listDevices(); + + /** + * Lists devices for catalog. + * + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a Device list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listDevices(String filter, Integer top, Integer skip, Integer maxpagesize, Context context); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogListResult.java new file mode 100644 index 000000000000..9c82d8fefe24 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sphere.fluent.models.CatalogInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a Catalog list operation. */ +@Fluent +public final class CatalogListResult { + /* + * The Catalog items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of CatalogListResult class. */ + public CatalogListResult() { + } + + /** + * Get the value property: The Catalog items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Catalog items on this page. + * + * @param value the value value to set. + * @return the CatalogListResult object itself. + */ + public CatalogListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the CatalogListResult object itself. + */ + public CatalogListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model CatalogListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CatalogListResult.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogUpdate.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogUpdate.java new file mode 100644 index 000000000000..a8798215ccb2 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CatalogUpdate.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The type used for update operations of the Catalog. */ +@Fluent +public final class CatalogUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of CatalogUpdate class. */ + public CatalogUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the CatalogUpdate object itself. + */ + public CatalogUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Catalogs.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Catalogs.java new file mode 100644 index 000000000000..b7919b56ccf9 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Catalogs.java @@ -0,0 +1,329 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Catalogs. */ +public interface Catalogs { + /** + * List Catalog resources by subscription ID. + * + * @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 response of a Catalog list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List Catalog resources by subscription 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 the response of a Catalog list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List Catalog resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Catalog list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Catalog resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 response of a Catalog list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 Catalog along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String catalogName, Context context); + + /** + * Get a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 Catalog. + */ + Catalog getByResourceGroup(String resourceGroupName, String catalogName); + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName); + + /** + * Delete a Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 resourceGroupName, String catalogName, Context context); + + /** + * Counts devices in catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response to the action call for count devices in a catalog along with {@link Response}. + */ + Response countDevicesWithResponse( + String resourceGroupName, String catalogName, Context context); + + /** + * Counts devices in catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response to the action call for count devices in a catalog. + */ + CountDeviceResponse countDevices(String resourceGroupName, String catalogName); + + /** + * Lists deployments for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listDeployments(String resourceGroupName, String catalogName); + + /** + * Lists deployments for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listDeployments( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * List the device groups for the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param listDeviceGroupsRequest List device groups for catalog. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listDeviceGroups( + String resourceGroupName, String catalogName, ListDeviceGroupsRequest listDeviceGroupsRequest); + + /** + * List the device groups for the catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param listDeviceGroupsRequest List device groups for catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listDeviceGroups( + String resourceGroupName, + String catalogName, + ListDeviceGroupsRequest listDeviceGroupsRequest, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Lists device insights for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 paged collection of DeviceInsight items as paginated response with {@link PagedIterable}. + */ + PagedIterable listDeviceInsights(String resourceGroupName, String catalogName); + + /** + * Lists device insights for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 paged collection of DeviceInsight items as paginated response with {@link PagedIterable}. + */ + PagedIterable listDeviceInsights( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Lists devices for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response of a Device list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listDevices(String resourceGroupName, String catalogName); + + /** + * Lists devices for catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a Device list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listDevices( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Get a Catalog. + * + * @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 Catalog along with {@link Response}. + */ + Catalog getById(String id); + + /** + * Get a Catalog. + * + * @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 Catalog along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Catalog. + * + * @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 Catalog. + * + * @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 Catalog resource. + * + * @param name resource name. + * @return the first stage of the new Catalog definition. + */ + Catalog.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Certificate.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Certificate.java new file mode 100644 index 000000000000..458d70f643c8 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Certificate.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sphere.fluent.models.CertificateInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of Certificate. */ +public interface Certificate { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the certificate property: The certificate as a UTF-8 encoded base 64 string. + * + * @return the certificate value. + */ + String certificate(); + + /** + * Gets the status property: The certificate status. + * + * @return the status value. + */ + CertificateStatus status(); + + /** + * Gets the subject property: The certificate subject. + * + * @return the subject value. + */ + String subject(); + + /** + * Gets the thumbprint property: The certificate thumbprint. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * Gets the expiryUtc property: The certificate expiry date. + * + * @return the expiryUtc value. + */ + OffsetDateTime expiryUtc(); + + /** + * Gets the notBeforeUtc property: The certificate not before date. + * + * @return the notBeforeUtc value. + */ + OffsetDateTime notBeforeUtc(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.sphere.fluent.models.CertificateInner object. + * + * @return the inner object. + */ + CertificateInner innerModel(); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateChainResponse.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateChainResponse.java new file mode 100644 index 000000000000..9ecd4c11ccc0 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateChainResponse.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.resourcemanager.sphere.fluent.models.CertificateChainResponseInner; + +/** An immutable client-side representation of CertificateChainResponse. */ +public interface CertificateChainResponse { + /** + * Gets the certificateChain property: The certificate chain. + * + * @return the certificateChain value. + */ + String certificateChain(); + + /** + * Gets the inner com.azure.resourcemanager.sphere.fluent.models.CertificateChainResponseInner object. + * + * @return the inner object. + */ + CertificateChainResponseInner innerModel(); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateListResult.java new file mode 100644 index 000000000000..6325d017199a --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sphere.fluent.models.CertificateInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a Certificate list operation. */ +@Fluent +public final class CertificateListResult { + /* + * The Certificate items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of CertificateListResult class. */ + public CertificateListResult() { + } + + /** + * Get the value property: The Certificate items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Certificate items on this page. + * + * @param value the value value to set. + * @return the CertificateListResult object itself. + */ + public CertificateListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the CertificateListResult object itself. + */ + public CertificateListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model CertificateListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CertificateListResult.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateStatus.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateStatus.java new file mode 100644 index 000000000000..e38e138072ba --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CertificateStatus.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Certificate status values. */ +public final class CertificateStatus extends ExpandableStringEnum { + /** Static value Active for CertificateStatus. */ + public static final CertificateStatus ACTIVE = fromString("Active"); + + /** Static value Inactive for CertificateStatus. */ + public static final CertificateStatus INACTIVE = fromString("Inactive"); + + /** Static value Expired for CertificateStatus. */ + public static final CertificateStatus EXPIRED = fromString("Expired"); + + /** Static value Revoked for CertificateStatus. */ + public static final CertificateStatus REVOKED = fromString("Revoked"); + + /** + * Creates a new instance of CertificateStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CertificateStatus() { + } + + /** + * Creates or finds a CertificateStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding CertificateStatus. + */ + @JsonCreator + public static CertificateStatus fromString(String name) { + return fromString(name, CertificateStatus.class); + } + + /** + * Gets known CertificateStatus values. + * + * @return known CertificateStatus values. + */ + public static Collection values() { + return values(CertificateStatus.class); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Certificates.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Certificates.java new file mode 100644 index 000000000000..0ed52f203f24 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Certificates.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Certificates. */ +public interface Certificates { + /** + * List Certificate resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response of a Certificate list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCatalog(String resourceGroupName, String catalogName); + + /** + * List Certificate resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a Certificate list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCatalog( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Get a Certificate. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 Certificate along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String catalogName, String serialNumber, Context context); + + /** + * Get a Certificate. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 Certificate. + */ + Certificate get(String resourceGroupName, String catalogName, String serialNumber); + + /** + * Retrieves cert chain. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 certificate chain response along with {@link Response}. + */ + Response retrieveCertChainWithResponse( + String resourceGroupName, String catalogName, String serialNumber, Context context); + + /** + * Retrieves cert chain. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @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 certificate chain response. + */ + CertificateChainResponse retrieveCertChain(String resourceGroupName, String catalogName, String serialNumber); + + /** + * Gets the proof of possession nonce. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @param proofOfPossessionNonceRequest Proof of possession nonce request body. + * @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 proof of possession nonce along with {@link Response}. + */ + Response retrieveProofOfPossessionNonceWithResponse( + String resourceGroupName, + String catalogName, + String serialNumber, + ProofOfPossessionNonceRequest proofOfPossessionNonceRequest, + Context context); + + /** + * Gets the proof of possession nonce. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param serialNumber Serial number of the certificate. Use '.default' to get current active certificate. + * @param proofOfPossessionNonceRequest Proof of possession nonce request body. + * @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 proof of possession nonce. + */ + ProofOfPossessionNonceResponse retrieveProofOfPossessionNonce( + String resourceGroupName, + String catalogName, + String serialNumber, + ProofOfPossessionNonceRequest proofOfPossessionNonceRequest); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ClaimDevicesRequest.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ClaimDevicesRequest.java new file mode 100644 index 000000000000..ae3e8c806059 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ClaimDevicesRequest.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Request to the action call to bulk claim devices. */ +@Fluent +public final class ClaimDevicesRequest { + /* + * Device identifiers of the devices to be claimed. + */ + @JsonProperty(value = "deviceIdentifiers", required = true) + private List deviceIdentifiers; + + /** Creates an instance of ClaimDevicesRequest class. */ + public ClaimDevicesRequest() { + } + + /** + * Get the deviceIdentifiers property: Device identifiers of the devices to be claimed. + * + * @return the deviceIdentifiers value. + */ + public List deviceIdentifiers() { + return this.deviceIdentifiers; + } + + /** + * Set the deviceIdentifiers property: Device identifiers of the devices to be claimed. + * + * @param deviceIdentifiers the deviceIdentifiers value to set. + * @return the ClaimDevicesRequest object itself. + */ + public ClaimDevicesRequest withDeviceIdentifiers(List deviceIdentifiers) { + this.deviceIdentifiers = deviceIdentifiers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (deviceIdentifiers() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property deviceIdentifiers in model ClaimDevicesRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ClaimDevicesRequest.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountDeviceResponse.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountDeviceResponse.java new file mode 100644 index 000000000000..7cadda61b459 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountDeviceResponse.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.resourcemanager.sphere.fluent.models.CountDeviceResponseInner; + +/** An immutable client-side representation of CountDeviceResponse. */ +public interface CountDeviceResponse { + /** + * Gets the value property: Number of children resources in parent resource. + * + * @return the value value. + */ + int value(); + + /** + * Gets the inner com.azure.resourcemanager.sphere.fluent.models.CountDeviceResponseInner object. + * + * @return the inner object. + */ + CountDeviceResponseInner innerModel(); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountElementsResponse.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountElementsResponse.java new file mode 100644 index 000000000000..8f716d7182f1 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/CountElementsResponse.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response of the count for elements. */ +@Fluent +public class CountElementsResponse { + /* + * Number of children resources in parent resource. + */ + @JsonProperty(value = "value", required = true) + private int value; + + /** Creates an instance of CountElementsResponse class. */ + public CountElementsResponse() { + } + + /** + * Get the value property: Number of children resources in parent resource. + * + * @return the value value. + */ + public int value() { + return this.value; + } + + /** + * Set the value property: Number of children resources in parent resource. + * + * @param value the value value to set. + * @return the CountElementsResponse object itself. + */ + public CountElementsResponse withValue(int value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Deployment.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Deployment.java new file mode 100644 index 000000000000..52b52dcfd10b --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Deployment.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.DeploymentInner; +import com.azure.resourcemanager.sphere.fluent.models.ImageInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Deployment. */ +public interface Deployment { + /** + * 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 deploymentId property: Deployment ID. + * + * @return the deploymentId value. + */ + String deploymentId(); + + /** + * Gets the deployedImages property: Images deployed. + * + * @return the deployedImages value. + */ + List deployedImages(); + + /** + * Gets the deploymentDateUtc property: Deployment date UTC. + * + * @return the deploymentDateUtc value. + */ + OffsetDateTime deploymentDateUtc(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sphere.fluent.models.DeploymentInner object. + * + * @return the inner object. + */ + DeploymentInner innerModel(); + + /** The entirety of the Deployment definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** The Deployment definition stages. */ + interface DefinitionStages { + /** The first stage of the Deployment definition. */ + interface Blank extends WithParentResource { + } + + /** The stage of the Deployment definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, catalogName, productName, deviceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @return the next definition stage. + */ + WithCreate withExistingDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName); + } + + /** + * The stage of the Deployment 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.WithDeploymentId, DefinitionStages.WithDeployedImages { + /** + * Executes the create request. + * + * @return the created resource. + */ + Deployment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Deployment create(Context context); + } + + /** The stage of the Deployment definition allowing to specify deploymentId. */ + interface WithDeploymentId { + /** + * Specifies the deploymentId property: Deployment ID. + * + * @param deploymentId Deployment ID. + * @return the next definition stage. + */ + WithCreate withDeploymentId(String deploymentId); + } + + /** The stage of the Deployment definition allowing to specify deployedImages. */ + interface WithDeployedImages { + /** + * Specifies the deployedImages property: Images deployed. + * + * @param deployedImages Images deployed. + * @return the next definition stage. + */ + WithCreate withDeployedImages(List deployedImages); + } + } + + /** + * Begins update for the Deployment resource. + * + * @return the stage of resource update. + */ + Deployment.Update update(); + + /** The template for Deployment update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Deployment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Deployment apply(Context context); + } + + /** The Deployment update stages. */ + interface UpdateStages { + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Deployment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Deployment refresh(Context context); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeploymentListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeploymentListResult.java new file mode 100644 index 000000000000..6c7498792bfa --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeploymentListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sphere.fluent.models.DeploymentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a Deployment list operation. */ +@Fluent +public final class DeploymentListResult { + /* + * The Deployment items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of DeploymentListResult class. */ + public DeploymentListResult() { + } + + /** + * Get the value property: The Deployment items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Deployment items on this page. + * + * @param value the value value to set. + * @return the DeploymentListResult object itself. + */ + public DeploymentListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the DeploymentListResult object itself. + */ + public DeploymentListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model DeploymentListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DeploymentListResult.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Deployments.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Deployments.java new file mode 100644 index 000000000000..082f28f191fe --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Deployments.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Deployments. */ +public interface Deployments { + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName); + + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a Deployment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDeviceGroup( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device + * group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 Deployment along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context); + + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device + * group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 Deployment. + */ + Deployment get( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName); + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName); + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current deployment for + * the associated device group. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deploymentName, + Context context); + + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device + * group name. + * + * @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 Deployment along with {@link Response}. + */ + Deployment getById(String id); + + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or device + * group name. + * + * @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 Deployment along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @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 Deployment. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @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 Deployment resource. + * + * @param name resource name. + * @return the first stage of the new Deployment definition. + */ + Deployment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Device.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Device.java new file mode 100644 index 000000000000..073290d5c996 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Device.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.DeviceInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of Device. */ +public interface Device { + /** + * 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 deviceId property: Device ID. + * + * @return the deviceId value. + */ + String deviceId(); + + /** + * Gets the chipSku property: SKU of the chip. + * + * @return the chipSku value. + */ + String chipSku(); + + /** + * Gets the lastAvailableOsVersion property: OS version available for installation when update requested. + * + * @return the lastAvailableOsVersion value. + */ + String lastAvailableOsVersion(); + + /** + * Gets the lastInstalledOsVersion property: OS version running on device when update requested. + * + * @return the lastInstalledOsVersion value. + */ + String lastInstalledOsVersion(); + + /** + * Gets the lastOsUpdateUtc property: Time when update requested and new OS version available. + * + * @return the lastOsUpdateUtc value. + */ + OffsetDateTime lastOsUpdateUtc(); + + /** + * Gets the lastUpdateRequestUtc property: Time when update was last requested. + * + * @return the lastUpdateRequestUtc value. + */ + OffsetDateTime lastUpdateRequestUtc(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sphere.fluent.models.DeviceInner object. + * + * @return the inner object. + */ + DeviceInner innerModel(); + + /** The entirety of the Device definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** The Device definition stages. */ + interface DefinitionStages { + /** The first stage of the Device definition. */ + interface Blank extends WithParentResource { + } + + /** The stage of the Device definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, catalogName, productName, deviceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @return the next definition stage. + */ + WithCreate withExistingDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName); + } + + /** + * The stage of the Device 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.WithDeviceId { + /** + * Executes the create request. + * + * @return the created resource. + */ + Device create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Device create(Context context); + } + + /** The stage of the Device definition allowing to specify deviceId. */ + interface WithDeviceId { + /** + * Specifies the deviceId property: Device ID. + * + * @param deviceId Device ID. + * @return the next definition stage. + */ + WithCreate withDeviceId(String deviceId); + } + } + + /** + * Begins update for the Device resource. + * + * @return the stage of resource update. + */ + Device.Update update(); + + /** The template for Device update. */ + interface Update extends UpdateStages.WithDeviceGroupId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Device apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Device apply(Context context); + } + + /** The Device update stages. */ + interface UpdateStages { + /** The stage of the Device update allowing to specify deviceGroupId. */ + interface WithDeviceGroupId { + /** + * Specifies the deviceGroupId property: Device group id. + * + * @param deviceGroupId Device group id. + * @return the next definition stage. + */ + Update withDeviceGroupId(String deviceGroupId); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Device refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Device refresh(Context context); + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + SignedCapabilityImageResponse generateCapabilityImage( + GenerateCapabilityImageRequest generateDeviceCapabilityRequest); + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + SignedCapabilityImageResponse generateCapabilityImage( + GenerateCapabilityImageRequest generateDeviceCapabilityRequest, Context context); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroup.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroup.java new file mode 100644 index 000000000000..19be2d25dcec --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroup.java @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner; + +/** An immutable client-side representation of DeviceGroup. */ +public interface DeviceGroup { + /** + * 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 description property: Description of the device group. + * + * @return the description value. + */ + String description(); + + /** + * Gets the osFeedType property: Operating system feed type of the device group. + * + * @return the osFeedType value. + */ + OSFeedType osFeedType(); + + /** + * Gets the updatePolicy property: Update policy of the device group. + * + * @return the updatePolicy value. + */ + UpdatePolicy updatePolicy(); + + /** + * Gets the allowCrashDumpsCollection property: Flag to define if the user allows for crash dump collection. + * + * @return the allowCrashDumpsCollection value. + */ + AllowCrashDumpCollection allowCrashDumpsCollection(); + + /** + * Gets the regionalDataBoundary property: Regional data boundary for the device group. + * + * @return the regionalDataBoundary value. + */ + RegionalDataBoundary regionalDataBoundary(); + + /** + * Gets the hasDeployment property: Deployment status for the device group. + * + * @return the hasDeployment value. + */ + Boolean hasDeployment(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner object. + * + * @return the inner object. + */ + DeviceGroupInner innerModel(); + + /** The entirety of the DeviceGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** The DeviceGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the DeviceGroup definition. */ + interface Blank extends WithParentResource { + } + + /** The stage of the DeviceGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, catalogName, productName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @return the next definition stage. + */ + WithCreate withExistingProduct(String resourceGroupName, String catalogName, String productName); + } + + /** + * The stage of the DeviceGroup 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.WithDescription, + DefinitionStages.WithOsFeedType, + DefinitionStages.WithUpdatePolicy, + DefinitionStages.WithAllowCrashDumpsCollection, + DefinitionStages.WithRegionalDataBoundary { + /** + * Executes the create request. + * + * @return the created resource. + */ + DeviceGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DeviceGroup create(Context context); + } + + /** The stage of the DeviceGroup definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of the device group.. + * + * @param description Description of the device group. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** The stage of the DeviceGroup definition allowing to specify osFeedType. */ + interface WithOsFeedType { + /** + * Specifies the osFeedType property: Operating system feed type of the device group.. + * + * @param osFeedType Operating system feed type of the device group. + * @return the next definition stage. + */ + WithCreate withOsFeedType(OSFeedType osFeedType); + } + + /** The stage of the DeviceGroup definition allowing to specify updatePolicy. */ + interface WithUpdatePolicy { + /** + * Specifies the updatePolicy property: Update policy of the device group.. + * + * @param updatePolicy Update policy of the device group. + * @return the next definition stage. + */ + WithCreate withUpdatePolicy(UpdatePolicy updatePolicy); + } + + /** The stage of the DeviceGroup definition allowing to specify allowCrashDumpsCollection. */ + interface WithAllowCrashDumpsCollection { + /** + * Specifies the allowCrashDumpsCollection property: Flag to define if the user allows for crash dump + * collection.. + * + * @param allowCrashDumpsCollection Flag to define if the user allows for crash dump collection. + * @return the next definition stage. + */ + WithCreate withAllowCrashDumpsCollection(AllowCrashDumpCollection allowCrashDumpsCollection); + } + + /** The stage of the DeviceGroup definition allowing to specify regionalDataBoundary. */ + interface WithRegionalDataBoundary { + /** + * Specifies the regionalDataBoundary property: Regional data boundary for the device group.. + * + * @param regionalDataBoundary Regional data boundary for the device group. + * @return the next definition stage. + */ + WithCreate withRegionalDataBoundary(RegionalDataBoundary regionalDataBoundary); + } + } + + /** + * Begins update for the DeviceGroup resource. + * + * @return the stage of resource update. + */ + DeviceGroup.Update update(); + + /** The template for DeviceGroup update. */ + interface Update + extends UpdateStages.WithDescription, + UpdateStages.WithOsFeedType, + UpdateStages.WithUpdatePolicy, + UpdateStages.WithAllowCrashDumpsCollection, + UpdateStages.WithRegionalDataBoundary { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DeviceGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DeviceGroup apply(Context context); + } + + /** The DeviceGroup update stages. */ + interface UpdateStages { + /** The stage of the DeviceGroup update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of the device group.. + * + * @param description Description of the device group. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** The stage of the DeviceGroup update allowing to specify osFeedType. */ + interface WithOsFeedType { + /** + * Specifies the osFeedType property: Operating system feed type of the device group.. + * + * @param osFeedType Operating system feed type of the device group. + * @return the next definition stage. + */ + Update withOsFeedType(OSFeedType osFeedType); + } + + /** The stage of the DeviceGroup update allowing to specify updatePolicy. */ + interface WithUpdatePolicy { + /** + * Specifies the updatePolicy property: Update policy of the device group.. + * + * @param updatePolicy Update policy of the device group. + * @return the next definition stage. + */ + Update withUpdatePolicy(UpdatePolicy updatePolicy); + } + + /** The stage of the DeviceGroup update allowing to specify allowCrashDumpsCollection. */ + interface WithAllowCrashDumpsCollection { + /** + * Specifies the allowCrashDumpsCollection property: Flag to define if the user allows for crash dump + * collection.. + * + * @param allowCrashDumpsCollection Flag to define if the user allows for crash dump collection. + * @return the next definition stage. + */ + Update withAllowCrashDumpsCollection(AllowCrashDumpCollection allowCrashDumpsCollection); + } + + /** The stage of the DeviceGroup update allowing to specify regionalDataBoundary. */ + interface WithRegionalDataBoundary { + /** + * Specifies the regionalDataBoundary property: Regional data boundary for the device group.. + * + * @param regionalDataBoundary Regional data boundary for the device group. + * @return the next definition stage. + */ + Update withRegionalDataBoundary(RegionalDataBoundary regionalDataBoundary); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DeviceGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DeviceGroup refresh(Context context); + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param claimDevicesRequest Bulk claim devices request body. + * @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 claimDevices(ClaimDevicesRequest claimDevicesRequest); + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param claimDevicesRequest Bulk claim devices request body. + * @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 claimDevices(ClaimDevicesRequest claimDevicesRequest, Context context); + + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * + * @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 response to the action call for count devices in a catalog along with {@link Response}. + */ + Response countDevicesWithResponse(Context context); + + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * + * @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 response to the action call for count devices in a catalog. + */ + CountDeviceResponse countDevices(); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupListResult.java new file mode 100644 index 000000000000..5010b57a9b07 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a DeviceGroup list operation. */ +@Fluent +public final class DeviceGroupListResult { + /* + * The DeviceGroup items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of DeviceGroupListResult class. */ + public DeviceGroupListResult() { + } + + /** + * Get the value property: The DeviceGroup items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The DeviceGroup items on this page. + * + * @param value the value value to set. + * @return the DeviceGroupListResult object itself. + */ + public DeviceGroupListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the DeviceGroupListResult object itself. + */ + public DeviceGroupListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model DeviceGroupListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DeviceGroupListResult.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupUpdate.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupUpdate.java new file mode 100644 index 000000000000..b29005860436 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroupUpdate.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sphere.fluent.models.DeviceGroupUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The type used for update operations of the DeviceGroup. */ +@Fluent +public final class DeviceGroupUpdate { + /* + * The updatable properties of the DeviceGroup. + */ + @JsonProperty(value = "properties") + private DeviceGroupUpdateProperties innerProperties; + + /** Creates an instance of DeviceGroupUpdate class. */ + public DeviceGroupUpdate() { + } + + /** + * Get the innerProperties property: The updatable properties of the DeviceGroup. + * + * @return the innerProperties value. + */ + private DeviceGroupUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the description property: Description of the device group. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the device group. + * + * @param description the description value to set. + * @return the DeviceGroupUpdate object itself. + */ + public DeviceGroupUpdate withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new DeviceGroupUpdateProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the osFeedType property: Operating system feed type of the device group. + * + * @return the osFeedType value. + */ + public OSFeedType osFeedType() { + return this.innerProperties() == null ? null : this.innerProperties().osFeedType(); + } + + /** + * Set the osFeedType property: Operating system feed type of the device group. + * + * @param osFeedType the osFeedType value to set. + * @return the DeviceGroupUpdate object itself. + */ + public DeviceGroupUpdate withOsFeedType(OSFeedType osFeedType) { + if (this.innerProperties() == null) { + this.innerProperties = new DeviceGroupUpdateProperties(); + } + this.innerProperties().withOsFeedType(osFeedType); + return this; + } + + /** + * Get the updatePolicy property: Update policy of the device group. + * + * @return the updatePolicy value. + */ + public UpdatePolicy updatePolicy() { + return this.innerProperties() == null ? null : this.innerProperties().updatePolicy(); + } + + /** + * Set the updatePolicy property: Update policy of the device group. + * + * @param updatePolicy the updatePolicy value to set. + * @return the DeviceGroupUpdate object itself. + */ + public DeviceGroupUpdate withUpdatePolicy(UpdatePolicy updatePolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new DeviceGroupUpdateProperties(); + } + this.innerProperties().withUpdatePolicy(updatePolicy); + return this; + } + + /** + * Get the allowCrashDumpsCollection property: Flag to define if the user allows for crash dump collection. + * + * @return the allowCrashDumpsCollection value. + */ + public AllowCrashDumpCollection allowCrashDumpsCollection() { + return this.innerProperties() == null ? null : this.innerProperties().allowCrashDumpsCollection(); + } + + /** + * Set the allowCrashDumpsCollection property: Flag to define if the user allows for crash dump collection. + * + * @param allowCrashDumpsCollection the allowCrashDumpsCollection value to set. + * @return the DeviceGroupUpdate object itself. + */ + public DeviceGroupUpdate withAllowCrashDumpsCollection(AllowCrashDumpCollection allowCrashDumpsCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new DeviceGroupUpdateProperties(); + } + this.innerProperties().withAllowCrashDumpsCollection(allowCrashDumpsCollection); + return this; + } + + /** + * Get the regionalDataBoundary property: Regional data boundary for the device group. + * + * @return the regionalDataBoundary value. + */ + public RegionalDataBoundary regionalDataBoundary() { + return this.innerProperties() == null ? null : this.innerProperties().regionalDataBoundary(); + } + + /** + * Set the regionalDataBoundary property: Regional data boundary for the device group. + * + * @param regionalDataBoundary the regionalDataBoundary value to set. + * @return the DeviceGroupUpdate object itself. + */ + public DeviceGroupUpdate withRegionalDataBoundary(RegionalDataBoundary regionalDataBoundary) { + if (this.innerProperties() == null) { + this.innerProperties = new DeviceGroupUpdateProperties(); + } + this.innerProperties().withRegionalDataBoundary(regionalDataBoundary); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroups.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroups.java new file mode 100644 index 000000000000..ece2c86ce5a7 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceGroups.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DeviceGroups. */ +public interface DeviceGroups { + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByProduct(String resourceGroupName, String catalogName, String productName); + + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByProduct( + String resourceGroupName, + String catalogName, + String productName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 DeviceGroup along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context); + + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 DeviceGroup. + */ + DeviceGroup get(String resourceGroupName, String catalogName, String productName, String deviceGroupName); + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName); + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context); + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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 claimDevices( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest); + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when bulk + * claiming devices to a catalog only. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @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 claimDevices( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + ClaimDevicesRequest claimDevicesRequest, + Context context); + + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response to the action call for count devices in a catalog along with {@link Response}. + */ + Response countDevicesWithResponse( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context); + + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response to the action call for count devices in a catalog. + */ + CountDeviceResponse countDevices( + String resourceGroupName, String catalogName, String productName, String deviceGroupName); + + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @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 DeviceGroup along with {@link Response}. + */ + DeviceGroup getById(String id); + + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @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 DeviceGroup along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @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 DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for product or + * device group name. + * + * @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 DeviceGroup resource. + * + * @param name resource name. + * @return the first stage of the new DeviceGroup definition. + */ + DeviceGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceInsight.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceInsight.java new file mode 100644 index 000000000000..adf199386321 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceInsight.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.resourcemanager.sphere.fluent.models.DeviceInsightInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of DeviceInsight. */ +public interface DeviceInsight { + /** + * Gets the deviceId property: Device ID. + * + * @return the deviceId value. + */ + String deviceId(); + + /** + * Gets the description property: Event description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the startTimestampUtc property: Event start timestamp. + * + * @return the startTimestampUtc value. + */ + OffsetDateTime startTimestampUtc(); + + /** + * Gets the endTimestampUtc property: Event end timestamp. + * + * @return the endTimestampUtc value. + */ + OffsetDateTime endTimestampUtc(); + + /** + * Gets the eventCategory property: Event category. + * + * @return the eventCategory value. + */ + String eventCategory(); + + /** + * Gets the eventClass property: Event class. + * + * @return the eventClass value. + */ + String eventClass(); + + /** + * Gets the eventType property: Event type. + * + * @return the eventType value. + */ + String eventType(); + + /** + * Gets the eventCount property: Event count. + * + * @return the eventCount value. + */ + int eventCount(); + + /** + * Gets the inner com.azure.resourcemanager.sphere.fluent.models.DeviceInsightInner object. + * + * @return the inner object. + */ + DeviceInsightInner innerModel(); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceListResult.java new file mode 100644 index 000000000000..5f6ddd913eec --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sphere.fluent.models.DeviceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a Device list operation. */ +@Fluent +public final class DeviceListResult { + /* + * The Device items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of DeviceListResult class. */ + public DeviceListResult() { + } + + /** + * Get the value property: The Device items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Device items on this page. + * + * @param value the value value to set. + * @return the DeviceListResult object itself. + */ + public DeviceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the DeviceListResult object itself. + */ + public DeviceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model DeviceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DeviceListResult.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceUpdate.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceUpdate.java new file mode 100644 index 000000000000..9217bec762a3 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/DeviceUpdate.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sphere.fluent.models.DeviceUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The type used for update operations of the Device. */ +@Fluent +public final class DeviceUpdate { + /* + * The updatable properties of the Device. + */ + @JsonProperty(value = "properties") + private DeviceUpdateProperties innerProperties; + + /** Creates an instance of DeviceUpdate class. */ + public DeviceUpdate() { + } + + /** + * Get the innerProperties property: The updatable properties of the Device. + * + * @return the innerProperties value. + */ + private DeviceUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the deviceGroupId property: Device group id. + * + * @return the deviceGroupId value. + */ + public String deviceGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().deviceGroupId(); + } + + /** + * Set the deviceGroupId property: Device group id. + * + * @param deviceGroupId the deviceGroupId value to set. + * @return the DeviceUpdate object itself. + */ + public DeviceUpdate withDeviceGroupId(String deviceGroupId) { + if (this.innerProperties() == null) { + this.innerProperties = new DeviceUpdateProperties(); + } + this.innerProperties().withDeviceGroupId(deviceGroupId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Devices.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Devices.java new file mode 100644 index 000000000000..120b73eaa9d4 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Devices.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Devices. */ +public interface Devices { + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + * for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response of a Device list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName); + + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used + * for product or device group name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @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 response of a Device list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDeviceGroup( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, Context context); + + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not + * belong to a device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 Device along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context); + + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not + * belong to a device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 Device. + */ + Device get( + String resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName); + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, String catalogName, String productName, String deviceGroupName, String deviceName); + + /** + * Delete a Device. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @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 resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + Context context); + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + SignedCapabilityImageResponse generateCapabilityImage( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest); + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group and product + * names to generate the image for a device that does not belong to a specific device group and product. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name. + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @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 signed device capability image response. + */ + SignedCapabilityImageResponse generateCapabilityImage( + String resourceGroupName, + String catalogName, + String productName, + String deviceGroupName, + String deviceName, + GenerateCapabilityImageRequest generateDeviceCapabilityRequest, + Context context); + + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not + * belong to a device group and product. + * + * @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 Device along with {@link Response}. + */ + Device getById(String id); + + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device does not + * belong to a device group and product. + * + * @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 Device along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Device. + * + * @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 Device. + * + * @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 Device resource. + * + * @param name resource name. + * @return the first stage of the new Device definition. + */ + Device.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/GenerateCapabilityImageRequest.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/GenerateCapabilityImageRequest.java new file mode 100644 index 000000000000..e795eb1a071e --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/GenerateCapabilityImageRequest.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Request of the action to create a signed device capability image. */ +@Fluent +public final class GenerateCapabilityImageRequest { + /* + * List of capabilities to create + */ + @JsonProperty(value = "capabilities", required = true) + private List capabilities; + + /** Creates an instance of GenerateCapabilityImageRequest class. */ + public GenerateCapabilityImageRequest() { + } + + /** + * Get the capabilities property: List of capabilities to create. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities property: List of capabilities to create. + * + * @param capabilities the capabilities value to set. + * @return the GenerateCapabilityImageRequest object itself. + */ + public GenerateCapabilityImageRequest withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (capabilities() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property capabilities in model GenerateCapabilityImageRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GenerateCapabilityImageRequest.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Image.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Image.java new file mode 100644 index 000000000000..03c294f282cf --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Image.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.ImageInner; + +/** An immutable client-side representation of Image. */ +public interface Image { + /** + * 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 image property: Image as a UTF-8 encoded base 64 string on image create. This field contains the image + * URI on image reads. + * + * @return the image value. + */ + String image(); + + /** + * Gets the imageId property: Image ID. + * + * @return the imageId value. + */ + String imageId(); + + /** + * Gets the imageName property: Image name. + * + * @return the imageName value. + */ + String imageName(); + + /** + * Gets the regionalDataBoundary property: Regional data boundary for an image. + * + * @return the regionalDataBoundary value. + */ + RegionalDataBoundary regionalDataBoundary(); + + /** + * Gets the uri property: Location the image. + * + * @return the uri value. + */ + String uri(); + + /** + * Gets the description property: The image description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the componentId property: The image component id. + * + * @return the componentId value. + */ + String componentId(); + + /** + * Gets the imageType property: The image type. + * + * @return the imageType value. + */ + ImageType imageType(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sphere.fluent.models.ImageInner object. + * + * @return the inner object. + */ + ImageInner innerModel(); + + /** The entirety of the Image definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** The Image definition stages. */ + interface DefinitionStages { + /** The first stage of the Image definition. */ + interface Blank extends WithParentResource { + } + + /** The stage of the Image definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, catalogName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @return the next definition stage. + */ + WithCreate withExistingCatalog(String resourceGroupName, String catalogName); + } + + /** + * The stage of the Image 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.WithImage, + DefinitionStages.WithImageId, + DefinitionStages.WithRegionalDataBoundary { + /** + * Executes the create request. + * + * @return the created resource. + */ + Image create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Image create(Context context); + } + + /** The stage of the Image definition allowing to specify image. */ + interface WithImage { + /** + * Specifies the image property: Image as a UTF-8 encoded base 64 string on image create. This field + * contains the image URI on image reads.. + * + * @param image Image as a UTF-8 encoded base 64 string on image create. This field contains the image URI + * on image reads. + * @return the next definition stage. + */ + WithCreate withImage(String image); + } + + /** The stage of the Image definition allowing to specify imageId. */ + interface WithImageId { + /** + * Specifies the imageId property: Image ID. + * + * @param imageId Image ID. + * @return the next definition stage. + */ + WithCreate withImageId(String imageId); + } + + /** The stage of the Image definition allowing to specify regionalDataBoundary. */ + interface WithRegionalDataBoundary { + /** + * Specifies the regionalDataBoundary property: Regional data boundary for an image. + * + * @param regionalDataBoundary Regional data boundary for an image. + * @return the next definition stage. + */ + WithCreate withRegionalDataBoundary(RegionalDataBoundary regionalDataBoundary); + } + } + + /** + * Begins update for the Image resource. + * + * @return the stage of resource update. + */ + Image.Update update(); + + /** The template for Image update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Image apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Image apply(Context context); + } + + /** The Image update stages. */ + interface UpdateStages { + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Image refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Image refresh(Context context); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageListResult.java new file mode 100644 index 000000000000..a6e018f8b2ee --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sphere.fluent.models.ImageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a Image list operation. */ +@Fluent +public final class ImageListResult { + /* + * The Image items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of ImageListResult class. */ + public ImageListResult() { + } + + /** + * Get the value property: The Image items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Image items on this page. + * + * @param value the value value to set. + * @return the ImageListResult object itself. + */ + public ImageListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the ImageListResult object itself. + */ + public ImageListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ImageListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ImageListResult.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageType.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageType.java new file mode 100644 index 000000000000..b12f2162886a --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ImageType.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Image type values. */ +public final class ImageType extends ExpandableStringEnum { + /** Static value InvalidImageType for ImageType. */ + public static final ImageType INVALID_IMAGE_TYPE = fromString("InvalidImageType"); + + /** Static value OneBl for ImageType. */ + public static final ImageType ONE_BL = fromString("OneBl"); + + /** Static value PlutonRuntime for ImageType. */ + public static final ImageType PLUTON_RUNTIME = fromString("PlutonRuntime"); + + /** Static value WifiFirmware for ImageType. */ + public static final ImageType WIFI_FIRMWARE = fromString("WifiFirmware"); + + /** Static value SecurityMonitor for ImageType. */ + public static final ImageType SECURITY_MONITOR = fromString("SecurityMonitor"); + + /** Static value NormalWorldLoader for ImageType. */ + public static final ImageType NORMAL_WORLD_LOADER = fromString("NormalWorldLoader"); + + /** Static value NormalWorldDtb for ImageType. */ + public static final ImageType NORMAL_WORLD_DTB = fromString("NormalWorldDtb"); + + /** Static value NormalWorldKernel for ImageType. */ + public static final ImageType NORMAL_WORLD_KERNEL = fromString("NormalWorldKernel"); + + /** Static value RootFs for ImageType. */ + public static final ImageType ROOT_FS = fromString("RootFs"); + + /** Static value Services for ImageType. */ + public static final ImageType SERVICES = fromString("Services"); + + /** Static value Applications for ImageType. */ + public static final ImageType APPLICATIONS = fromString("Applications"); + + /** Static value FwConfig for ImageType. */ + public static final ImageType FW_CONFIG = fromString("FwConfig"); + + /** Static value BootManifest for ImageType. */ + public static final ImageType BOOT_MANIFEST = fromString("BootManifest"); + + /** Static value Nwfs for ImageType. */ + public static final ImageType NWFS = fromString("Nwfs"); + + /** Static value TrustedKeystore for ImageType. */ + public static final ImageType TRUSTED_KEYSTORE = fromString("TrustedKeystore"); + + /** Static value Policy for ImageType. */ + public static final ImageType POLICY = fromString("Policy"); + + /** Static value CustomerBoardConfig for ImageType. */ + public static final ImageType CUSTOMER_BOARD_CONFIG = fromString("CustomerBoardConfig"); + + /** Static value UpdateCertStore for ImageType. */ + public static final ImageType UPDATE_CERT_STORE = fromString("UpdateCertStore"); + + /** Static value BaseSystemUpdateManifest for ImageType. */ + public static final ImageType BASE_SYSTEM_UPDATE_MANIFEST = fromString("BaseSystemUpdateManifest"); + + /** Static value FirmwareUpdateManifest for ImageType. */ + public static final ImageType FIRMWARE_UPDATE_MANIFEST = fromString("FirmwareUpdateManifest"); + + /** Static value CustomerUpdateManifest for ImageType. */ + public static final ImageType CUSTOMER_UPDATE_MANIFEST = fromString("CustomerUpdateManifest"); + + /** Static value RecoveryManifest for ImageType. */ + public static final ImageType RECOVERY_MANIFEST = fromString("RecoveryManifest"); + + /** Static value ManifestSet for ImageType. */ + public static final ImageType MANIFEST_SET = fromString("ManifestSet"); + + /** Static value Other for ImageType. */ + public static final ImageType OTHER = fromString("Other"); + + /** + * Creates a new instance of ImageType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ImageType() { + } + + /** + * Creates or finds a ImageType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ImageType. + */ + @JsonCreator + public static ImageType fromString(String name) { + return fromString(name, ImageType.class); + } + + /** + * Gets known ImageType values. + * + * @return known ImageType values. + */ + public static Collection values() { + return values(ImageType.class); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Images.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Images.java new file mode 100644 index 000000000000..482e9daa7099 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Images.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Images. */ +public interface Images { + /** + * List Image resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response of a Image list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCatalog(String resourceGroupName, String catalogName); + + /** + * List Image resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param filter Filter the result list using the given expression. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxpagesize The maximum number of result items per page. + * @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 response of a Image list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCatalog( + String resourceGroupName, + String catalogName, + String filter, + Integer top, + Integer skip, + Integer maxpagesize, + Context context); + + /** + * Get a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 Image along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String catalogName, String imageName, Context context); + + /** + * Get a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 Image. + */ + Image get(String resourceGroupName, String catalogName, String imageName); + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName); + + /** + * Delete a Image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param imageName Image name. Use .default for image creation. + * @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 resourceGroupName, String catalogName, String imageName, Context context); + + /** + * Get a Image. + * + * @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 Image along with {@link Response}. + */ + Image getById(String id); + + /** + * Get a Image. + * + * @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 Image along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Image. + * + * @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 Image. + * + * @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 Image resource. + * + * @param name resource name. + * @return the first stage of the new Image definition. + */ + Image.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ListDeviceGroupsRequest.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ListDeviceGroupsRequest.java new file mode 100644 index 000000000000..aeac84fe7a66 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ListDeviceGroupsRequest.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request of the action to list device groups for a catalog. */ +@Fluent +public final class ListDeviceGroupsRequest { + /* + * Device Group name. + */ + @JsonProperty(value = "deviceGroupName") + private String deviceGroupName; + + /** Creates an instance of ListDeviceGroupsRequest class. */ + public ListDeviceGroupsRequest() { + } + + /** + * Get the deviceGroupName property: Device Group name. + * + * @return the deviceGroupName value. + */ + public String deviceGroupName() { + return this.deviceGroupName; + } + + /** + * Set the deviceGroupName property: Device Group name. + * + * @param deviceGroupName the deviceGroupName value to set. + * @return the ListDeviceGroupsRequest object itself. + */ + public ListDeviceGroupsRequest withDeviceGroupName(String deviceGroupName) { + this.deviceGroupName = deviceGroupName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OSFeedType.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OSFeedType.java new file mode 100644 index 000000000000..b22ba3545e50 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OSFeedType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** OS feed type values. */ +public final class OSFeedType extends ExpandableStringEnum { + /** Static value Retail for OSFeedType. */ + public static final OSFeedType RETAIL = fromString("Retail"); + + /** Static value RetailEval for OSFeedType. */ + public static final OSFeedType RETAIL_EVAL = fromString("RetailEval"); + + /** + * Creates a new instance of OSFeedType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OSFeedType() { + } + + /** + * Creates or finds a OSFeedType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OSFeedType. + */ + @JsonCreator + public static OSFeedType fromString(String name) { + return fromString(name, OSFeedType.class); + } + + /** + * Gets known OSFeedType values. + * + * @return known OSFeedType values. + */ + public static Collection values() { + return values(OSFeedType.class); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Operation.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Operation.java new file mode 100644 index 000000000000..7fd48e4bde39 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Operation.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.resourcemanager.sphere.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 ARM/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: 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.sphere.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationDisplay.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationDisplay.java new file mode 100644 index 000000000000..562d7f5f396c --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationDisplay.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** Creates an instance of OperationDisplay class. */ + public 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationListResult.java new file mode 100644 index 000000000000..e9291b9358f4 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/OperationListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sphere.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +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 { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Operations.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Operations.java new file mode 100644 index 000000000000..53ce30f3ca79 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Origin.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Origin.java new file mode 100644 index 000000000000..a5871fb788c7 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Origin.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +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 { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + 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. + */ + @JsonCreator + 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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/PagedDeviceInsight.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/PagedDeviceInsight.java new file mode 100644 index 000000000000..36810c2a7ab5 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/PagedDeviceInsight.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sphere.fluent.models.DeviceInsightInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Paged collection of DeviceInsight items. */ +@Fluent +public final class PagedDeviceInsight { + /* + * The DeviceInsight items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of PagedDeviceInsight class. */ + public PagedDeviceInsight() { + } + + /** + * Get the value property: The DeviceInsight items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The DeviceInsight items on this page. + * + * @param value the value value to set. + * @return the PagedDeviceInsight object itself. + */ + public PagedDeviceInsight withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the PagedDeviceInsight object itself. + */ + public PagedDeviceInsight withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model PagedDeviceInsight")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PagedDeviceInsight.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Product.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Product.java new file mode 100644 index 000000000000..d88525e092fc --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Product.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sphere.fluent.models.ProductInner; + +/** An immutable client-side representation of Product. */ +public interface Product { + /** + * 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 description property: Description of the product. + * + * @return the description value. + */ + String description(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sphere.fluent.models.ProductInner object. + * + * @return the inner object. + */ + ProductInner innerModel(); + + /** The entirety of the Product definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** The Product definition stages. */ + interface DefinitionStages { + /** The first stage of the Product definition. */ + interface Blank extends WithParentResource { + } + + /** The stage of the Product definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, catalogName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @return the next definition stage. + */ + WithCreate withExistingCatalog(String resourceGroupName, String catalogName); + } + + /** + * The stage of the Product 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.WithDescription { + /** + * Executes the create request. + * + * @return the created resource. + */ + Product create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Product create(Context context); + } + + /** The stage of the Product definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of the product. + * + * @param description Description of the product. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + } + + /** + * Begins update for the Product resource. + * + * @return the stage of resource update. + */ + Product.Update update(); + + /** The template for Product update. */ + interface Update extends UpdateStages.WithDescription { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Product apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Product apply(Context context); + } + + /** The Product update stages. */ + interface UpdateStages { + /** The stage of the Product update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of the product. + * + * @param description Description of the product. + * @return the next definition stage. + */ + Update withDescription(String description); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Product refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Product refresh(Context context); + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * + * @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 response to the action call for count devices in a catalog along with {@link Response}. + */ + Response countDevicesWithResponse(Context context); + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * + * @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 response to the action call for count devices in a catalog. + */ + CountDeviceResponse countDevices(); + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable generateDefaultDeviceGroups(); + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable generateDefaultDeviceGroups(Context context); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductListResult.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductListResult.java new file mode 100644 index 000000000000..37e441bd57a6 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sphere.fluent.models.ProductInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a Product list operation. */ +@Fluent +public final class ProductListResult { + /* + * The Product items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of ProductListResult class. */ + public ProductListResult() { + } + + /** + * Get the value property: The Product items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Product items on this page. + * + * @param value the value value to set. + * @return the ProductListResult object itself. + */ + public ProductListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the ProductListResult object itself. + */ + public ProductListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ProductListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ProductListResult.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductUpdate.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductUpdate.java new file mode 100644 index 000000000000..728b43305eb4 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProductUpdate.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sphere.fluent.models.ProductUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The type used for update operations of the Product. */ +@Fluent +public final class ProductUpdate { + /* + * The updatable properties of the Product. + */ + @JsonProperty(value = "properties") + private ProductUpdateProperties innerProperties; + + /** Creates an instance of ProductUpdate class. */ + public ProductUpdate() { + } + + /** + * Get the innerProperties property: The updatable properties of the Product. + * + * @return the innerProperties value. + */ + private ProductUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the description property: Description of the product. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the product. + * + * @param description the description value to set. + * @return the ProductUpdate object itself. + */ + public ProductUpdate withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ProductUpdateProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Products.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Products.java new file mode 100644 index 000000000000..2d19d86941ed --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/Products.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Products. */ +public interface Products { + /** + * List Product resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response of a Product list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCatalog(String resourceGroupName, String catalogName); + + /** + * List Product resources by Catalog. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @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 response of a Product list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCatalog(String resourceGroupName, String catalogName, Context context); + + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 Product along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String catalogName, String productName, Context context); + + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 Product. + */ + Product get(String resourceGroupName, String catalogName, String productName); + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName); + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 resourceGroupName, String catalogName, String productName, Context context); + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response to the action call for count devices in a catalog along with {@link Response}. + */ + Response countDevicesWithResponse( + String resourceGroupName, String catalogName, String productName, Context context); + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response to the action call for count devices in a catalog. + */ + CountDeviceResponse countDevices(String resourceGroupName, String catalogName, String productName); + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable generateDefaultDeviceGroups( + String resourceGroupName, String catalogName, String productName); + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog. + * @param productName Name of product. + * @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 response of a DeviceGroup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable generateDefaultDeviceGroups( + String resourceGroupName, String catalogName, String productName, Context context); + + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @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 Product along with {@link Response}. + */ + Product getById(String id); + + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name. + * + * @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 Product along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @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 Product. '.default' and '.unassigned' are system defined values and cannot be used for product name'. + * + * @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 Product resource. + * + * @param name resource name. + * @return the first stage of the new Product definition. + */ + Product.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProofOfPossessionNonceRequest.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProofOfPossessionNonceRequest.java new file mode 100644 index 000000000000..259f942574da --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProofOfPossessionNonceRequest.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request for the proof of possession nonce. */ +@Fluent +public final class ProofOfPossessionNonceRequest { + /* + * The proof of possession nonce + */ + @JsonProperty(value = "proofOfPossessionNonce", required = true) + private String proofOfPossessionNonce; + + /** Creates an instance of ProofOfPossessionNonceRequest class. */ + public ProofOfPossessionNonceRequest() { + } + + /** + * Get the proofOfPossessionNonce property: The proof of possession nonce. + * + * @return the proofOfPossessionNonce value. + */ + public String proofOfPossessionNonce() { + return this.proofOfPossessionNonce; + } + + /** + * Set the proofOfPossessionNonce property: The proof of possession nonce. + * + * @param proofOfPossessionNonce the proofOfPossessionNonce value to set. + * @return the ProofOfPossessionNonceRequest object itself. + */ + public ProofOfPossessionNonceRequest withProofOfPossessionNonce(String proofOfPossessionNonce) { + this.proofOfPossessionNonce = proofOfPossessionNonce; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (proofOfPossessionNonce() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property proofOfPossessionNonce in model ProofOfPossessionNonceRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ProofOfPossessionNonceRequest.class); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProofOfPossessionNonceResponse.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProofOfPossessionNonceResponse.java new file mode 100644 index 000000000000..74245243ac80 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProofOfPossessionNonceResponse.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.resourcemanager.sphere.fluent.models.ProofOfPossessionNonceResponseInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ProofOfPossessionNonceResponse. */ +public interface ProofOfPossessionNonceResponse { + /** + * Gets the certificate property: The certificate as a UTF-8 encoded base 64 string. + * + * @return the certificate value. + */ + String certificate(); + + /** + * Gets the status property: The certificate status. + * + * @return the status value. + */ + CertificateStatus status(); + + /** + * Gets the subject property: The certificate subject. + * + * @return the subject value. + */ + String subject(); + + /** + * Gets the thumbprint property: The certificate thumbprint. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * Gets the expiryUtc property: The certificate expiry date. + * + * @return the expiryUtc value. + */ + OffsetDateTime expiryUtc(); + + /** + * Gets the notBeforeUtc property: The certificate not before date. + * + * @return the notBeforeUtc value. + */ + OffsetDateTime notBeforeUtc(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.sphere.fluent.models.ProofOfPossessionNonceResponseInner object. + * + * @return the inner object. + */ + ProofOfPossessionNonceResponseInner innerModel(); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProvisioningState.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProvisioningState.java new file mode 100644 index 000000000000..2b6e552a5b3e --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/ProvisioningState.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Provisioning state of the resource. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Provisioning for ProvisioningState. */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Accepted for ProvisioningState. */ + 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. + */ + @JsonCreator + 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/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/RegionalDataBoundary.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/RegionalDataBoundary.java new file mode 100644 index 000000000000..37ff9a000820 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/RegionalDataBoundary.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Regional data boundary values. */ +public final class RegionalDataBoundary extends ExpandableStringEnum { + /** Static value None for RegionalDataBoundary. */ + public static final RegionalDataBoundary NONE = fromString("None"); + + /** Static value EU for RegionalDataBoundary. */ + public static final RegionalDataBoundary EU = fromString("EU"); + + /** + * Creates a new instance of RegionalDataBoundary value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RegionalDataBoundary() { + } + + /** + * Creates or finds a RegionalDataBoundary from its string representation. + * + * @param name a name to look for. + * @return the corresponding RegionalDataBoundary. + */ + @JsonCreator + public static RegionalDataBoundary fromString(String name) { + return fromString(name, RegionalDataBoundary.class); + } + + /** + * Gets known RegionalDataBoundary values. + * + * @return known RegionalDataBoundary values. + */ + public static Collection values() { + return values(RegionalDataBoundary.class); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/SignedCapabilityImageResponse.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/SignedCapabilityImageResponse.java new file mode 100644 index 000000000000..3e93a7ae3156 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/SignedCapabilityImageResponse.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.resourcemanager.sphere.fluent.models.SignedCapabilityImageResponseInner; + +/** An immutable client-side representation of SignedCapabilityImageResponse. */ +public interface SignedCapabilityImageResponse { + /** + * Gets the image property: The signed device capability image as a UTF-8 encoded base 64 string. + * + * @return the image value. + */ + String image(); + + /** + * Gets the inner com.azure.resourcemanager.sphere.fluent.models.SignedCapabilityImageResponseInner object. + * + * @return the inner object. + */ + SignedCapabilityImageResponseInner innerModel(); +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/UpdatePolicy.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/UpdatePolicy.java new file mode 100644 index 000000000000..3153c79aed9a --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/UpdatePolicy.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Update policy values. */ +public final class UpdatePolicy extends ExpandableStringEnum { + /** Static value UpdateAll for UpdatePolicy. */ + public static final UpdatePolicy UPDATE_ALL = fromString("UpdateAll"); + + /** Static value No3rdPartyAppUpdates for UpdatePolicy. */ + public static final UpdatePolicy NO3RD_PARTY_APP_UPDATES = fromString("No3rdPartyAppUpdates"); + + /** + * Creates a new instance of UpdatePolicy value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public UpdatePolicy() { + } + + /** + * Creates or finds a UpdatePolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding UpdatePolicy. + */ + @JsonCreator + public static UpdatePolicy fromString(String name) { + return fromString(name, UpdatePolicy.class); + } + + /** + * Gets known UpdatePolicy values. + * + * @return known UpdatePolicy values. + */ + public static Collection values() { + return values(UpdatePolicy.class); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/package-info.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/package-info.java new file mode 100644 index 000000000000..1434cd8dbacf --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for AzureSphereManagementClient. Azure Sphere resource management API. */ +package com.azure.resourcemanager.sphere.models; diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/package-info.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/package-info.java new file mode 100644 index 000000000000..0b51b3be880a --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/com/azure/resourcemanager/sphere/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for AzureSphereManagementClient. Azure Sphere resource management API. */ +package com.azure.resourcemanager.sphere; diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/main/java/module-info.java b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/module-info.java new file mode 100644 index 000000000000..bd2ed817d1ea --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.sphere { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.sphere; + exports com.azure.resourcemanager.sphere.fluent; + exports com.azure.resourcemanager.sphere.fluent.models; + exports com.azure.resourcemanager.sphere.models; + + opens com.azure.resourcemanager.sphere.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.sphere.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsCountDevicesSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsCountDevicesSamples.java new file mode 100644 index 000000000000..a953f4a71784 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsCountDevicesSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Catalogs CountDevices. */ +public final class CatalogsCountDevicesSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostCountDevicesCatalog.json + */ + /** + * Sample code: Catalogs_CountDevices. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsCountDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.catalogs().countDevicesWithResponse("MyResourceGroup1", "MyCatalog1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsCreateOrUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..66a5ddf183d9 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsCreateOrUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Catalogs CreateOrUpdate. */ +public final class CatalogsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutCatalog.json + */ + /** + * Sample code: Catalogs_CreateOrUpdate. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .catalogs() + .define("MyCatalog1") + .withRegion("global") + .withExistingResourceGroup("MyResourceGroup1") + .create(); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsDeleteSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsDeleteSamples.java new file mode 100644 index 000000000000..4fbc13d2ade5 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Catalogs Delete. */ +public final class CatalogsDeleteSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteCatalog.json + */ + /** + * Sample code: Catalogs_Delete. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.catalogs().delete("MyResourceGroup1", "MyCatalog1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsGetByResourceGroupSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..009565ecd4de --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Catalogs GetByResourceGroup. */ +public final class CatalogsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalog.json + */ + /** + * Sample code: Catalogs_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .catalogs() + .getByResourceGroupWithResponse("MyResourceGroup1", "MyCatalog1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListByResourceGroupSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListByResourceGroupSamples.java new file mode 100644 index 000000000000..9a546c715b60 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListByResourceGroupSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Catalogs ListByResourceGroup. */ +public final class CatalogsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalogsRG.json + */ + /** + * Sample code: Catalogs_ListByResourceGroup. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsListByResourceGroup(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.catalogs().listByResourceGroup("MyResourceGroup1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeploymentsSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeploymentsSamples.java new file mode 100644 index 000000000000..bffa0c8b515d --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeploymentsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Catalogs ListDeployments. */ +public final class CatalogsListDeploymentsSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDeploymentsByCatalog.json + */ + /** + * Sample code: Catalogs_ListDeployments. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsListDeployments(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .catalogs() + .listDeployments( + "MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceGroupsSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceGroupsSamples.java new file mode 100644 index 000000000000..3876b11b2765 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceGroupsSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +import com.azure.resourcemanager.sphere.models.ListDeviceGroupsRequest; + +/** Samples for Catalogs ListDeviceGroups. */ +public final class CatalogsListDeviceGroupsSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDeviceGroupsCatalog.json + */ + /** + * Sample code: Catalogs_ListDeviceGroups. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsListDeviceGroups(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .catalogs() + .listDeviceGroups( + "MyResourceGroup1", + "MyCatalog1", + new ListDeviceGroupsRequest().withDeviceGroupName("MyDeviceGroup1"), + null, + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceInsightsSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceInsightsSamples.java new file mode 100644 index 000000000000..79f061be1191 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDeviceInsightsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Catalogs ListDeviceInsights. */ +public final class CatalogsListDeviceInsightsSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDeviceInsightsCatalog.json + */ + /** + * Sample code: Catalogs_ListDeviceInsights. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsListDeviceInsights(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .catalogs() + .listDeviceInsights( + "MyResourceGroup1", "MyCatalog1", null, 10, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDevicesSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDevicesSamples.java new file mode 100644 index 000000000000..efacfe7b3859 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListDevicesSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Catalogs ListDevices. */ +public final class CatalogsListDevicesSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostListDevicesByCatalog.json + */ + /** + * Sample code: Catalogs_ListDevices. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsListDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .catalogs() + .listDevices("MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListSamples.java new file mode 100644 index 000000000000..cbca8f065c0e --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Catalogs List. */ +public final class CatalogsListSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCatalogsSub.json + */ + /** + * Sample code: Catalogs_ListBySubscription. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsListBySubscription(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.catalogs().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsUpdateSamples.java new file mode 100644 index 000000000000..b403f511181d --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CatalogsUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +import com.azure.resourcemanager.sphere.models.Catalog; + +/** Samples for Catalogs Update. */ +public final class CatalogsUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PatchCatalog.json + */ + /** + * Sample code: Catalogs_Update. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void catalogsUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + Catalog resource = + manager + .catalogs() + .getByResourceGroupWithResponse("MyResourceGroup1", "MyCatalog1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesGetSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesGetSamples.java new file mode 100644 index 000000000000..dd297530c5ce --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Certificates Get. */ +public final class CertificatesGetSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCertificate.json + */ + /** + * Sample code: Certificates_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void certificatesGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .certificates() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "default", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesListByCatalogSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesListByCatalogSamples.java new file mode 100644 index 000000000000..5e3fb21f0a19 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesListByCatalogSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Certificates ListByCatalog. */ +public final class CertificatesListByCatalogSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetCertificates.json + */ + /** + * Sample code: Certificates_ListByCatalog. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void certificatesListByCatalog(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .certificates() + .listByCatalog("MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveCertChainSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveCertChainSamples.java new file mode 100644 index 000000000000..a93dae662304 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveCertChainSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Certificates RetrieveCertChain. */ +public final class CertificatesRetrieveCertChainSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostRetrieveCatalogCertChain.json + */ + /** + * Sample code: Certificates_RetrieveCertChain. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void certificatesRetrieveCertChain(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .certificates() + .retrieveCertChainWithResponse( + "MyResourceGroup1", "MyCatalog1", "active", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveProofOfPossessionNonceSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveProofOfPossessionNonceSamples.java new file mode 100644 index 000000000000..e0d198475530 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/CertificatesRetrieveProofOfPossessionNonceSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +import com.azure.resourcemanager.sphere.models.ProofOfPossessionNonceRequest; + +/** Samples for Certificates RetrieveProofOfPossessionNonce. */ +public final class CertificatesRetrieveProofOfPossessionNonceSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostRetrieveProofOfPossessionNonce.json + */ + /** + * Sample code: Certificates_RetrieveProofOfPossessionNonce. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void certificatesRetrieveProofOfPossessionNonce( + com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .certificates() + .retrieveProofOfPossessionNonceWithResponse( + "MyResourceGroup1", + "MyCatalog1", + "active", + new ProofOfPossessionNonceRequest().withProofOfPossessionNonce("proofOfPossessionNonce"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsCreateOrUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..f7c1b3f6f9ba --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsCreateOrUpdateSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Deployments CreateOrUpdate. */ +public final class DeploymentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutDeployment.json + */ + /** + * Sample code: Deployments_CreateOrUpdate. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deploymentsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deployments() + .define("MyDeployment1") + .withExistingDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1") + .create(); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsDeleteSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsDeleteSamples.java new file mode 100644 index 000000000000..76bccb55eba0 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Deployments Delete. */ +public final class DeploymentsDeleteSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteDeployment.json + */ + /** + * Sample code: Deployments_Delete. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deploymentsDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deployments() + .delete( + "MyResourceGroup1", + "MyCatalog1", + "MyProductName1", + "DeviceGroupName1", + "MyDeploymentName1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsGetSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsGetSamples.java new file mode 100644 index 000000000000..275984e3dc92 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Deployments Get. */ +public final class DeploymentsGetSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeployment.json + */ + /** + * Sample code: Deployments_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deploymentsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deployments() + .getWithResponse( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + "MyDeployment1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsListByDeviceGroupSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsListByDeviceGroupSamples.java new file mode 100644 index 000000000000..609509e0cbb9 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeploymentsListByDeviceGroupSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Deployments ListByDeviceGroup. */ +public final class DeploymentsListByDeviceGroupSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeployments.json + */ + /** + * Sample code: Deployments_ListByDeviceGroup. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deploymentsListByDeviceGroup(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deployments() + .listByDeviceGroup( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + null, + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsClaimDevicesSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsClaimDevicesSamples.java new file mode 100644 index 000000000000..75face00b784 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsClaimDevicesSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +import com.azure.resourcemanager.sphere.models.ClaimDevicesRequest; +import java.util.Arrays; + +/** Samples for DeviceGroups ClaimDevices. */ +public final class DeviceGroupsClaimDevicesSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostClaimDevices.json + */ + /** + * Sample code: DeviceGroups_ClaimDevices. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsClaimDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deviceGroups() + .claimDevices( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "MyDeviceGroup1", + new ClaimDevicesRequest() + .withDeviceIdentifiers( + Arrays + .asList( + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCountDevicesSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCountDevicesSamples.java new file mode 100644 index 000000000000..b8f9b52c5f86 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCountDevicesSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for DeviceGroups CountDevices. */ +public final class DeviceGroupsCountDevicesSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostCountDevicesDeviceGroup.json + */ + /** + * Sample code: DeviceGroups_CountDevices. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsCountDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deviceGroups() + .countDevicesWithResponse( + "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCreateOrUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..7d080fbac1ff --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsCreateOrUpdateSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +import com.azure.resourcemanager.sphere.models.OSFeedType; +import com.azure.resourcemanager.sphere.models.UpdatePolicy; + +/** Samples for DeviceGroups CreateOrUpdate. */ +public final class DeviceGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutDeviceGroup.json + */ + /** + * Sample code: DeviceGroups_CreateOrUpdate. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deviceGroups() + .define("MyDeviceGroup1") + .withExistingProduct("MyResourceGroup1", "MyCatalog1", "MyProduct1") + .withDescription("Description for MyDeviceGroup1") + .withOsFeedType(OSFeedType.RETAIL) + .withUpdatePolicy(UpdatePolicy.UPDATE_ALL) + .create(); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsDeleteSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsDeleteSamples.java new file mode 100644 index 000000000000..8bca32f3dd90 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for DeviceGroups Delete. */ +public final class DeviceGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteDeviceGroup.json + */ + /** + * Sample code: DeviceGroups_Delete. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deviceGroups() + .delete("MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsGetSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsGetSamples.java new file mode 100644 index 000000000000..f670f901cc1a --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for DeviceGroups Get. */ +public final class DeviceGroupsGetSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeviceGroup.json + */ + /** + * Sample code: DeviceGroups_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deviceGroups() + .getWithResponse( + "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsListByProductSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsListByProductSamples.java new file mode 100644 index 000000000000..58f6957cba47 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsListByProductSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for DeviceGroups ListByProduct. */ +public final class DeviceGroupsListByProductSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDeviceGroups.json + */ + /** + * Sample code: DeviceGroups_ListByProduct. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsListByProduct(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .deviceGroups() + .listByProduct( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + null, + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsUpdateSamples.java new file mode 100644 index 000000000000..de3020b0344c --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DeviceGroupsUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +import com.azure.resourcemanager.sphere.models.DeviceGroup; + +/** Samples for DeviceGroups Update. */ +public final class DeviceGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PatchDeviceGroup.json + */ + /** + * Sample code: DeviceGroups_Update. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void deviceGroupsUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + DeviceGroup resource = + manager + .deviceGroups() + .getWithResponse( + "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesCreateOrUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..fa3f3e079bf0 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesCreateOrUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Devices CreateOrUpdate. */ +public final class DevicesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutDevice.json + */ + /** + * Sample code: Devices_CreateOrUpdate. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void devicesCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .devices() + .define( + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") + .withExistingDeviceGroup("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1") + .create(); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesDeleteSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesDeleteSamples.java new file mode 100644 index 000000000000..07cb659d0531 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Devices Delete. */ +public final class DevicesDeleteSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteDevice.json + */ + /** + * Sample code: Devices_Delete. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void devicesDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .devices() + .delete( + "MyResourceGroup1", + "MyCatalog1", + "MyProductName1", + "DeviceGroupName1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGenerateCapabilityImageSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGenerateCapabilityImageSamples.java new file mode 100644 index 000000000000..f1cd433d951b --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGenerateCapabilityImageSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +import com.azure.resourcemanager.sphere.models.CapabilityType; +import com.azure.resourcemanager.sphere.models.GenerateCapabilityImageRequest; +import java.util.Arrays; + +/** Samples for Devices GenerateCapabilityImage. */ +public final class DevicesGenerateCapabilityImageSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostGenerateDeviceCapabilityImage.json + */ + /** + * Sample code: Devices_GenerateCapabilityImage. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void devicesGenerateCapabilityImage(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .devices() + .generateCapabilityImage( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + new GenerateCapabilityImageRequest() + .withCapabilities(Arrays.asList(CapabilityType.APPLICATION_DEVELOPMENT)), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGetSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGetSamples.java new file mode 100644 index 000000000000..6e13f6129658 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Devices Get. */ +public final class DevicesGetSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDevice.json + */ + /** + * Sample code: Devices_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void devicesGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .devices() + .getWithResponse( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "myDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesListByDeviceGroupSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesListByDeviceGroupSamples.java new file mode 100644 index 000000000000..0ebc32822d15 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesListByDeviceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Devices ListByDeviceGroup. */ +public final class DevicesListByDeviceGroupSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetDevices.json + */ + /** + * Sample code: Devices_ListByDeviceGroup. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void devicesListByDeviceGroup(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .devices() + .listByDeviceGroup( + "MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesUpdateSamples.java new file mode 100644 index 000000000000..fac4d4f38672 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/DevicesUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +import com.azure.resourcemanager.sphere.models.Device; + +/** Samples for Devices Update. */ +public final class DevicesUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PatchDevice.json + */ + /** + * Sample code: Devices_Update. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void devicesUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + Device resource = + manager + .devices() + .getWithResponse( + "MyResourceGroup1", + "MyCatalog1", + "MyProduct1", + "MyDeviceGroup1", + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesCreateOrUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..439986767c4d --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesCreateOrUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Images CreateOrUpdate. */ +public final class ImagesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutImage.json + */ + /** + * Sample code: Image_CreateOrUpdate. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void imageCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .images() + .define("default") + .withExistingCatalog("MyResourceGroup1", "MyCatalog1") + .withImage("bXliYXNlNjRzdHJpbmc=") + .create(); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesDeleteSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesDeleteSamples.java new file mode 100644 index 000000000000..2b145b19ae59 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Images Delete. */ +public final class ImagesDeleteSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteImage.json + */ + /** + * Sample code: Images_Delete. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void imagesDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.images().delete("MyResourceGroup1", "MyCatalog1", "imageID", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesGetSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesGetSamples.java new file mode 100644 index 000000000000..6834a1b62380 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Images Get. */ +public final class ImagesGetSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetImage.json + */ + /** + * Sample code: Images_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void imagesGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .images() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "myImageId", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesListByCatalogSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesListByCatalogSamples.java new file mode 100644 index 000000000000..3df520e62c0a --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ImagesListByCatalogSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Images ListByCatalog. */ +public final class ImagesListByCatalogSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetImages.json + */ + /** + * Sample code: Images_ListByCatalog. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void imagesListByCatalog(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .images() + .listByCatalog("MyResourceGroup1", "MyCatalog1", null, null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/OperationsListSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/OperationsListSamples.java new file mode 100644 index 000000000000..1644d16ecb87 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/OperationsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetOperations.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void operationsList(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsCountDevicesSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsCountDevicesSamples.java new file mode 100644 index 000000000000..c2fbb80de7d0 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsCountDevicesSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Products CountDevices. */ +public final class ProductsCountDevicesSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostCountDevicesProduct.json + */ + /** + * Sample code: Products_CountDevices. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsCountDevices(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .products() + .countDevicesWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsCreateOrUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..f4b464e1d8b5 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsCreateOrUpdateSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Products CreateOrUpdate. */ +public final class ProductsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PutProduct.json + */ + /** + * Sample code: Products_CreateOrUpdate. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsCreateOrUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.products().define("MyProduct1").withExistingCatalog("MyResourceGroup1", "MyCatalog1").create(); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsDeleteSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsDeleteSamples.java new file mode 100644 index 000000000000..bf1b143a5ec9 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Products Delete. */ +public final class ProductsDeleteSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/DeleteProduct.json + */ + /** + * Sample code: Products_Delete. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsDelete(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.products().delete("MyResourceGroup1", "MyCatalog1", "MyProductName1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGenerateDefaultDeviceGroupsSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGenerateDefaultDeviceGroupsSamples.java new file mode 100644 index 000000000000..dea33d91b425 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGenerateDefaultDeviceGroupsSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Products GenerateDefaultDeviceGroups. */ +public final class ProductsGenerateDefaultDeviceGroupsSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PostGenerateDefaultDeviceGroups.json + */ + /** + * Sample code: Products_GenerateDefaultDeviceGroups. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsGenerateDefaultDeviceGroups( + com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .products() + .generateDefaultDeviceGroups( + "MyResourceGroup1", "MyCatalog1", "MyProduct1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGetSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGetSamples.java new file mode 100644 index 000000000000..0adf122c027f --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Products Get. */ +public final class ProductsGetSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetProduct.json + */ + /** + * Sample code: Products_Get. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsGet(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager + .products() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsListByCatalogSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsListByCatalogSamples.java new file mode 100644 index 000000000000..77d7f7e2b106 --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsListByCatalogSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +/** Samples for Products ListByCatalog. */ +public final class ProductsListByCatalogSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/GetProducts.json + */ + /** + * Sample code: Products_ListByCatalog. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsListByCatalog(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + manager.products().listByCatalog("MyResourceGroup1", "MyCatalog1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsUpdateSamples.java b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsUpdateSamples.java new file mode 100644 index 000000000000..96e2a0ca437a --- /dev/null +++ b/sdk/sphere/azure-resourcemanager-sphere/src/samples/java/com/azure/resourcemanager/sphere/generated/ProductsUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sphere.generated; + +import com.azure.resourcemanager.sphere.models.Product; + +/** Samples for Products Update. */ +public final class ProductsUpdateSamples { + /* + * x-ms-original-file: specification/sphere/resource-manager/Microsoft.AzureSphere/preview/2022-09-01-preview/examples/PatchProduct.json + */ + /** + * Sample code: Products_Update. + * + * @param manager Entry point to AzureSphereManager. + */ + public static void productsUpdate(com.azure.resourcemanager.sphere.AzureSphereManager manager) { + Product resource = + manager + .products() + .getWithResponse("MyResourceGroup1", "MyCatalog1", "MyProduct1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/sphere/ci.yml b/sdk/sphere/ci.yml new file mode 100644 index 000000000000..8529528dba05 --- /dev/null +++ b/sdk/sphere/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/sphere/ci.yml + - sdk/sphere/azure-resourcemanager-sphere/ + exclude: + - sdk/sphere/pom.xml + - sdk/sphere/azure-resourcemanager-sphere/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sphere/ci.yml + - sdk/sphere/azure-resourcemanager-sphere/ + exclude: + - sdk/sphere/pom.xml + - sdk/sphere/azure-resourcemanager-sphere/pom.xml + +parameters: + - name: release_azureresourcemanagersphere + displayName: azure-resourcemanager-sphere + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: sphere + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-sphere + groupId: com.azure.resourcemanager + safeName: azureresourcemanagersphere + releaseInBatch: ${{ parameters.release_azureresourcemanagersphere }} diff --git a/sdk/sphere/pom.xml b/sdk/sphere/pom.xml new file mode 100644 index 000000000000..46347a697234 --- /dev/null +++ b/sdk/sphere/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-sphere-service + pom + 1.0.0 + + + azure-resourcemanager-sphere + +