From 5526c6263bcb6e9be56a7e1b30c55e79f5dde24d Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Sun, 15 Dec 2024 22:31:34 -0800 Subject: [PATCH] [Automation] Generate Fluent Lite from TypeSpec deviceregistry (#43409) * [Automation] External Change * [Automation] Generate Fluent Lite from TypeSpec deviceregistry --- .../CHANGELOG.md | 372 ++++- .../README.md | 13 +- .../SAMPLE.md | 1271 +++++++++++++++- .../pom.xml | 15 +- .../deviceregistry/DeviceRegistryManager.java | 113 +- .../fluent/BillingContainersClient.java | 64 + ...va => DeviceRegistryManagementClient.java} | 46 +- ...DiscoveredAssetEndpointProfilesClient.java | 281 ++++ .../fluent/DiscoveredAssetsClient.java | 271 ++++ .../fluent/SchemaRegistriesClient.java | 271 ++++ .../fluent/SchemaVersionsClient.java | 147 ++ .../deviceregistry/fluent/SchemasClient.java | 137 ++ .../fluent/models/BillingContainerInner.java | 172 +++ .../DiscoveredAssetEndpointProfileInner.java | 234 +++ .../fluent/models/DiscoveredAssetInner.java | 231 +++ .../models/OperationStatusResultInner.java | 17 + .../fluent/models/SchemaInner.java | 166 ++ .../fluent/models/SchemaRegistryInner.java | 224 +++ .../fluent/models/SchemaVersionInner.java | 166 ++ .../AssetEndpointProfilesClientImpl.java | 10 +- .../implementation/AssetsClientImpl.java | 10 +- .../implementation/BillingContainerImpl.java | 54 + .../BillingContainersClientImpl.java | 359 +++++ .../implementation/BillingContainersImpl.java | 66 + ...eviceRegistryManagementClientBuilder.java} | 40 +- ...> DeviceRegistryManagementClientImpl.java} | 112 +- .../DiscoveredAssetEndpointProfileImpl.java | 197 +++ ...overedAssetEndpointProfilesClientImpl.java | 1337 +++++++++++++++++ .../DiscoveredAssetEndpointProfilesImpl.java | 160 ++ .../implementation/DiscoveredAssetImpl.java | 193 +++ .../DiscoveredAssetsClientImpl.java | 1296 ++++++++++++++++ .../implementation/DiscoveredAssetsImpl.java | 147 ++ .../OperationStatusClientImpl.java | 10 +- .../OperationStatusResultImpl.java | 4 + .../implementation/OperationsClientImpl.java | 10 +- .../implementation/SchemaImpl.java | 106 ++ .../SchemaRegistriesClientImpl.java | 1294 ++++++++++++++++ .../implementation/SchemaRegistriesImpl.java | 146 ++ .../implementation/SchemaRegistryImpl.java | 198 +++ .../implementation/SchemaVersionImpl.java | 112 ++ .../SchemaVersionsClientImpl.java | 797 ++++++++++ .../implementation/SchemaVersionsImpl.java | 186 +++ .../implementation/SchemasClientImpl.java | 731 +++++++++ .../implementation/SchemasImpl.java | 160 ++ .../models/BillingContainerListResult.java | 114 ++ ...coveredAssetEndpointProfileListResult.java | 116 ++ .../models/DiscoveredAssetListResult.java | 114 ++ .../models/SchemaListResult.java | 112 ++ .../models/SchemaRegistryListResult.java | 113 ++ .../models/SchemaVersionListResult.java | 112 ++ .../AssetEndpointProfileProperties.java | 132 +- .../models/AssetEndpointProfileStatus.java | 87 ++ .../AssetEndpointProfileStatusError.java | 100 ++ .../AssetEndpointProfileUpdateProperties.java | 76 +- .../models/AssetProperties.java | 236 +-- .../deviceregistry/models/AssetStatus.java | 49 +- .../models/AssetStatusDataset.java | 103 ++ .../models/AssetStatusError.java | 2 - .../models/AssetStatusEvent.java | 103 ++ .../models/AssetUpdateProperties.java | 161 +- ...uthentication.java => Authentication.java} | 64 +- .../models/AuthenticationMethod.java | 56 + .../models/BillingContainer.java | 62 + .../models/BillingContainerProperties.java | 82 + .../models/BillingContainers.java | 57 + .../deviceregistry/models/DataPoint.java | 154 +- .../deviceregistry/models/DataPointBase.java | 169 +++ .../models/DataPointObservabilityMode.java | 66 + .../models/DataPointsObservabilityMode.java | 66 - .../deviceregistry/models/Dataset.java | 197 +++ .../models/DiscoveredAsset.java | 285 ++++ .../DiscoveredAssetEndpointProfile.java | 285 ++++ ...coveredAssetEndpointProfileProperties.java | 289 ++++ .../DiscoveredAssetEndpointProfileUpdate.java | 130 ++ ...dAssetEndpointProfileUpdateProperties.java | 255 ++++ .../DiscoveredAssetEndpointProfiles.java | 163 ++ .../models/DiscoveredAssetProperties.java | 571 +++++++ .../models/DiscoveredAssetUpdate.java | 126 ++ .../DiscoveredAssetUpdateProperties.java | 508 +++++++ .../models/DiscoveredAssets.java | 158 ++ .../models/DiscoveredDataPoint.java | 202 +++ .../models/DiscoveredDataset.java | 199 +++ .../models/DiscoveredEvent.java | 231 +++ .../deviceregistry/models/Event.java | 159 +- .../deviceregistry/models/EventBase.java | 198 +++ .../models/EventObservabilityMode.java | 51 + .../models/EventsObservabilityMode.java | 51 - .../deviceregistry/models/Format.java | 51 + .../models/MessageSchemaReference.java | 114 ++ .../models/OperationStatusResult.java | 8 + .../deviceregistry/models/OwnCertificate.java | 150 -- .../models/ProvisioningState.java | 5 + .../deviceregistry/models/Schema.java | 137 ++ .../models/SchemaProperties.java | 251 ++++ .../models/SchemaRegistries.java | 158 ++ .../deviceregistry/models/SchemaRegistry.java | 299 ++++ .../models/SchemaRegistryProperties.java | 224 +++ .../models/SchemaRegistryUpdate.java | 157 ++ .../SchemaRegistryUpdateProperties.java | 122 ++ .../deviceregistry/models/SchemaType.java | 46 + .../deviceregistry/models/SchemaVersion.java | 138 ++ .../models/SchemaVersionProperties.java | 179 +++ .../deviceregistry/models/SchemaVersions.java | 154 ++ .../deviceregistry/models/Schemas.java | 147 ++ .../models/SystemAssignedServiceIdentity.java | 140 ++ .../SystemAssignedServiceIdentityType.java | 51 + .../deviceregistry/models/Topic.java | 130 ++ .../models/TopicRetainType.java | 51 + .../models/TransportAuthentication.java | 114 -- .../models/UserAuthenticationMode.java | 56 - .../models/UsernamePasswordCredentials.java | 60 +- .../models/X509Credentials.java | 30 +- .../proxy-config.json | 2 +- ...ndpointProfilesCreateOrReplaceSamples.java | 35 +- .../AssetEndpointProfilesDeleteSamples.java | 2 +- ...ointProfilesGetByResourceGroupSamples.java | 17 +- ...intProfilesListByResourceGroupSamples.java | 2 +- .../AssetEndpointProfilesListSamples.java | 2 +- .../AssetEndpointProfilesUpdateSamples.java | 2 +- .../AssetsCreateOrReplaceSamples.java | 248 ++- .../generated/AssetsDeleteSamples.java | 2 +- .../AssetsGetByResourceGroupSamples.java | 4 +- .../AssetsListByResourceGroupSamples.java | 2 +- .../generated/AssetsListSamples.java | 2 +- .../generated/AssetsUpdateSamples.java | 2 +- .../BillingContainersGetSamples.java | 22 + .../BillingContainersListSamples.java | 23 + ...ndpointProfilesCreateOrReplaceSamples.java | 58 + ...redAssetEndpointProfilesDeleteSamples.java | 24 + ...ointProfilesGetByResourceGroupSamples.java | 25 + ...intProfilesListByResourceGroupSamples.java | 24 + ...veredAssetEndpointProfilesListSamples.java | 23 + ...redAssetEndpointProfilesUpdateSamples.java | 41 + ...iscoveredAssetsCreateOrReplaceSamples.java | 88 ++ .../DiscoveredAssetsDeleteSamples.java | 22 + ...overedAssetsGetByResourceGroupSamples.java | 23 + ...veredAssetsListByResourceGroupSamples.java | 23 + .../DiscoveredAssetsListSamples.java | 23 + .../DiscoveredAssetsUpdateSamples.java | 34 + .../generated/OperationStatusGetSamples.java | 2 +- .../generated/OperationsListSamples.java | 2 +- ...chemaRegistriesCreateOrReplaceSamples.java | 50 + .../SchemaRegistriesDeleteSamples.java | 22 + ...maRegistriesGetByResourceGroupSamples.java | 23 + ...aRegistriesListByResourceGroupSamples.java | 23 + .../SchemaRegistriesListSamples.java | 23 + .../SchemaRegistriesUpdateSamples.java | 46 + .../SchemaVersionsCreateOrReplaceSamples.java | 30 + .../SchemaVersionsDeleteSamples.java | 24 + .../generated/SchemaVersionsGetSamples.java | 24 + .../SchemaVersionsListBySchemaSamples.java | 24 + .../SchemasCreateOrReplaceSamples.java | 48 + .../generated/SchemasDeleteSamples.java | 23 + .../generated/SchemasGetSamples.java | 23 + .../SchemasListBySchemaRegistrySamples.java | 24 + .../generated/AssetStatusDatasetTests.java | 17 + .../generated/AssetStatusEventTests.java | 17 + .../generated/BillingContainerInnerTests.java | 17 + .../BillingContainerListResultTests.java | 19 + .../BillingContainerPropertiesTests.java | 16 + ...ingContainersGetWithResponseMockTests.java | 36 + .../BillingContainersListMockTests.java | 36 + .../generated/DataPointBaseTests.java | 32 + .../generated/DataPointTests.java | 31 +- .../generated/DatasetTests.java | 56 + ...coveredAssetEndpointProfileInnerTests.java | 73 + ...edAssetEndpointProfileListResultTests.java | 31 + ...edAssetEndpointProfilePropertiesTests.java | 44 + ...tEndpointProfileUpdatePropertiesTests.java | 45 + ...overedAssetEndpointProfileUpdateTests.java | 66 + ...pointProfilesCreateOrReplaceMockTests.java | 78 + ...tByResourceGroupWithResponseMockTests.java | 50 + ...tProfilesListByResourceGroupMockTests.java | 50 + ...redAssetEndpointProfilesListMockTests.java | 50 + .../generated/DiscoveredDataPointTests.java | 36 + .../generated/DiscoveredDatasetTests.java | 66 + .../generated/DiscoveredEventTests.java | 43 + .../generated/EventBaseTests.java | 39 + .../deviceregistry/generated/EventTests.java | 38 +- .../generated/ExtendedLocationTests.java | 12 +- .../MessageSchemaReferenceTests.java | 17 + .../generated/OperationDisplayTests.java | 5 - .../generated/OperationInnerTests.java | 7 - .../generated/OperationListResultTests.java | 6 - ...erationStatusGetWithResponseMockTests.java | 59 - .../OperationStatusResultInnerTests.java | 40 - .../generated/OperationsListMockTests.java | 9 +- .../generated/SchemaInnerTests.java | 55 + .../generated/SchemaListResultTests.java | 26 + .../generated/SchemaPropertiesTests.java | 55 + ...emaRegistriesCreateOrReplaceMockTests.java | 70 + ...tByResourceGroupWithResponseMockTests.java | 46 + ...egistriesListByResourceGroupMockTests.java | 47 + .../SchemaRegistriesListMockTests.java | 46 + .../generated/SchemaRegistryInnerTests.java | 63 + .../SchemaRegistryListResultTests.java | 27 + .../SchemaRegistryPropertiesTests.java | 35 + .../SchemaRegistryUpdatePropertiesTests.java | 29 + .../generated/SchemaRegistryUpdateTests.java | 55 + .../generated/SchemaVersionInnerTests.java | 30 + .../SchemaVersionListResultTests.java | 21 + .../SchemaVersionPropertiesTests.java | 29 + ...sCreateOrReplaceWithResponseMockTests.java | 43 + ...maVersionsDeleteWithResponseMockTests.java | 34 + ...chemaVersionsGetWithResponseMockTests.java | 41 + .../SchemaVersionsListBySchemaMockTests.java | 40 + ...sCreateOrReplaceWithResponseMockTests.java | 66 + .../SchemasDeleteWithResponseMockTests.java | 33 + .../SchemasGetWithResponseMockTests.java | 45 + .../SchemasListBySchemaRegistryMockTests.java | 45 + .../SystemAssignedServiceIdentityTests.java | 28 + .../deviceregistry/generated/TopicTests.java | 27 + .../generated/X509CredentialsTests.java | 25 - .../tsp-location.yaml | 6 +- 214 files changed, 23418 insertions(+), 1458 deletions(-) create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/BillingContainersClient.java rename sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/{DeviceRegistryClient.java => DeviceRegistryManagementClient.java} (57%) create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DiscoveredAssetEndpointProfilesClient.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DiscoveredAssetsClient.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/SchemaRegistriesClient.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/SchemaVersionsClient.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/SchemasClient.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/BillingContainerInner.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/DiscoveredAssetEndpointProfileInner.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/DiscoveredAssetInner.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/SchemaInner.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/SchemaRegistryInner.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/SchemaVersionInner.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/BillingContainerImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/BillingContainersClientImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/BillingContainersImpl.java rename sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/{DeviceRegistryClientBuilder.java => DeviceRegistryManagementClientBuilder.java} (67%) rename sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/{DeviceRegistryClientImpl.java => DeviceRegistryManagementClientImpl.java} (74%) create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetEndpointProfileImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetEndpointProfilesClientImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetEndpointProfilesImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetsClientImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetsImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaRegistriesClientImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaRegistriesImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaRegistryImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaVersionImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaVersionsClientImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaVersionsImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemasClientImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemasImpl.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/BillingContainerListResult.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/DiscoveredAssetEndpointProfileListResult.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/DiscoveredAssetListResult.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/SchemaListResult.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/SchemaRegistryListResult.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/SchemaVersionListResult.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileStatus.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileStatusError.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatusDataset.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatusEvent.java rename sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/{UserAuthentication.java => Authentication.java} (66%) create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AuthenticationMethod.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/BillingContainer.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/BillingContainerProperties.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/BillingContainers.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPointBase.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPointObservabilityMode.java delete mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPointsObservabilityMode.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Dataset.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAsset.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfile.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfileProperties.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfileUpdate.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfileUpdateProperties.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfiles.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetProperties.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetUpdate.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetUpdateProperties.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssets.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredDataPoint.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredDataset.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredEvent.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/EventBase.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/EventObservabilityMode.java delete mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/EventsObservabilityMode.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Format.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/MessageSchemaReference.java delete mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/OwnCertificate.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Schema.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaProperties.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistries.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistry.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistryProperties.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistryUpdate.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistryUpdateProperties.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaType.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaVersion.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaVersionProperties.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaVersions.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Schemas.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SystemAssignedServiceIdentity.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SystemAssignedServiceIdentityType.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Topic.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/TopicRetainType.java delete mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/TransportAuthentication.java delete mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/UserAuthenticationMode.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersGetSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersListSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesCreateOrReplaceSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesDeleteSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesGetByResourceGroupSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListByResourceGroupSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesUpdateSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsCreateOrReplaceSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsDeleteSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsGetByResourceGroupSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsListByResourceGroupSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsListSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsUpdateSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesCreateOrReplaceSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesDeleteSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesGetByResourceGroupSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListByResourceGroupSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesUpdateSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsCreateOrReplaceSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsDeleteSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsGetSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsListBySchemaSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasCreateOrReplaceSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasDeleteSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasGetSamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasListBySchemaRegistrySamples.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/AssetStatusDatasetTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/AssetStatusEventTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainerInnerTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainerListResultTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainerPropertiesTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersGetWithResponseMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersListMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DataPointBaseTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DatasetTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileInnerTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileListResultTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilePropertiesTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileUpdatePropertiesTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileUpdateTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesCreateOrReplaceMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesGetByResourceGroupWithResponseMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListByResourceGroupMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredDataPointTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredDatasetTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredEventTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/EventBaseTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/MessageSchemaReferenceTests.java delete mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationStatusGetWithResponseMockTests.java delete mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationStatusResultInnerTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaInnerTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaListResultTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaPropertiesTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesCreateOrReplaceMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesGetByResourceGroupWithResponseMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListByResourceGroupMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryInnerTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryListResultTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryPropertiesTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryUpdatePropertiesTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryUpdateTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionInnerTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionListResultTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionPropertiesTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsCreateOrReplaceWithResponseMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsDeleteWithResponseMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsGetWithResponseMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsListBySchemaMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasCreateOrReplaceWithResponseMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasDeleteWithResponseMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasGetWithResponseMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasListBySchemaRegistryMockTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SystemAssignedServiceIdentityTests.java create mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/TopicTests.java delete mode 100644 sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/X509CredentialsTests.java diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/CHANGELOG.md b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/CHANGELOG.md index 4f189d7621beb..7368b17e8e72a 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/CHANGELOG.md +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/CHANGELOG.md @@ -1,14 +1,378 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.2 (2024-12-16) -### Features Added +- Azure Resource Manager Device Registry client library for Java. This package contains Microsoft Azure SDK for Device Registry Management SDK. Microsoft.DeviceRegistry Resource Provider management API. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### `models.EventsObservabilityMode` was removed + +#### `models.OwnCertificate` was removed + +#### `models.UserAuthentication` was removed + +#### `models.UserAuthenticationMode` was removed + +#### `models.TransportAuthentication` was removed + +#### `implementation.models.PagedOperation` was removed + +#### `models.DataPointsObservabilityMode` was removed + +#### `models.Event` was modified + +* `eventNotifier()` was removed +* `withObservabilityMode(models.EventsObservabilityMode)` was removed +* `capabilityId()` was removed +* `withCapabilityId(java.lang.String)` was removed +* `eventConfiguration()` was removed +* `name()` was removed +* `models.EventsObservabilityMode observabilityMode()` -> `models.EventObservabilityMode observabilityMode()` + +#### `models.AssetProperties` was modified + +* `defaultDataPointsConfiguration()` was removed +* `withAssetType(java.lang.String)` was removed +* `assetType()` was removed +* `java.lang.Integer version()` -> `java.lang.Long version()` +* `withDefaultDataPointsConfiguration(java.lang.String)` was removed +* `dataPoints()` was removed +* `withAssetEndpointProfileUri(java.lang.String)` was removed +* `assetEndpointProfileUri()` was removed +* `withDataPoints(java.util.List)` was removed + +#### `models.X509Credentials` was modified + +* `withCertificateReference(java.lang.String)` was removed +* `certificateReference()` was removed + +#### `models.AssetStatus` was modified + +* `java.lang.Integer version()` -> `java.lang.Long version()` + +#### `models.OperationStatusResult` was modified + +* `java.lang.Integer percentComplete()` -> `java.lang.Double percentComplete()` + +#### `DeviceRegistryManager` was modified + +* `fluent.DeviceRegistryClient serviceClient()` -> `fluent.DeviceRegistryManagementClient serviceClient()` + +#### `models.AssetEndpointProfileProperties` was modified + +* `transportAuthentication()` was removed +* `userAuthentication()` was removed +* `withTransportAuthentication(models.TransportAuthentication)` was removed +* `withUserAuthentication(models.UserAuthentication)` was removed + +#### `models.AssetUpdateProperties` was modified + +* `withDefaultDataPointsConfiguration(java.lang.String)` was removed +* `assetType()` was removed +* `dataPoints()` was removed +* `withAssetType(java.lang.String)` was removed +* `defaultDataPointsConfiguration()` was removed +* `withDataPoints(java.util.List)` was removed + +#### `models.UsernamePasswordCredentials` was modified + +* `usernameReference()` was removed +* `withPasswordReference(java.lang.String)` was removed +* `withUsernameReference(java.lang.String)` was removed +* `passwordReference()` was removed + +#### `models.AssetEndpointProfileUpdateProperties` was modified + +* `userAuthentication()` was removed +* `withUserAuthentication(models.UserAuthentication)` was removed +* `withTransportAuthentication(models.TransportAuthentication)` was removed +* `transportAuthentication()` was removed + +#### `models.DataPoint` was modified + +* `withCapabilityId(java.lang.String)` was removed +* `dataSource()` was removed +* `capabilityId()` was removed +* `dataPointConfiguration()` was removed +* `withObservabilityMode(models.DataPointsObservabilityMode)` was removed +* `models.DataPointsObservabilityMode observabilityMode()` -> `models.DataPointObservabilityMode observabilityMode()` +* `name()` was removed + +### Features Added + +* `models.AssetEndpointProfileStatus` was added + +* `models.DiscoveredEvent` was added + +* `models.Dataset` was added + +* `models.Schema` was added + +* `models.DataPointObservabilityMode` was added + +* `models.Authentication` was added + +* `models.DiscoveredAsset$Definition` was added + +* `models.SchemaProperties` was added + +* `models.DiscoveredAsset$DefinitionStages` was added + +* `models.DiscoveredAssets` was added + +* `implementation.models.SchemaListResult` was added + +* `models.SystemAssignedServiceIdentityType` was added + +* `models.SchemaRegistry$Definition` was added + +* `models.AuthenticationMethod` was added + +* `implementation.models.DiscoveredAssetEndpointProfileListResult` was added + +* `models.DataPointBase` was added + +* `models.EventBase` was added + +* `implementation.models.OperationListResult` was added + +* `models.DiscoveredAssetEndpointProfile$Definition` was added + +* `models.SchemaVersion` was added + +* `models.DiscoveredDataPoint` was added + +* `models.Schema$DefinitionStages` was added + +* `models.Format` was added + +* `models.EventObservabilityMode` was added + +* `models.TopicRetainType` was added + +* `models.SchemaRegistryUpdateProperties` was added + +* `models.DiscoveredAssetEndpointProfile` was added + +* `models.SystemAssignedServiceIdentity` was added + +* `models.SchemaRegistryProperties` was added + +* `models.DiscoveredAssetEndpointProfile$DefinitionStages` was added + +* `models.DiscoveredAssetEndpointProfiles` was added + +* `models.SchemaVersion$DefinitionStages` was added + +* `models.SchemaVersionProperties` was added + +* `models.AssetStatusDataset` was added + +* `implementation.models.SchemaVersionListResult` was added + +* `models.DiscoveredAssetProperties` was added + +* `models.DiscoveredAssetEndpointProfile$UpdateStages` was added + +* `models.DiscoveredAssetEndpointProfileProperties` was added + +* `models.AssetEndpointProfileStatusError` was added + +* `models.SchemaRegistry$UpdateStages` was added + +* `models.DiscoveredAssetEndpointProfileUpdateProperties` was added + +* `models.BillingContainer` was added + +* `models.AssetStatusEvent` was added + +* `models.DiscoveredAsset$Update` was added + +* `models.BillingContainerProperties` was added + +* `implementation.models.SchemaRegistryListResult` was added + +* `models.DiscoveredAssetUpdateProperties` was added + +* `models.SchemaRegistry$Update` was added + +* `models.SchemaType` was added + +* `models.SchemaRegistries` was added + +* `models.SchemaRegistryUpdate` was added + +* `models.DiscoveredAsset$UpdateStages` was added + +* `models.Schema$Definition` was added + +* `models.SchemaVersion$Definition` was added + +* `models.Schemas` was added + +* `models.BillingContainers` was added + +* `models.DiscoveredAssetEndpointProfile$Update` was added + +* `models.SchemaRegistry$DefinitionStages` was added + +* `models.SchemaVersions` was added + +* `models.MessageSchemaReference` was added + +* `models.DiscoveredAssetUpdate` was added + +* `models.DiscoveredAssetEndpointProfileUpdate` was added + +* `models.SchemaRegistry` was added + +* `implementation.models.BillingContainerListResult` was added + +* `implementation.models.DiscoveredAssetListResult` was added + +* `models.DiscoveredDataset` was added + +* `models.Topic` was added + +* `models.DiscoveredAsset` was added + +#### `models.Event` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `withEventConfiguration(java.lang.String)` was added +* `withTopic(models.Topic)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `withName(java.lang.String)` was added +* `withObservabilityMode(models.EventObservabilityMode)` was added +* `withEventNotifier(java.lang.String)` was added + +#### `models.AssetProperties` was modified + +* `defaultTopic()` was added +* `withDefaultTopic(models.Topic)` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `discoveredAssetRefs()` was added +* `withDiscoveredAssetRefs(java.util.List)` was added +* `assetEndpointProfileRef()` was added +* `withDefaultDatasetsConfiguration(java.lang.String)` was added +* `datasets()` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `withDatasets(java.util.List)` was added +* `withAssetEndpointProfileRef(java.lang.String)` was added +* `defaultDatasetsConfiguration()` was added + +#### `models.X509Credentials` was modified + +* `certificateSecretName()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `withCertificateSecretName(java.lang.String)` was added + +#### `implementation.models.AssetListResult` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AssetStatus` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `events()` was added +* `datasets()` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.OperationStatusResult` was modified + +* `resourceId()` was added + +#### `models.AssetStatusError` was modified + +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added + +#### `models.AssetUpdate` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `DeviceRegistryManager` was modified + +* `discoveredAssets()` was added +* `schemaRegistries()` was added +* `billingContainers()` was added +* `discoveredAssetEndpointProfiles()` was added +* `schemas()` was added +* `schemaVersions()` was added + +#### `models.AssetEndpointProfileProperties` was modified + +* `discoveredAssetEndpointProfileRef()` was added +* `withEndpointProfileType(java.lang.String)` was added +* `endpointProfileType()` was added +* `status()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `withDiscoveredAssetEndpointProfileRef(java.lang.String)` was added +* `withAuthentication(models.Authentication)` was added +* `authentication()` was added + +#### `models.AssetUpdateProperties` was modified + +* `defaultDatasetsConfiguration()` was added +* `withDefaultTopic(models.Topic)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `defaultTopic()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `datasets()` was added +* `withDefaultDatasetsConfiguration(java.lang.String)` was added +* `withDatasets(java.util.List)` was added + +#### `models.UsernamePasswordCredentials` was modified + +* `withUsernameSecretName(java.lang.String)` was added +* `passwordSecretName()` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `usernameSecretName()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `withPasswordSecretName(java.lang.String)` was added + +#### `models.ExtendedLocation` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.AssetEndpointProfileUpdateProperties` was modified + +* `endpointProfileType()` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `withAuthentication(models.Authentication)` was added +* `authentication()` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `withEndpointProfileType(java.lang.String)` was added + +#### `models.AssetEndpointProfileUpdate` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.OperationDisplay` was modified + +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added + +#### `models.DataPoint` was modified + +* `withDataPointConfiguration(java.lang.String)` was added +* `withObservabilityMode(models.DataPointObservabilityMode)` was added +* `toJson(com.azure.json.JsonWriter)` was added +* `fromJson(com.azure.json.JsonReader)` was added +* `withName(java.lang.String)` was added +* `withDataSource(java.lang.String)` was added + +#### `implementation.models.AssetEndpointProfileListResult` was modified -### Other Changes +* `fromJson(com.azure.json.JsonReader)` was added +* `toJson(com.azure.json.JsonWriter)` was added ## 1.0.0-beta.1 (2024-04-26) diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/README.md b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/README.md index 92dc385be4a97..de2739da6ed84 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/README.md +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-deviceregistry - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen ### Authentication -By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables. +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. -- `AZURE_CLIENT_ID` for Azure client ID. -- `AZURE_TENANT_ID` for Azure tenant ID. -- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. -In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. - -With above configuration, `azure` client can be authenticated using the following code: +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); @@ -97,6 +93,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ [azure_subscription]: https://azure.microsoft.com/free/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials [azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty [authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md [design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/SAMPLE.md b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/SAMPLE.md index 39981bf8d4132..79279e2d46d70 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/SAMPLE.md +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/SAMPLE.md @@ -19,6 +19,29 @@ - [ListByResourceGroup](#assets_listbyresourcegroup) - [Update](#assets_update) +## BillingContainers + +- [Get](#billingcontainers_get) +- [List](#billingcontainers_list) + +## DiscoveredAssetEndpointProfiles + +- [CreateOrReplace](#discoveredassetendpointprofiles_createorreplace) +- [Delete](#discoveredassetendpointprofiles_delete) +- [GetByResourceGroup](#discoveredassetendpointprofiles_getbyresourcegroup) +- [List](#discoveredassetendpointprofiles_list) +- [ListByResourceGroup](#discoveredassetendpointprofiles_listbyresourcegroup) +- [Update](#discoveredassetendpointprofiles_update) + +## DiscoveredAssets + +- [CreateOrReplace](#discoveredassets_createorreplace) +- [Delete](#discoveredassets_delete) +- [GetByResourceGroup](#discoveredassets_getbyresourcegroup) +- [List](#discoveredassets_list) +- [ListByResourceGroup](#discoveredassets_listbyresourcegroup) +- [Update](#discoveredassets_update) + ## OperationStatus - [Get](#operationstatus_get) @@ -26,13 +49,36 @@ ## Operations - [List](#operations_list) + +## SchemaRegistries + +- [CreateOrReplace](#schemaregistries_createorreplace) +- [Delete](#schemaregistries_delete) +- [GetByResourceGroup](#schemaregistries_getbyresourcegroup) +- [List](#schemaregistries_list) +- [ListByResourceGroup](#schemaregistries_listbyresourcegroup) +- [Update](#schemaregistries_update) + +## SchemaVersions + +- [CreateOrReplace](#schemaversions_createorreplace) +- [Delete](#schemaversions_delete) +- [Get](#schemaversions_get) +- [ListBySchema](#schemaversions_listbyschema) + +## Schemas + +- [CreateOrReplace](#schemas_createorreplace) +- [Delete](#schemas_delete) +- [Get](#schemas_get) +- [ListBySchemaRegistry](#schemas_listbyschemaregistry) ### AssetEndpointProfiles_CreateOrReplace ```java import com.azure.resourcemanager.deviceregistry.models.AssetEndpointProfileProperties; +import com.azure.resourcemanager.deviceregistry.models.Authentication; +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; -import com.azure.resourcemanager.deviceregistry.models.UserAuthentication; -import com.azure.resourcemanager.deviceregistry.models.UserAuthenticationMode; import java.util.HashMap; import java.util.Map; @@ -41,9 +87,33 @@ import java.util.Map; */ public final class AssetEndpointProfilesCreateOrReplaceSamples { /* - * x-ms-original-file: - * specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Create_AssetEndpointProfile. - * json + * x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile_With_DiscoveredAepRef.json + */ + /** + * Sample code: Create_AssetEndpointProfile_With_DiscoveredAepRef. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void createAssetEndpointProfileWithDiscoveredAepRef( + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.assetEndpointProfiles() + .define("my-assetendpointprofile") + .withRegion("West Europe") + .withExistingResourceGroup("myResourceGroup") + .withExtendedLocation(new ExtendedLocation().withType("CustomLocation") + .withName( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + .withTags(mapOf("site", "building-1")) + .withProperties( + new AssetEndpointProfileProperties().withTargetAddress("https://www.example.com/myTargetAddress") + .withEndpointProfileType("myEndpointProfileType") + .withAuthentication(new Authentication().withMethod(AuthenticationMethod.ANONYMOUS)) + .withDiscoveredAssetEndpointProfileRef("discoveredAssetEndpointProfile1")) + .create(); + } + + /* + * x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile.json */ /** * Sample code: Create_AssetEndpointProfile. @@ -62,7 +132,8 @@ public final class AssetEndpointProfilesCreateOrReplaceSamples { .withTags(mapOf("site", "building-1")) .withProperties( new AssetEndpointProfileProperties().withTargetAddress("https://www.example.com/myTargetAddress") - .withUserAuthentication(new UserAuthentication().withMode(UserAuthenticationMode.ANONYMOUS))) + .withEndpointProfileType("myEndpointProfileType") + .withAuthentication(new Authentication().withMethod(AuthenticationMethod.ANONYMOUS))) .create(); } @@ -88,9 +159,7 @@ public final class AssetEndpointProfilesCreateOrReplaceSamples { */ public final class AssetEndpointProfilesDeleteSamples { /* - * x-ms-original-file: - * specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Delete_AssetEndpointProfile. - * json + * x-ms-original-file: 2024-09-01-preview/Delete_AssetEndpointProfile.json */ /** * Sample code: Delete_AssetEndpointProfile. @@ -113,8 +182,7 @@ public final class AssetEndpointProfilesDeleteSamples { */ public final class AssetEndpointProfilesGetByResourceGroupSamples { /* - * x-ms-original-file: - * specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Get_AssetEndpointProfile.json + * x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile.json */ /** * Sample code: Get_AssetEndpointProfile. @@ -126,6 +194,21 @@ public final class AssetEndpointProfilesGetByResourceGroupSamples { .getByResourceGroupWithResponse("myResourceGroup", "my-assetendpointprofile", com.azure.core.util.Context.NONE); } + + /* + * x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile_With_SyncStatus.json + */ + /** + * Sample code: Get_AssetEndpointProfile_With_SyncStatus. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + getAssetEndpointProfileWithSyncStatus(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.assetEndpointProfiles() + .getByResourceGroupWithResponse("myResourceGroup", "my-assetendpointprofile", + com.azure.core.util.Context.NONE); + } } ``` @@ -137,8 +220,7 @@ public final class AssetEndpointProfilesGetByResourceGroupSamples { */ public final class AssetEndpointProfilesListSamples { /* - * x-ms-original-file: specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/ - * List_AssetEndpointProfiles_Subscription.json + * x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_Subscription.json */ /** * Sample code: List_AssetEndpointProfiles_Subscription. @@ -160,8 +242,7 @@ public final class AssetEndpointProfilesListSamples { */ public final class AssetEndpointProfilesListByResourceGroupSamples { /* - * x-ms-original-file: specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/ - * List_AssetEndpointProfiles_ResourceGroup.json + * x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_ResourceGroup.json */ /** * Sample code: List_AssetEndpointProfiles_ResourceGroup. @@ -186,9 +267,7 @@ import com.azure.resourcemanager.deviceregistry.models.AssetEndpointProfileUpdat */ public final class AssetEndpointProfilesUpdateSamples { /* - * x-ms-original-file: - * specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Update_AssetEndpointProfile. - * json + * x-ms-original-file: 2024-09-01-preview/Update_AssetEndpointProfile.json */ /** * Sample code: Update_AssetEndpointProfile. @@ -214,10 +293,13 @@ public final class AssetEndpointProfilesUpdateSamples { ```java import com.azure.resourcemanager.deviceregistry.models.AssetProperties; import com.azure.resourcemanager.deviceregistry.models.DataPoint; -import com.azure.resourcemanager.deviceregistry.models.DataPointsObservabilityMode; +import com.azure.resourcemanager.deviceregistry.models.DataPointObservabilityMode; +import com.azure.resourcemanager.deviceregistry.models.Dataset; import com.azure.resourcemanager.deviceregistry.models.Event; -import com.azure.resourcemanager.deviceregistry.models.EventsObservabilityMode; +import com.azure.resourcemanager.deviceregistry.models.EventObservabilityMode; import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; +import com.azure.resourcemanager.deviceregistry.models.Topic; +import com.azure.resourcemanager.deviceregistry.models.TopicRetainType; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -227,8 +309,205 @@ import java.util.Map; */ public final class AssetsCreateOrReplaceSamples { /* - * x-ms-original-file: specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/ - * Create_Asset_Without_DisplayName.json + * x-ms-original-file: 2024-09-01-preview/Create_Asset_With_DiscoveredAssetRef.json + */ + /** + * Sample code: Create_Asset_With_DiscoveredAssetRefs. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + createAssetWithDiscoveredAssetRefs(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.assets() + .define("my-asset") + .withRegion("West Europe") + .withExistingResourceGroup("myResourceGroup") + .withExtendedLocation(new ExtendedLocation().withType("CustomLocation") + .withName( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + .withTags(mapOf("site", "building-1")) + .withProperties(new AssetProperties().withEnabled(true) + .withExternalAssetId("8ZBA6LRHU0A458969") + .withDisplayName("AssetDisplayName") + .withDescription("This is a sample Asset") + .withAssetEndpointProfileRef("myAssetEndpointProfile") + .withManufacturer("Contoso") + .withManufacturerUri("https://www.contoso.com/manufacturerUri") + .withModel("ContosoModel") + .withProductCode("fakeTokenPlaceholder") + .withHardwareRevision("1.0") + .withSoftwareRevision("2.0") + .withDocumentationUri("https://www.example.com/manual") + .withSerialNumber("64-103816-519918-8") + .withDiscoveredAssetRefs(Arrays.asList("discoveredAsset1", "discoveredAsset2")) + .withDefaultDatasetsConfiguration( + "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withDefaultEventsConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withDefaultTopic(new Topic().withPath("/path/defaultTopic").withRetain(TopicRetainType.KEEP)) + .withDatasets(Arrays.asList(new Dataset().withName("dataset1") + .withDatasetConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withTopic(new Topic().withPath("/path/dataset1").withRetain(TopicRetainType.KEEP)) + .withDataPoints(Arrays.asList( + new DataPoint().withName("dataPoint1") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") + .withDataPointConfiguration( + "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(DataPointObservabilityMode.COUNTER), + new DataPoint().withName("dataPoint2") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") + .withDataPointConfiguration( + "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}") + .withObservabilityMode(DataPointObservabilityMode.NONE))))) + .withEvents( + Arrays + .asList( + new Event().withName("event1") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}") + .withTopic(new Topic().withPath("/path/event1").withRetain(TopicRetainType.KEEP)) + .withObservabilityMode(EventObservabilityMode.NONE), + new Event().withName("event2") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(EventObservabilityMode.LOG)))) + .create(); + } + + /* + * x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_ExternalAssetId.json + */ + /** + * Sample code: Create_Asset_Without_ExternalAssetId. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + createAssetWithoutExternalAssetId(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.assets() + .define("my-asset") + .withRegion("West Europe") + .withExistingResourceGroup("myResourceGroup") + .withExtendedLocation(new ExtendedLocation().withType("CustomLocation") + .withName( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + .withTags(mapOf("site", "building-1")) + .withProperties(new AssetProperties().withEnabled(true) + .withDisplayName("AssetDisplayName") + .withDescription("This is a sample Asset") + .withAssetEndpointProfileRef("myAssetEndpointProfile") + .withManufacturer("Contoso") + .withManufacturerUri("https://www.contoso.com/manufacturerUri") + .withModel("ContosoModel") + .withProductCode("fakeTokenPlaceholder") + .withHardwareRevision("1.0") + .withSoftwareRevision("2.0") + .withDocumentationUri("https://www.example.com/manual") + .withSerialNumber("64-103816-519918-8") + .withDefaultDatasetsConfiguration( + "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withDefaultEventsConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withDefaultTopic(new Topic().withPath("/path/defaultTopic").withRetain(TopicRetainType.KEEP)) + .withDatasets(Arrays.asList(new Dataset().withName("dataset1") + .withDatasetConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withTopic(new Topic().withPath("/path/dataset1").withRetain(TopicRetainType.KEEP)) + .withDataPoints(Arrays.asList( + new DataPoint().withName("dataPoint1") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") + .withDataPointConfiguration( + "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(DataPointObservabilityMode.COUNTER), + new DataPoint().withName("dataPoint2") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") + .withDataPointConfiguration( + "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}") + .withObservabilityMode(DataPointObservabilityMode.NONE))))) + .withEvents( + Arrays + .asList( + new Event().withName("event1") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}") + .withTopic(new Topic().withPath("/path/event1").withRetain(TopicRetainType.KEEP)) + .withObservabilityMode(EventObservabilityMode.NONE), + new Event().withName("event2") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(EventObservabilityMode.LOG)))) + .create(); + } + + /* + * x-ms-original-file: 2024-09-01-preview/Create_Asset_With_ExternalAssetId.json + */ + /** + * Sample code: Create_Asset_With_ExternalAssetId. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + createAssetWithExternalAssetId(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.assets() + .define("my-asset") + .withRegion("West Europe") + .withExistingResourceGroup("myResourceGroup") + .withExtendedLocation(new ExtendedLocation().withType("CustomLocation") + .withName( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + .withTags(mapOf("site", "building-1")) + .withProperties(new AssetProperties().withEnabled(true) + .withExternalAssetId("8ZBA6LRHU0A458969") + .withDisplayName("AssetDisplayName") + .withDescription("This is a sample Asset") + .withAssetEndpointProfileRef("myAssetEndpointProfile") + .withManufacturer("Contoso") + .withManufacturerUri("https://www.contoso.com/manufacturerUri") + .withModel("ContosoModel") + .withProductCode("fakeTokenPlaceholder") + .withHardwareRevision("1.0") + .withSoftwareRevision("2.0") + .withDocumentationUri("https://www.example.com/manual") + .withSerialNumber("64-103816-519918-8") + .withDefaultDatasetsConfiguration( + "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withDefaultEventsConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withDefaultTopic(new Topic().withPath("/path/defaultTopic").withRetain(TopicRetainType.KEEP)) + .withDatasets(Arrays.asList(new Dataset().withName("dataset1") + .withDatasetConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withTopic(new Topic().withPath("/path/dataset1").withRetain(TopicRetainType.KEEP)) + .withDataPoints(Arrays.asList( + new DataPoint().withName("dataPoint1") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") + .withDataPointConfiguration( + "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(DataPointObservabilityMode.COUNTER), + new DataPoint().withName("dataPoint2") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") + .withDataPointConfiguration( + "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}") + .withObservabilityMode(DataPointObservabilityMode.NONE))))) + .withEvents( + Arrays + .asList( + new Event().withName("event1") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}") + .withTopic(new Topic().withPath("/path/event1").withRetain(TopicRetainType.KEEP)) + .withObservabilityMode(EventObservabilityMode.NONE), + new Event().withName("event2") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(EventObservabilityMode.LOG)))) + .create(); + } + + /* + * x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_DisplayName.json */ /** * Sample code: Create_Asset_Without_DisplayName. @@ -245,11 +524,10 @@ public final class AssetsCreateOrReplaceSamples { .withName( "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) .withTags(mapOf("site", "building-1")) - .withProperties(new AssetProperties().withAssetType("MyAssetType") - .withEnabled(true) + .withProperties(new AssetProperties().withEnabled(true) .withExternalAssetId("8ZBA6LRHU0A458969") .withDescription("This is a sample Asset") - .withAssetEndpointProfileUri("https://www.example.com/myAssetEndpointProfile") + .withAssetEndpointProfileRef("myAssetEndpointProfile") .withManufacturer("Contoso") .withManufacturerUri("https://www.contoso.com/manufacturerUri") .withModel("ContosoModel") @@ -258,29 +536,38 @@ public final class AssetsCreateOrReplaceSamples { .withSoftwareRevision("2.0") .withDocumentationUri("https://www.example.com/manual") .withSerialNumber("64-103816-519918-8") - .withDefaultDataPointsConfiguration( + .withDefaultDatasetsConfiguration( "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") .withDefaultEventsConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") - .withDataPoints(Arrays.asList( - new DataPoint().withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") - .withCapabilityId("dtmi:com:example:Thermostat:__temperature;1") - .withObservabilityMode(DataPointsObservabilityMode.COUNTER) - .withDataPointConfiguration( - "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - new DataPoint().withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") - .withCapabilityId("dtmi:com:example:Thermostat:__pressure;1") - .withObservabilityMode(DataPointsObservabilityMode.NONE) - .withDataPointConfiguration( - "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"))) - .withEvents(Arrays.asList( - new Event().withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") - .withCapabilityId("dtmi:com:example:Thermostat:__temperature;1") - .withObservabilityMode(EventsObservabilityMode.NONE) - .withEventConfiguration("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - new Event().withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") - .withCapabilityId("dtmi:com:example:Thermostat:__pressure;1") - .withObservabilityMode(EventsObservabilityMode.LOG) - .withEventConfiguration("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}")))) + .withDefaultTopic(new Topic().withPath("/path/defaultTopic").withRetain(TopicRetainType.KEEP)) + .withDatasets(Arrays.asList(new Dataset().withName("dataset1") + .withDatasetConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withTopic(new Topic().withPath("/path/dataset1").withRetain(TopicRetainType.KEEP)) + .withDataPoints(Arrays.asList( + new DataPoint().withName("dataPoint1") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") + .withDataPointConfiguration( + "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(DataPointObservabilityMode.COUNTER), + new DataPoint().withName("dataPoint2") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") + .withDataPointConfiguration( + "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}") + .withObservabilityMode(DataPointObservabilityMode.NONE))))) + .withEvents( + Arrays + .asList( + new Event().withName("event1") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}") + .withTopic(new Topic().withPath("/path/event1").withRetain(TopicRetainType.KEEP)) + .withObservabilityMode(EventObservabilityMode.NONE), + new Event().withName("event2") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(EventObservabilityMode.LOG)))) .create(); } @@ -306,8 +593,7 @@ public final class AssetsCreateOrReplaceSamples { */ public final class AssetsDeleteSamples { /* - * x-ms-original-file: - * specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Delete_Asset.json + * x-ms-original-file: 2024-09-01-preview/Delete_Asset.json */ /** * Sample code: Delete_Asset. @@ -328,8 +614,20 @@ public final class AssetsDeleteSamples { */ public final class AssetsGetByResourceGroupSamples { /* - * x-ms-original-file: - * specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Get_Asset.json + * x-ms-original-file: 2024-09-01-preview/Get_Asset_With_SyncStatus.json + */ + /** + * Sample code: Get_Asset_With_SyncStatus. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void getAssetWithSyncStatus(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.assets() + .getByResourceGroupWithResponse("myResourceGroup", "my-asset", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2024-09-01-preview/Get_Asset.json */ /** * Sample code: Get_Asset. @@ -351,8 +649,7 @@ public final class AssetsGetByResourceGroupSamples { */ public final class AssetsListSamples { /* - * x-ms-original-file: - * specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/List_Assets_Subscription.json + * x-ms-original-file: 2024-09-01-preview/List_Assets_Subscription.json */ /** * Sample code: List_Assets_Subscription. @@ -373,8 +670,7 @@ public final class AssetsListSamples { */ public final class AssetsListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/List_Assets_ResourceGroup.json + * x-ms-original-file: 2024-09-01-preview/List_Assets_ResourceGroup.json */ /** * Sample code: List_Assets_ResourceGroup. @@ -398,8 +694,7 @@ import com.azure.resourcemanager.deviceregistry.models.AssetUpdateProperties; */ public final class AssetsUpdateSamples { /* - * x-ms-original-file: - * specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Update_Asset.json + * x-ms-original-file: 2024-09-01-preview/Update_Asset.json */ /** * Sample code: Update_Asset. @@ -417,47 +712,877 @@ public final class AssetsUpdateSamples { } ``` -### OperationStatus_Get +### BillingContainers_Get ```java /** - * Samples for OperationStatus Get. + * Samples for BillingContainers Get. */ -public final class OperationStatusGetSamples { +public final class BillingContainersGetSamples { /* - * x-ms-original-file: - * specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Get_OperationStatus.json + * x-ms-original-file: 2024-09-01-preview/Get_BillingContainer.json */ /** - * Sample code: Get_OperationStatus. + * Sample code: Get_BillingContainer. * * @param manager Entry point to DeviceRegistryManager. */ - public static void getOperationStatus(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { - manager.operationStatus() - .getWithResponse("testLocation", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", com.azure.core.util.Context.NONE); + public static void getBillingContainer(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.billingContainers().getWithResponse("my-billingContainer", com.azure.core.util.Context.NONE); } } ``` -### Operations_List +### BillingContainers_List ```java /** - * Samples for Operations List. + * Samples for BillingContainers List. */ -public final class OperationsListSamples { +public final class BillingContainersListSamples { /* - * x-ms-original-file: - * specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/List_Operations.json + * x-ms-original-file: 2024-09-01-preview/List_BillingContainers_Subscription.json */ /** - * Sample code: List_Operations. + * Sample code: List_BillingContainers_Subscription. * * @param manager Entry point to DeviceRegistryManager. */ - public static void listOperations(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { - manager.operations().list(com.azure.core.util.Context.NONE); + public static void + listBillingContainersSubscription(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.billingContainers().list(com.azure.core.util.Context.NONE); + } +} +``` + +### DiscoveredAssetEndpointProfiles_CreateOrReplace + +```java +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileProperties; +import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DiscoveredAssetEndpointProfiles CreateOrReplace. + */ +public final class DiscoveredAssetEndpointProfilesCreateOrReplaceSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAssetEndpointProfile.json + */ + /** + * Sample code: Create_DiscoveredAssetEndpointProfile. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + createDiscoveredAssetEndpointProfile(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssetEndpointProfiles() + .define("my-discoveredassetendpointprofile") + .withRegion("West Europe") + .withExistingResourceGroup("myResourceGroup") + .withExtendedLocation(new ExtendedLocation().withType("CustomLocation") + .withName( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + .withTags(mapOf("site", "building-1")) + .withProperties(new DiscoveredAssetEndpointProfileProperties() + .withTargetAddress("https://www.example.com/myTargetAddress") + .withAdditionalConfiguration("{\"foo\": \"bar\"}") + .withSupportedAuthenticationMethods(Arrays.asList(AuthenticationMethod.ANONYMOUS, + AuthenticationMethod.CERTIFICATE, AuthenticationMethod.USERNAME_PASSWORD)) + .withEndpointProfileType("myEndpointProfileType") + .withDiscoveryId("11111111-1111-1111-1111-111111111111") + .withVersion(73766L)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### DiscoveredAssetEndpointProfiles_Delete + +```java +/** + * Samples for DiscoveredAssetEndpointProfiles Delete. + */ +public final class DiscoveredAssetEndpointProfilesDeleteSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAssetEndpointProfile.json + */ + /** + * Sample code: Delete_DiscoveredAssetEndpointProfile. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + deleteDiscoveredAssetEndpointProfile(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssetEndpointProfiles() + .delete("myResourceGroup", "my-discoveredassetendpointprofile", com.azure.core.util.Context.NONE); + } +} +``` + +### DiscoveredAssetEndpointProfiles_GetByResourceGroup + +```java +/** + * Samples for DiscoveredAssetEndpointProfiles GetByResourceGroup. + */ +public final class DiscoveredAssetEndpointProfilesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json + */ + /** + * Sample code: Get_DiscoveredAssetEndpointProfile. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + getDiscoveredAssetEndpointProfile(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssetEndpointProfiles() + .getByResourceGroupWithResponse("myResourceGroup", "my-discoveredassetendpointprofile", + com.azure.core.util.Context.NONE); + } +} +``` + +### DiscoveredAssetEndpointProfiles_List + +```java +/** + * Samples for DiscoveredAssetEndpointProfiles List. + */ +public final class DiscoveredAssetEndpointProfilesListSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_Subscription.json + */ + /** + * Sample code: List_DiscoveredAssetEndpointProfiles_Subscription. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void listDiscoveredAssetEndpointProfilesSubscription( + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssetEndpointProfiles().list(com.azure.core.util.Context.NONE); + } +} +``` + +### DiscoveredAssetEndpointProfiles_ListByResourceGroup + +```java +/** + * Samples for DiscoveredAssetEndpointProfiles ListByResourceGroup. + */ +public final class DiscoveredAssetEndpointProfilesListByResourceGroupSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_ResourceGroup.json + */ + /** + * Sample code: List_DiscoveredAssetEndpointProfiles_ResourceGroup. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void listDiscoveredAssetEndpointProfilesResourceGroup( + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssetEndpointProfiles() + .listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### DiscoveredAssetEndpointProfiles_Update + +```java +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfile; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileUpdateProperties; +import java.util.Arrays; + +/** + * Samples for DiscoveredAssetEndpointProfiles Update. + */ +public final class DiscoveredAssetEndpointProfilesUpdateSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAssetEndpointProfile.json + */ + /** + * Sample code: Update_DiscoveredAssetEndpointProfile. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + updateDiscoveredAssetEndpointProfile(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + DiscoveredAssetEndpointProfile resource = manager.discoveredAssetEndpointProfiles() + .getByResourceGroupWithResponse("myResourceGroup", "my-discoveredassetendpointprofile", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new DiscoveredAssetEndpointProfileUpdateProperties() + .withTargetAddress("https://www.example.com/myTargetAddress") + .withAdditionalConfiguration("{\"foo\": \"bar\"}") + .withSupportedAuthenticationMethods( + Arrays.asList(AuthenticationMethod.ANONYMOUS, AuthenticationMethod.CERTIFICATE)) + .withEndpointProfileType("myEndpointProfileType") + .withDiscoveryId("11111111-1111-1111-1111-111111111111") + .withVersion(73766L)) + .apply(); + } +} +``` + +### DiscoveredAssets_CreateOrReplace + +```java +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetProperties; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredDataPoint; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredDataset; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredEvent; +import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; +import com.azure.resourcemanager.deviceregistry.models.Topic; +import com.azure.resourcemanager.deviceregistry.models.TopicRetainType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DiscoveredAssets CreateOrReplace. + */ +public final class DiscoveredAssetsCreateOrReplaceSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAsset.json + */ + /** + * Sample code: Create_DiscoveredAsset. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void createDiscoveredAsset(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssets() + .define("my-discoveredasset") + .withRegion("West Europe") + .withExistingResourceGroup("myResourceGroup") + .withExtendedLocation(new ExtendedLocation().withType("CustomLocation") + .withName( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + .withTags(mapOf("site", "building-1")) + .withProperties(new DiscoveredAssetProperties().withAssetEndpointProfileRef("myAssetEndpointProfile") + .withDiscoveryId("11111111-1111-1111-1111-111111111111") + .withVersion(73766L) + .withManufacturer("Contoso") + .withManufacturerUri("https://www.contoso.com/manufacturerUri") + .withModel("ContosoModel") + .withProductCode("fakeTokenPlaceholder") + .withHardwareRevision("1.0") + .withSoftwareRevision("2.0") + .withDocumentationUri("https://www.example.com/manual") + .withSerialNumber("64-103816-519918-8") + .withDefaultDatasetsConfiguration( + "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withDefaultEventsConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withDefaultTopic(new Topic().withPath("/path/defaultTopic").withRetain(TopicRetainType.KEEP)) + .withDatasets(Arrays.asList(new DiscoveredDataset().withName("dataset1") + .withDatasetConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withTopic(new Topic().withPath("/path/dataset1").withRetain(TopicRetainType.KEEP)) + .withDataPoints(Arrays.asList( + new DiscoveredDataPoint().withName("dataPoint1") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") + .withDataPointConfiguration( + "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), + new DiscoveredDataPoint().withName("dataPoint2") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") + .withDataPointConfiguration( + "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"))))) + .withEvents(Arrays.asList( + new DiscoveredEvent().withName("event1") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") + .withEventConfiguration("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}") + .withTopic(new Topic().withPath("/path/event1").withRetain(TopicRetainType.KEEP)), + new DiscoveredEvent().withName("event2") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") + .withEventConfiguration("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}")))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### DiscoveredAssets_Delete + +```java +/** + * Samples for DiscoveredAssets Delete. + */ +public final class DiscoveredAssetsDeleteSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAsset.json + */ + /** + * Sample code: Delete_DiscoveredAsset. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void deleteDiscoveredAsset(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssets().delete("myResourceGroup", "my-discoveredasset", com.azure.core.util.Context.NONE); + } +} +``` + +### DiscoveredAssets_GetByResourceGroup + +```java +/** + * Samples for DiscoveredAssets GetByResourceGroup. + */ +public final class DiscoveredAssetsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAsset.json + */ + /** + * Sample code: Get_DiscoveredAsset. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void getDiscoveredAsset(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssets() + .getByResourceGroupWithResponse("myResourceGroup", "my-discoveredasset", com.azure.core.util.Context.NONE); + } +} +``` + +### DiscoveredAssets_List + +```java +/** + * Samples for DiscoveredAssets List. + */ +public final class DiscoveredAssetsListSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_Subscription.json + */ + /** + * Sample code: List_DiscoveredAssets_Subscription. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listDiscoveredAssetsSubscription(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssets().list(com.azure.core.util.Context.NONE); + } +} +``` + +### DiscoveredAssets_ListByResourceGroup + +```java +/** + * Samples for DiscoveredAssets ListByResourceGroup. + */ +public final class DiscoveredAssetsListByResourceGroupSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_ResourceGroup.json + */ + /** + * Sample code: List_DiscoveredAssets_ResourceGroup. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listDiscoveredAssetsResourceGroup(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssets().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### DiscoveredAssets_Update + +```java +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAsset; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetUpdateProperties; +import com.azure.resourcemanager.deviceregistry.models.Topic; +import com.azure.resourcemanager.deviceregistry.models.TopicRetainType; + +/** + * Samples for DiscoveredAssets Update. + */ +public final class DiscoveredAssetsUpdateSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAsset.json + */ + /** + * Sample code: Update_DiscoveredAsset. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void updateDiscoveredAsset(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + DiscoveredAsset resource = manager.discoveredAssets() + .getByResourceGroupWithResponse("myResourceGroup", "my-discoveredasset", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties( + new DiscoveredAssetUpdateProperties().withDocumentationUri("https://www.example.com/manual-2") + .withDefaultTopic(new Topic().withPath("/path/defaultTopic").withRetain(TopicRetainType.NEVER))) + .apply(); + } +} +``` + +### OperationStatus_Get + +```java +/** + * Samples for OperationStatus Get. + */ +public final class OperationStatusGetSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Get_OperationStatus.json + */ + /** + * Sample code: Get_OperationStatus. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void getOperationStatus(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.operationStatus() + .getWithResponse("testLocation", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_Operations.json + */ + /** + * Sample code: List_Operations. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void listOperations(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SchemaRegistries_CreateOrReplace + +```java +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryProperties; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentityType; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SchemaRegistries CreateOrReplace. + */ +public final class SchemaRegistriesCreateOrReplaceSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Create_SchemaRegistry.json + */ + /** + * Sample code: Create_SchemaRegistry. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void createSchemaRegistry(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaRegistries() + .define("my-schema-registry") + .withRegion("West Europe") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf()) + .withProperties(new SchemaRegistryProperties().withNamespace("sr-namespace-001") + .withDisplayName("Schema Registry namespace 001") + .withDescription("This is a sample Schema Registry") + .withStorageAccountContainerUrl("my-blob-storage.blob.core.windows.net/my-container")) + .withIdentity(new SystemAssignedServiceIdentity().withType(SystemAssignedServiceIdentityType.NONE)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SchemaRegistries_Delete + +```java +/** + * Samples for SchemaRegistries Delete. + */ +public final class SchemaRegistriesDeleteSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Delete_SchemaRegistry.json + */ + /** + * Sample code: Delete_SchemaRegistry. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void deleteSchemaRegistry(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaRegistries().delete("myResourceGroup", "my-schema-registry", com.azure.core.util.Context.NONE); + } +} +``` + +### SchemaRegistries_GetByResourceGroup + +```java +/** + * Samples for SchemaRegistries GetByResourceGroup. + */ +public final class SchemaRegistriesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Get_SchemaRegistry.json + */ + /** + * Sample code: Get_SchemaRegistry. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void getSchemaRegistry(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaRegistries() + .getByResourceGroupWithResponse("myResourceGroup", "my-schema-registry", com.azure.core.util.Context.NONE); + } +} +``` + +### SchemaRegistries_List + +```java +/** + * Samples for SchemaRegistries List. + */ +public final class SchemaRegistriesListSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_Subscription.json + */ + /** + * Sample code: List_SchemaRegistries_Subscription. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listSchemaRegistriesSubscription(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaRegistries().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SchemaRegistries_ListByResourceGroup + +```java +/** + * Samples for SchemaRegistries ListByResourceGroup. + */ +public final class SchemaRegistriesListByResourceGroupSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_ResourceGroup.json + */ + /** + * Sample code: List_SchemaRegistries_ResourceGroup. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listSchemaRegistriesResourceGroup(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaRegistries().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### SchemaRegistries_Update + +```java +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistry; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryUpdateProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SchemaRegistries Update. + */ +public final class SchemaRegistriesUpdateSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Update_SchemaRegistry.json + */ + /** + * Sample code: Update_SchemaRegistry. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void updateSchemaRegistry(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + SchemaRegistry resource = manager.schemaRegistries() + .getByResourceGroupWithResponse("myResourceGroup", "my-schema-registry", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf()) + .withProperties(new SchemaRegistryUpdateProperties().withDisplayName("Schema Registry namespace 001") + .withDescription("This is a sample Schema Registry")) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SchemaVersions_CreateOrReplace + +```java +import com.azure.resourcemanager.deviceregistry.models.SchemaVersionProperties; + +/** + * Samples for SchemaVersions CreateOrReplace. + */ +public final class SchemaVersionsCreateOrReplaceSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Create_SchemaVersion.json + */ + /** + * Sample code: Create_SchemaVersion. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void createSchemaVersion(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaVersions() + .define("1") + .withExistingSchema("myResourceGroup", "my-schema-registry", "my-schema") + .withProperties(new SchemaVersionProperties().withDescription("Schema version 1") + .withSchemaContent( + "{\"$schema\": \"http://json-schema.org/draft-07/schema#\",\"type\": \"object\",\"properties\": {\"humidity\": {\"type\": \"string\"},\"temperature\": {\"type\":\"number\"}}}")) + .create(); + } +} +``` + +### SchemaVersions_Delete + +```java +/** + * Samples for SchemaVersions Delete. + */ +public final class SchemaVersionsDeleteSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Delete_SchemaVersion.json + */ + /** + * Sample code: Delete_SchemaVersion. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void deleteSchemaVersion(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaVersions() + .deleteWithResponse("myResourceGroup", "my-schema-registry", "my-schema", "1", + com.azure.core.util.Context.NONE); + } +} +``` + +### SchemaVersions_Get + +```java +/** + * Samples for SchemaVersions Get. + */ +public final class SchemaVersionsGetSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Get_SchemaVersion.json + */ + /** + * Sample code: Get_SchemaVersion. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void getSchemaVersion(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaVersions() + .getWithResponse("myResourceGroup", "my-schema-registry", "my-schema", "1", + com.azure.core.util.Context.NONE); + } +} +``` + +### SchemaVersions_ListBySchema + +```java +/** + * Samples for SchemaVersions ListBySchema. + */ +public final class SchemaVersionsListBySchemaSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_SchemaVersions_Schema.json + */ + /** + * Sample code: List_SchemaVersions_Schema. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listSchemaVersionsSchema(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaVersions() + .listBySchema("myResourceGroup", "my-schema-registry", "my-schema", com.azure.core.util.Context.NONE); + } +} +``` + +### Schemas_CreateOrReplace + +```java +import com.azure.resourcemanager.deviceregistry.models.Format; +import com.azure.resourcemanager.deviceregistry.models.SchemaProperties; +import com.azure.resourcemanager.deviceregistry.models.SchemaType; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Schemas CreateOrReplace. + */ +public final class SchemasCreateOrReplaceSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Create_Schema.json + */ + /** + * Sample code: Create_Schema. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void createSchema(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemas() + .define("my-schema") + .withExistingSchemaRegistry("myResourceGroup", "my-schema-registry") + .withProperties(new SchemaProperties().withDisplayName("My Schema") + .withDescription("This is a sample Schema") + .withFormat(Format.JSON_SCHEMA_DRAFT7) + .withSchemaType(SchemaType.MESSAGE_SCHEMA) + .withTags(mapOf("sampleKey", "fakeTokenPlaceholder"))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Schemas_Delete + +```java +/** + * Samples for Schemas Delete. + */ +public final class SchemasDeleteSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Delete_Schema.json + */ + /** + * Sample code: Delete_Schema. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void deleteSchema(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemas() + .deleteWithResponse("myResourceGroup", "my-schema-registry", "my-schema", com.azure.core.util.Context.NONE); + } +} +``` + +### Schemas_Get + +```java +/** + * Samples for Schemas Get. + */ +public final class SchemasGetSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Get_Schema.json + */ + /** + * Sample code: Schemas_Get. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void schemasGet(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemas() + .getWithResponse("myResourceGroup", "my-schema-registry", "my-schema", com.azure.core.util.Context.NONE); + } +} +``` + +### Schemas_ListBySchemaRegistry + +```java +/** + * Samples for Schemas ListBySchemaRegistry. + */ +public final class SchemasListBySchemaRegistrySamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_Schemas_SchemaRegistry.json + */ + /** + * Sample code: List_Schemas_SchemaRegistry. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listSchemasSchemaRegistry(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemas() + .listBySchemaRegistry("myResourceGroup", "my-schema-registry", com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/pom.xml b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/pom.xml index 96277cb6ae652..caa0a58d6da8e 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/pom.xml +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/pom.xml @@ -1,7 +1,7 @@ 4.0.0 @@ -46,13 +46,9 @@ Code generated by Microsoft (R) TypeSpec Code Generator. 0 0 true + false - - com.azure - azure-json - 1.3.0 - com.azure azure-core @@ -75,5 +71,10 @@ Code generated by Microsoft (R) TypeSpec Code Generator. 1.14.2 test + + com.azure + azure-json + 1.3.0 + diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/DeviceRegistryManager.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/DeviceRegistryManager.java index d2f6a321e567c..1f39c58fce5de 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/DeviceRegistryManager.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/DeviceRegistryManager.java @@ -23,16 +23,28 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.deviceregistry.fluent.DeviceRegistryClient; +import com.azure.resourcemanager.deviceregistry.fluent.DeviceRegistryManagementClient; import com.azure.resourcemanager.deviceregistry.implementation.AssetEndpointProfilesImpl; import com.azure.resourcemanager.deviceregistry.implementation.AssetsImpl; -import com.azure.resourcemanager.deviceregistry.implementation.DeviceRegistryClientBuilder; +import com.azure.resourcemanager.deviceregistry.implementation.BillingContainersImpl; +import com.azure.resourcemanager.deviceregistry.implementation.DeviceRegistryManagementClientBuilder; +import com.azure.resourcemanager.deviceregistry.implementation.DiscoveredAssetEndpointProfilesImpl; +import com.azure.resourcemanager.deviceregistry.implementation.DiscoveredAssetsImpl; import com.azure.resourcemanager.deviceregistry.implementation.OperationStatusImpl; import com.azure.resourcemanager.deviceregistry.implementation.OperationsImpl; +import com.azure.resourcemanager.deviceregistry.implementation.SchemaRegistriesImpl; +import com.azure.resourcemanager.deviceregistry.implementation.SchemaVersionsImpl; +import com.azure.resourcemanager.deviceregistry.implementation.SchemasImpl; import com.azure.resourcemanager.deviceregistry.models.AssetEndpointProfiles; import com.azure.resourcemanager.deviceregistry.models.Assets; +import com.azure.resourcemanager.deviceregistry.models.BillingContainers; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfiles; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssets; import com.azure.resourcemanager.deviceregistry.models.OperationStatus; import com.azure.resourcemanager.deviceregistry.models.Operations; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistries; +import com.azure.resourcemanager.deviceregistry.models.SchemaVersions; +import com.azure.resourcemanager.deviceregistry.models.Schemas; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; @@ -53,12 +65,24 @@ public final class DeviceRegistryManager { private AssetEndpointProfiles assetEndpointProfiles; - private final DeviceRegistryClient clientObject; + private BillingContainers billingContainers; + + private DiscoveredAssets discoveredAssets; + + private DiscoveredAssetEndpointProfiles discoveredAssetEndpointProfiles; + + private SchemaRegistries schemaRegistries; + + private Schemas schemas; + + private SchemaVersions schemaVersions; + + private final DeviceRegistryManagementClient clientObject; private DeviceRegistryManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); - this.clientObject = new DeviceRegistryClientBuilder().pipeline(httpPipeline) + this.clientObject = new DeviceRegistryManagementClientBuilder().pipeline(httpPipeline) .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) .subscriptionId(profile.getSubscriptionId()) .defaultPollInterval(defaultPollInterval) @@ -312,12 +336,85 @@ public AssetEndpointProfiles assetEndpointProfiles() { } /** - * Gets wrapped service client DeviceRegistryClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. + * Gets the resource collection API of BillingContainers. + * + * @return Resource collection API of BillingContainers. + */ + public BillingContainers billingContainers() { + if (this.billingContainers == null) { + this.billingContainers = new BillingContainersImpl(clientObject.getBillingContainers(), this); + } + return billingContainers; + } + + /** + * Gets the resource collection API of DiscoveredAssets. It manages DiscoveredAsset. + * + * @return Resource collection API of DiscoveredAssets. + */ + public DiscoveredAssets discoveredAssets() { + if (this.discoveredAssets == null) { + this.discoveredAssets = new DiscoveredAssetsImpl(clientObject.getDiscoveredAssets(), this); + } + return discoveredAssets; + } + + /** + * Gets the resource collection API of DiscoveredAssetEndpointProfiles. It manages DiscoveredAssetEndpointProfile. + * + * @return Resource collection API of DiscoveredAssetEndpointProfiles. + */ + public DiscoveredAssetEndpointProfiles discoveredAssetEndpointProfiles() { + if (this.discoveredAssetEndpointProfiles == null) { + this.discoveredAssetEndpointProfiles + = new DiscoveredAssetEndpointProfilesImpl(clientObject.getDiscoveredAssetEndpointProfiles(), this); + } + return discoveredAssetEndpointProfiles; + } + + /** + * Gets the resource collection API of SchemaRegistries. It manages SchemaRegistry. + * + * @return Resource collection API of SchemaRegistries. + */ + public SchemaRegistries schemaRegistries() { + if (this.schemaRegistries == null) { + this.schemaRegistries = new SchemaRegistriesImpl(clientObject.getSchemaRegistries(), this); + } + return schemaRegistries; + } + + /** + * Gets the resource collection API of Schemas. It manages Schema. + * + * @return Resource collection API of Schemas. + */ + public Schemas schemas() { + if (this.schemas == null) { + this.schemas = new SchemasImpl(clientObject.getSchemas(), this); + } + return schemas; + } + + /** + * Gets the resource collection API of SchemaVersions. It manages SchemaVersion. + * + * @return Resource collection API of SchemaVersions. + */ + public SchemaVersions schemaVersions() { + if (this.schemaVersions == null) { + this.schemaVersions = new SchemaVersionsImpl(clientObject.getSchemaVersions(), this); + } + return schemaVersions; + } + + /** + * Gets wrapped service client DeviceRegistryManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. * - * @return Wrapped service client DeviceRegistryClient. + * @return Wrapped service client DeviceRegistryManagementClient. */ - public DeviceRegistryClient serviceClient() { + public DeviceRegistryManagementClient serviceClient() { return this.clientObject; } } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/BillingContainersClient.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/BillingContainersClient.java new file mode 100644 index 0000000000000..37701d41d7546 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/BillingContainersClient.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.models.BillingContainerInner; + +/** + * An instance of this class provides access to all the operations defined in BillingContainersClient. + */ +public interface BillingContainersClient { + /** + * Get a BillingContainer. + * + * @param billingContainerName Name of the billing container. + * @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 BillingContainer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String billingContainerName, Context context); + + /** + * Get a BillingContainer. + * + * @param billingContainerName Name of the billing container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 BillingContainer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingContainerInner get(String billingContainerName); + + /** + * List BillingContainer 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 BillingContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List BillingContainer 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 BillingContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DeviceRegistryClient.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DeviceRegistryManagementClient.java similarity index 57% rename from sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DeviceRegistryClient.java rename to sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DeviceRegistryManagementClient.java index e2bfee52a58bb..6e64e3324c3a7 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DeviceRegistryClient.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DeviceRegistryManagementClient.java @@ -8,9 +8,9 @@ import java.time.Duration; /** - * The interface for DeviceRegistryClient class. + * The interface for DeviceRegistryManagementClient class. */ -public interface DeviceRegistryClient { +public interface DeviceRegistryManagementClient { /** * Gets Service host. * @@ -73,4 +73,46 @@ public interface DeviceRegistryClient { * @return the AssetEndpointProfilesClient object. */ AssetEndpointProfilesClient getAssetEndpointProfiles(); + + /** + * Gets the BillingContainersClient object to access its operations. + * + * @return the BillingContainersClient object. + */ + BillingContainersClient getBillingContainers(); + + /** + * Gets the DiscoveredAssetsClient object to access its operations. + * + * @return the DiscoveredAssetsClient object. + */ + DiscoveredAssetsClient getDiscoveredAssets(); + + /** + * Gets the DiscoveredAssetEndpointProfilesClient object to access its operations. + * + * @return the DiscoveredAssetEndpointProfilesClient object. + */ + DiscoveredAssetEndpointProfilesClient getDiscoveredAssetEndpointProfiles(); + + /** + * Gets the SchemaRegistriesClient object to access its operations. + * + * @return the SchemaRegistriesClient object. + */ + SchemaRegistriesClient getSchemaRegistries(); + + /** + * Gets the SchemasClient object to access its operations. + * + * @return the SchemasClient object. + */ + SchemasClient getSchemas(); + + /** + * Gets the SchemaVersionsClient object to access its operations. + * + * @return the SchemaVersionsClient object. + */ + SchemaVersionsClient getSchemaVersions(); } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DiscoveredAssetEndpointProfilesClient.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DiscoveredAssetEndpointProfilesClient.java new file mode 100644 index 0000000000000..07d2ea342172e --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DiscoveredAssetEndpointProfilesClient.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.models.DiscoveredAssetEndpointProfileInner; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate; + +/** + * An instance of this class provides access to all the operations defined in DiscoveredAssetEndpointProfilesClient. + */ +public interface DiscoveredAssetEndpointProfilesClient { + /** + * Get a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 DiscoveredAssetEndpointProfile along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String discoveredAssetEndpointProfileName, Context context); + + /** + * Get a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 DiscoveredAssetEndpointProfile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredAssetEndpointProfileInner getByResourceGroup(String resourceGroupName, + String discoveredAssetEndpointProfileName); + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoveredAssetEndpointProfileInner> + beginCreateOrReplace(String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileInner resource); + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoveredAssetEndpointProfileInner> + beginCreateOrReplace(String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileInner resource, Context context); + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredAssetEndpointProfileInner createOrReplace(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileInner resource); + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredAssetEndpointProfileInner createOrReplace(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileInner resource, Context context); + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoveredAssetEndpointProfileInner> beginUpdate( + String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileUpdate properties); + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoveredAssetEndpointProfileInner> beginUpdate( + String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileUpdate properties, Context context); + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredAssetEndpointProfileInner update(String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileUpdate properties); + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredAssetEndpointProfileInner update(String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileUpdate properties, Context context); + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 discoveredAssetEndpointProfileName); + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discoveredAssetEndpointProfileName, + Context context); + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 discoveredAssetEndpointProfileName); + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discoveredAssetEndpointProfileName, Context context); + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DiscoveredAssetsClient.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DiscoveredAssetsClient.java new file mode 100644 index 0000000000000..3362c3d1e02f9 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/DiscoveredAssetsClient.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.models.DiscoveredAssetInner; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetUpdate; + +/** + * An instance of this class provides access to all the operations defined in DiscoveredAssetsClient. + */ +public interface DiscoveredAssetsClient { + /** + * Get a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 DiscoveredAsset along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String discoveredAssetName, + Context context); + + /** + * Get a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 DiscoveredAsset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredAssetInner getByResourceGroup(String resourceGroupName, String discoveredAssetName); + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoveredAssetInner> beginCreateOrReplace(String resourceGroupName, + String discoveredAssetName, DiscoveredAssetInner resource); + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoveredAssetInner> beginCreateOrReplace(String resourceGroupName, + String discoveredAssetName, DiscoveredAssetInner resource, Context context); + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredAssetInner createOrReplace(String resourceGroupName, String discoveredAssetName, + DiscoveredAssetInner resource); + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredAssetInner createOrReplace(String resourceGroupName, String discoveredAssetName, + DiscoveredAssetInner resource, Context context); + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoveredAssetInner> beginUpdate(String resourceGroupName, + String discoveredAssetName, DiscoveredAssetUpdate properties); + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoveredAssetInner> beginUpdate(String resourceGroupName, + String discoveredAssetName, DiscoveredAssetUpdate properties, Context context); + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredAssetInner update(String resourceGroupName, String discoveredAssetName, DiscoveredAssetUpdate properties); + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoveredAssetInner update(String resourceGroupName, String discoveredAssetName, DiscoveredAssetUpdate properties, + Context context); + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 discoveredAssetName); + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discoveredAssetName, + Context context); + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 discoveredAssetName); + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discoveredAssetName, Context context); + + /** + * List DiscoveredAsset 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 DiscoveredAsset list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List DiscoveredAsset 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 DiscoveredAsset list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List DiscoveredAsset 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 DiscoveredAsset list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List DiscoveredAsset 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 DiscoveredAsset list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/SchemaRegistriesClient.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/SchemaRegistriesClient.java new file mode 100644 index 0000000000000..cea69f6ae34f0 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/SchemaRegistriesClient.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.models.SchemaRegistryInner; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryUpdate; + +/** + * An instance of this class provides access to all the operations defined in SchemaRegistriesClient. + */ +public interface SchemaRegistriesClient { + /** + * Get a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 SchemaRegistry along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String schemaRegistryName, + Context context); + + /** + * Get a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 SchemaRegistry. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SchemaRegistryInner getByResourceGroup(String resourceGroupName, String schemaRegistryName); + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SchemaRegistryInner> beginCreateOrReplace(String resourceGroupName, + String schemaRegistryName, SchemaRegistryInner resource); + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SchemaRegistryInner> beginCreateOrReplace(String resourceGroupName, + String schemaRegistryName, SchemaRegistryInner resource, Context context); + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SchemaRegistryInner createOrReplace(String resourceGroupName, String schemaRegistryName, + SchemaRegistryInner resource); + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SchemaRegistryInner createOrReplace(String resourceGroupName, String schemaRegistryName, + SchemaRegistryInner resource, Context context); + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SchemaRegistryInner> beginUpdate(String resourceGroupName, + String schemaRegistryName, SchemaRegistryUpdate properties); + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SchemaRegistryInner> beginUpdate(String resourceGroupName, + String schemaRegistryName, SchemaRegistryUpdate properties, Context context); + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SchemaRegistryInner update(String resourceGroupName, String schemaRegistryName, SchemaRegistryUpdate properties); + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SchemaRegistryInner update(String resourceGroupName, String schemaRegistryName, SchemaRegistryUpdate properties, + Context context); + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 schemaRegistryName); + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schemaRegistryName, + Context context); + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 schemaRegistryName); + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schemaRegistryName, Context context); + + /** + * List SchemaRegistry 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 SchemaRegistry list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List SchemaRegistry 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 SchemaRegistry list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List SchemaRegistry 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 SchemaRegistry list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List SchemaRegistry 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 SchemaRegistry list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/SchemaVersionsClient.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/SchemaVersionsClient.java new file mode 100644 index 0000000000000..5241f12719863 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/SchemaVersionsClient.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.models.SchemaVersionInner; + +/** + * An instance of this class provides access to all the operations defined in SchemaVersionsClient. + */ +public interface SchemaVersionsClient { + /** + * Get a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @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 SchemaVersion along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName, Context context); + + /** + * Get a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 SchemaVersion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SchemaVersionInner get(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName); + + /** + * Create a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @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 schema version's definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrReplaceWithResponse(String resourceGroupName, String schemaRegistryName, + String schemaName, String schemaVersionName, SchemaVersionInner resource, Context context); + + /** + * Create a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @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 schema version's definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SchemaVersionInner createOrReplace(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName, SchemaVersionInner resource); + + /** + * Delete a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName, Context context); + + /** + * Delete a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 schemaRegistryName, String schemaName, String schemaVersionName); + + /** + * List SchemaVersion resources by Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 SchemaVersion list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySchema(String resourceGroupName, String schemaRegistryName, + String schemaName); + + /** + * List SchemaVersion resources by Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 SchemaVersion list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySchema(String resourceGroupName, String schemaRegistryName, + String schemaName, Context context); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/SchemasClient.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/SchemasClient.java new file mode 100644 index 0000000000000..4bd64cc2174e5 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/SchemasClient.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.models.SchemaInner; + +/** + * An instance of this class provides access to all the operations defined in SchemasClient. + */ +public interface SchemasClient { + /** + * Get a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 Schema along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + Context context); + + /** + * Get a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Schema. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SchemaInner get(String resourceGroupName, String schemaRegistryName, String schemaName); + + /** + * Create a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 schema definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrReplaceWithResponse(String resourceGroupName, String schemaRegistryName, + String schemaName, SchemaInner resource, Context context); + + /** + * Create a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 schema definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SchemaInner createOrReplace(String resourceGroupName, String schemaRegistryName, String schemaName, + SchemaInner resource); + + /** + * Delete a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + Context context); + + /** + * Delete a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 schemaRegistryName, String schemaName); + + /** + * List Schema resources by SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Schema list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySchemaRegistry(String resourceGroupName, String schemaRegistryName); + + /** + * List Schema resources by SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 Schema list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySchemaRegistry(String resourceGroupName, String schemaRegistryName, + Context context); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/BillingContainerInner.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/BillingContainerInner.java new file mode 100644 index 0000000000000..2c70351f8a432 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/BillingContainerInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.models.BillingContainerProperties; +import java.io.IOException; + +/** + * billingContainer Model as Azure resource whose sole purpose is to keep track of billables resources under a + * subscription. + */ +@Immutable +public final class BillingContainerInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private BillingContainerProperties properties; + + /* + * Resource ETag + */ + private String etag; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of BillingContainerInner class. + */ + private BillingContainerInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public BillingContainerProperties properties() { + return this.properties; + } + + /** + * Get the etag property: Resource ETag. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BillingContainerInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BillingContainerInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BillingContainerInner. + */ + public static BillingContainerInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BillingContainerInner deserializedBillingContainerInner = new BillingContainerInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBillingContainerInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBillingContainerInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBillingContainerInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedBillingContainerInner.properties = BillingContainerProperties.fromJson(reader); + } else if ("etag".equals(fieldName)) { + deserializedBillingContainerInner.etag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedBillingContainerInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBillingContainerInner; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/DiscoveredAssetEndpointProfileInner.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/DiscoveredAssetEndpointProfileInner.java new file mode 100644 index 0000000000000..44ef009c51ade --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/DiscoveredAssetEndpointProfileInner.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileProperties; +import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; +import java.io.IOException; +import java.util.Map; + +/** + * Discovered Asset Endpoint Profile definition. + */ +@Fluent +public final class DiscoveredAssetEndpointProfileInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private DiscoveredAssetEndpointProfileProperties properties; + + /* + * The extended location. + */ + private ExtendedLocation extendedLocation; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DiscoveredAssetEndpointProfileInner class. + */ + public DiscoveredAssetEndpointProfileInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public DiscoveredAssetEndpointProfileProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the DiscoveredAssetEndpointProfileInner object itself. + */ + public DiscoveredAssetEndpointProfileInner withProperties(DiscoveredAssetEndpointProfileProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the DiscoveredAssetEndpointProfileInner object itself. + */ + public DiscoveredAssetEndpointProfileInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public DiscoveredAssetEndpointProfileInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DiscoveredAssetEndpointProfileInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (extendedLocation() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property extendedLocation in model DiscoveredAssetEndpointProfileInner")); + } else { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoveredAssetEndpointProfileInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredAssetEndpointProfileInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredAssetEndpointProfileInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscoveredAssetEndpointProfileInner. + */ + public static DiscoveredAssetEndpointProfileInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredAssetEndpointProfileInner deserializedDiscoveredAssetEndpointProfileInner + = new DiscoveredAssetEndpointProfileInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDiscoveredAssetEndpointProfileInner.withTags(tags); + } else if ("extendedLocation".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileInner.extendedLocation + = ExtendedLocation.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileInner.properties + = DiscoveredAssetEndpointProfileProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredAssetEndpointProfileInner; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/DiscoveredAssetInner.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/DiscoveredAssetInner.java new file mode 100644 index 0000000000000..366bebe17b207 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/DiscoveredAssetInner.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetProperties; +import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; +import java.io.IOException; +import java.util.Map; + +/** + * Discovered Asset definition. + */ +@Fluent +public final class DiscoveredAssetInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private DiscoveredAssetProperties properties; + + /* + * The extended location. + */ + private ExtendedLocation extendedLocation; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DiscoveredAssetInner class. + */ + public DiscoveredAssetInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public DiscoveredAssetProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the DiscoveredAssetInner object itself. + */ + public DiscoveredAssetInner withProperties(DiscoveredAssetProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extended location. + * + * @param extendedLocation the extendedLocation value to set. + * @return the DiscoveredAssetInner object itself. + */ + public DiscoveredAssetInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public DiscoveredAssetInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DiscoveredAssetInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (extendedLocation() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property extendedLocation in model DiscoveredAssetInner")); + } else { + extendedLocation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoveredAssetInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredAssetInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredAssetInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscoveredAssetInner. + */ + public static DiscoveredAssetInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredAssetInner deserializedDiscoveredAssetInner = new DiscoveredAssetInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDiscoveredAssetInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDiscoveredAssetInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDiscoveredAssetInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDiscoveredAssetInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDiscoveredAssetInner.withTags(tags); + } else if ("extendedLocation".equals(fieldName)) { + deserializedDiscoveredAssetInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedDiscoveredAssetInner.properties = DiscoveredAssetProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDiscoveredAssetInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredAssetInner; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/OperationStatusResultInner.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/OperationStatusResultInner.java index ef72a93767dfc..28ead9d57175c 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/OperationStatusResultInner.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/OperationStatusResultInner.java @@ -62,6 +62,11 @@ public final class OperationStatusResultInner implements JsonSerializable { + SchemaInner deserializedSchemaInner = new SchemaInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSchemaInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSchemaInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSchemaInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSchemaInner.properties = SchemaProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSchemaInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSchemaInner; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/SchemaRegistryInner.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/SchemaRegistryInner.java new file mode 100644 index 0000000000000..8abb1090dddca --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/SchemaRegistryInner.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryProperties; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentity; +import java.io.IOException; +import java.util.Map; + +/** + * Schema registry definition. + */ +@Fluent +public final class SchemaRegistryInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private SchemaRegistryProperties properties; + + /* + * The managed service identities assigned to this resource. + */ + private SystemAssignedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SchemaRegistryInner class. + */ + public SchemaRegistryInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public SchemaRegistryProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the SchemaRegistryInner object itself. + */ + public SchemaRegistryInner withProperties(SchemaRegistryProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public SystemAssignedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the SchemaRegistryInner object itself. + */ + public SchemaRegistryInner withIdentity(SystemAssignedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SchemaRegistryInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SchemaRegistryInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SchemaRegistryInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SchemaRegistryInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SchemaRegistryInner. + */ + public static SchemaRegistryInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SchemaRegistryInner deserializedSchemaRegistryInner = new SchemaRegistryInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSchemaRegistryInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSchemaRegistryInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSchemaRegistryInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSchemaRegistryInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSchemaRegistryInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSchemaRegistryInner.properties = SchemaRegistryProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedSchemaRegistryInner.identity = SystemAssignedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSchemaRegistryInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSchemaRegistryInner; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/SchemaVersionInner.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/SchemaVersionInner.java new file mode 100644 index 0000000000000..9c234ec7f0c84 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/fluent/models/SchemaVersionInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.models.SchemaVersionProperties; +import java.io.IOException; + +/** + * Schema version's definition. + */ +@Fluent +public final class SchemaVersionInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private SchemaVersionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SchemaVersionInner class. + */ + public SchemaVersionInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public SchemaVersionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the SchemaVersionInner object itself. + */ + public SchemaVersionInner withProperties(SchemaVersionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SchemaVersionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SchemaVersionInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SchemaVersionInner. + */ + public static SchemaVersionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SchemaVersionInner deserializedSchemaVersionInner = new SchemaVersionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSchemaVersionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSchemaVersionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSchemaVersionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSchemaVersionInner.properties = SchemaVersionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSchemaVersionInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSchemaVersionInner; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/AssetEndpointProfilesClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/AssetEndpointProfilesClientImpl.java index 67aabbbfc96b9..28ee7da06f691 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/AssetEndpointProfilesClientImpl.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/AssetEndpointProfilesClientImpl.java @@ -52,25 +52,25 @@ public final class AssetEndpointProfilesClientImpl implements AssetEndpointProfi /** * The service client containing this operation class. */ - private final DeviceRegistryClientImpl client; + private final DeviceRegistryManagementClientImpl client; /** * Initializes an instance of AssetEndpointProfilesClientImpl. * * @param client the instance of the service client containing this operation class. */ - AssetEndpointProfilesClientImpl(DeviceRegistryClientImpl client) { + AssetEndpointProfilesClientImpl(DeviceRegistryManagementClientImpl client) { this.service = RestProxy.create(AssetEndpointProfilesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for DeviceRegistryClientAssetEndpointProfiles to be used by the proxy - * service to perform REST calls. + * The interface defining all the services for DeviceRegistryManagementClientAssetEndpointProfiles to be used by the + * proxy service to perform REST calls. */ @Host("{endpoint}") - @ServiceInterface(name = "DeviceRegistryClient") + @ServiceInterface(name = "DeviceRegistryManage") public interface AssetEndpointProfilesService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}") diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/AssetsClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/AssetsClientImpl.java index beae8f67435c5..793a5c2ae7931 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/AssetsClientImpl.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/AssetsClientImpl.java @@ -52,24 +52,24 @@ public final class AssetsClientImpl implements AssetsClient { /** * The service client containing this operation class. */ - private final DeviceRegistryClientImpl client; + private final DeviceRegistryManagementClientImpl client; /** * Initializes an instance of AssetsClientImpl. * * @param client the instance of the service client containing this operation class. */ - AssetsClientImpl(DeviceRegistryClientImpl client) { + AssetsClientImpl(DeviceRegistryManagementClientImpl client) { this.service = RestProxy.create(AssetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for DeviceRegistryClientAssets to be used by the proxy service to perform - * REST calls. + * The interface defining all the services for DeviceRegistryManagementClientAssets to be used by the proxy service + * to perform REST calls. */ @Host("{endpoint}") - @ServiceInterface(name = "DeviceRegistryClient") + @ServiceInterface(name = "DeviceRegistryManage") public interface AssetsService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}") diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/BillingContainerImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/BillingContainerImpl.java new file mode 100644 index 0000000000000..553aa10e8b3ad --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/BillingContainerImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.deviceregistry.fluent.models.BillingContainerInner; +import com.azure.resourcemanager.deviceregistry.models.BillingContainer; +import com.azure.resourcemanager.deviceregistry.models.BillingContainerProperties; + +public final class BillingContainerImpl implements BillingContainer { + private BillingContainerInner innerObject; + + private final com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager; + + BillingContainerImpl(BillingContainerInner innerObject, + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager 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 BillingContainerProperties properties() { + return this.innerModel().properties(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public BillingContainerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/BillingContainersClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/BillingContainersClientImpl.java new file mode 100644 index 0000000000000..518d55d7ee971 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/BillingContainersClientImpl.java @@ -0,0 +1,359 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.BillingContainersClient; +import com.azure.resourcemanager.deviceregistry.fluent.models.BillingContainerInner; +import com.azure.resourcemanager.deviceregistry.implementation.models.BillingContainerListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BillingContainersClient. + */ +public final class BillingContainersClientImpl implements BillingContainersClient { + /** + * The proxy service used to perform REST calls. + */ + private final BillingContainersService service; + + /** + * The service client containing this operation class. + */ + private final DeviceRegistryManagementClientImpl client; + + /** + * Initializes an instance of BillingContainersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BillingContainersClientImpl(DeviceRegistryManagementClientImpl client) { + this.service + = RestProxy.create(BillingContainersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DeviceRegistryManagementClientBillingContainers to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DeviceRegistryManage") + public interface BillingContainersService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("billingContainerName") String billingContainerName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a BillingContainer. + * + * @param billingContainerName Name of the billing container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BillingContainer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String billingContainerName) { + 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 (billingContainerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingContainerName 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(), billingContainerName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a BillingContainer. + * + * @param billingContainerName Name of the billing container. + * @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 BillingContainer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String billingContainerName, 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 (billingContainerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingContainerName 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(), + billingContainerName, accept, context); + } + + /** + * Get a BillingContainer. + * + * @param billingContainerName Name of the billing container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BillingContainer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingContainerName) { + return getWithResponseAsync(billingContainerName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a BillingContainer. + * + * @param billingContainerName Name of the billing container. + * @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 BillingContainer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String billingContainerName, Context context) { + return getWithResponseAsync(billingContainerName, context).block(); + } + + /** + * Get a BillingContainer. + * + * @param billingContainerName Name of the billing container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 BillingContainer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingContainerInner get(String billingContainerName) { + return getWithResponse(billingContainerName, Context.NONE).getValue(); + } + + /** + * List BillingContainer 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 BillingContainer 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 BillingContainer 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 BillingContainer 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 BillingContainer 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 BillingContainer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List BillingContainer 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 BillingContainer 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 BillingContainer 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 BillingContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List BillingContainer 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 BillingContainer list operation 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 BillingContainer 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. + * @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 BillingContainer 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)); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/BillingContainersImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/BillingContainersImpl.java new file mode 100644 index 0000000000000..5ba318e04334a --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/BillingContainersImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.BillingContainersClient; +import com.azure.resourcemanager.deviceregistry.fluent.models.BillingContainerInner; +import com.azure.resourcemanager.deviceregistry.models.BillingContainer; +import com.azure.resourcemanager.deviceregistry.models.BillingContainers; + +public final class BillingContainersImpl implements BillingContainers { + private static final ClientLogger LOGGER = new ClientLogger(BillingContainersImpl.class); + + private final BillingContainersClient innerClient; + + private final com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager; + + public BillingContainersImpl(BillingContainersClient innerClient, + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String billingContainerName, Context context) { + Response inner = this.serviceClient().getWithResponse(billingContainerName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new BillingContainerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingContainer get(String billingContainerName) { + BillingContainerInner inner = this.serviceClient().get(billingContainerName); + if (inner != null) { + return new BillingContainerImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new BillingContainerImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new BillingContainerImpl(inner1, this.manager())); + } + + private BillingContainersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DeviceRegistryClientBuilder.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DeviceRegistryManagementClientBuilder.java similarity index 67% rename from sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DeviceRegistryClientBuilder.java rename to sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DeviceRegistryManagementClientBuilder.java index 54d34610039a1..c6ed35c90e842 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DeviceRegistryClientBuilder.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DeviceRegistryManagementClientBuilder.java @@ -15,10 +15,10 @@ import java.time.Duration; /** - * A builder for creating a new instance of the DeviceRegistryClientImpl type. + * A builder for creating a new instance of the DeviceRegistryManagementClientImpl type. */ -@ServiceClientBuilder(serviceClients = { DeviceRegistryClientImpl.class }) -public final class DeviceRegistryClientBuilder { +@ServiceClientBuilder(serviceClients = { DeviceRegistryManagementClientImpl.class }) +public final class DeviceRegistryManagementClientBuilder { /* * Service host */ @@ -28,9 +28,9 @@ public final class DeviceRegistryClientBuilder { * Sets Service host. * * @param endpoint the endpoint value. - * @return the DeviceRegistryClientBuilder. + * @return the DeviceRegistryManagementClientBuilder. */ - public DeviceRegistryClientBuilder endpoint(String endpoint) { + public DeviceRegistryManagementClientBuilder endpoint(String endpoint) { this.endpoint = endpoint; return this; } @@ -44,9 +44,9 @@ public DeviceRegistryClientBuilder endpoint(String endpoint) { * Sets The ID of the target subscription. The value must be an UUID. * * @param subscriptionId the subscriptionId value. - * @return the DeviceRegistryClientBuilder. + * @return the DeviceRegistryManagementClientBuilder. */ - public DeviceRegistryClientBuilder subscriptionId(String subscriptionId) { + public DeviceRegistryManagementClientBuilder subscriptionId(String subscriptionId) { this.subscriptionId = subscriptionId; return this; } @@ -60,9 +60,9 @@ public DeviceRegistryClientBuilder subscriptionId(String subscriptionId) { * Sets The environment to connect to. * * @param environment the environment value. - * @return the DeviceRegistryClientBuilder. + * @return the DeviceRegistryManagementClientBuilder. */ - public DeviceRegistryClientBuilder environment(AzureEnvironment environment) { + public DeviceRegistryManagementClientBuilder environment(AzureEnvironment environment) { this.environment = environment; return this; } @@ -76,9 +76,9 @@ public DeviceRegistryClientBuilder environment(AzureEnvironment environment) { * Sets The HTTP pipeline to send requests through. * * @param pipeline the pipeline value. - * @return the DeviceRegistryClientBuilder. + * @return the DeviceRegistryManagementClientBuilder. */ - public DeviceRegistryClientBuilder pipeline(HttpPipeline pipeline) { + public DeviceRegistryManagementClientBuilder pipeline(HttpPipeline pipeline) { this.pipeline = pipeline; return this; } @@ -92,9 +92,9 @@ public DeviceRegistryClientBuilder pipeline(HttpPipeline pipeline) { * Sets The default poll interval for long-running operation. * * @param defaultPollInterval the defaultPollInterval value. - * @return the DeviceRegistryClientBuilder. + * @return the DeviceRegistryManagementClientBuilder. */ - public DeviceRegistryClientBuilder defaultPollInterval(Duration defaultPollInterval) { + public DeviceRegistryManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { this.defaultPollInterval = defaultPollInterval; return this; } @@ -108,19 +108,19 @@ public DeviceRegistryClientBuilder defaultPollInterval(Duration defaultPollInter * Sets The serializer to serialize an object into a string. * * @param serializerAdapter the serializerAdapter value. - * @return the DeviceRegistryClientBuilder. + * @return the DeviceRegistryManagementClientBuilder. */ - public DeviceRegistryClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + public DeviceRegistryManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { this.serializerAdapter = serializerAdapter; return this; } /** - * Builds an instance of DeviceRegistryClientImpl with the provided parameters. + * Builds an instance of DeviceRegistryManagementClientImpl with the provided parameters. * - * @return an instance of DeviceRegistryClientImpl. + * @return an instance of DeviceRegistryManagementClientImpl. */ - public DeviceRegistryClientImpl buildClient() { + public DeviceRegistryManagementClientImpl buildClient() { String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; HttpPipeline localPipeline = (pipeline != null) @@ -131,8 +131,8 @@ public DeviceRegistryClientImpl buildClient() { SerializerAdapter localSerializerAdapter = (serializerAdapter != null) ? serializerAdapter : SerializerFactory.createDefaultManagementSerializerAdapter(); - DeviceRegistryClientImpl client = new DeviceRegistryClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + DeviceRegistryManagementClientImpl client = new DeviceRegistryManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); return client; } } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DeviceRegistryClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DeviceRegistryManagementClientImpl.java similarity index 74% rename from sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DeviceRegistryClientImpl.java rename to sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DeviceRegistryManagementClientImpl.java index f5cab59fef74c..9aa7a4bce55a2 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DeviceRegistryClientImpl.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DeviceRegistryManagementClientImpl.java @@ -25,9 +25,15 @@ import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.deviceregistry.fluent.AssetEndpointProfilesClient; import com.azure.resourcemanager.deviceregistry.fluent.AssetsClient; -import com.azure.resourcemanager.deviceregistry.fluent.DeviceRegistryClient; +import com.azure.resourcemanager.deviceregistry.fluent.BillingContainersClient; +import com.azure.resourcemanager.deviceregistry.fluent.DeviceRegistryManagementClient; +import com.azure.resourcemanager.deviceregistry.fluent.DiscoveredAssetEndpointProfilesClient; +import com.azure.resourcemanager.deviceregistry.fluent.DiscoveredAssetsClient; import com.azure.resourcemanager.deviceregistry.fluent.OperationStatusClient; import com.azure.resourcemanager.deviceregistry.fluent.OperationsClient; +import com.azure.resourcemanager.deviceregistry.fluent.SchemaRegistriesClient; +import com.azure.resourcemanager.deviceregistry.fluent.SchemaVersionsClient; +import com.azure.resourcemanager.deviceregistry.fluent.SchemasClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -38,10 +44,10 @@ import reactor.core.publisher.Mono; /** - * Initializes a new instance of the DeviceRegistryClientImpl type. + * Initializes a new instance of the DeviceRegistryManagementClientImpl type. */ -@ServiceClient(builder = DeviceRegistryClientBuilder.class) -public final class DeviceRegistryClientImpl implements DeviceRegistryClient { +@ServiceClient(builder = DeviceRegistryManagementClientBuilder.class) +public final class DeviceRegistryManagementClientImpl implements DeviceRegistryManagementClient { /** * Service host. */ @@ -183,7 +189,91 @@ public AssetEndpointProfilesClient getAssetEndpointProfiles() { } /** - * Initializes an instance of DeviceRegistryClient client. + * The BillingContainersClient object to access its operations. + */ + private final BillingContainersClient billingContainers; + + /** + * Gets the BillingContainersClient object to access its operations. + * + * @return the BillingContainersClient object. + */ + public BillingContainersClient getBillingContainers() { + return this.billingContainers; + } + + /** + * The DiscoveredAssetsClient object to access its operations. + */ + private final DiscoveredAssetsClient discoveredAssets; + + /** + * Gets the DiscoveredAssetsClient object to access its operations. + * + * @return the DiscoveredAssetsClient object. + */ + public DiscoveredAssetsClient getDiscoveredAssets() { + return this.discoveredAssets; + } + + /** + * The DiscoveredAssetEndpointProfilesClient object to access its operations. + */ + private final DiscoveredAssetEndpointProfilesClient discoveredAssetEndpointProfiles; + + /** + * Gets the DiscoveredAssetEndpointProfilesClient object to access its operations. + * + * @return the DiscoveredAssetEndpointProfilesClient object. + */ + public DiscoveredAssetEndpointProfilesClient getDiscoveredAssetEndpointProfiles() { + return this.discoveredAssetEndpointProfiles; + } + + /** + * The SchemaRegistriesClient object to access its operations. + */ + private final SchemaRegistriesClient schemaRegistries; + + /** + * Gets the SchemaRegistriesClient object to access its operations. + * + * @return the SchemaRegistriesClient object. + */ + public SchemaRegistriesClient getSchemaRegistries() { + return this.schemaRegistries; + } + + /** + * The SchemasClient object to access its operations. + */ + private final SchemasClient schemas; + + /** + * Gets the SchemasClient object to access its operations. + * + * @return the SchemasClient object. + */ + public SchemasClient getSchemas() { + return this.schemas; + } + + /** + * The SchemaVersionsClient object to access its operations. + */ + private final SchemaVersionsClient schemaVersions; + + /** + * Gets the SchemaVersionsClient object to access its operations. + * + * @return the SchemaVersionsClient object. + */ + public SchemaVersionsClient getSchemaVersions() { + return this.schemaVersions; + } + + /** + * Initializes an instance of DeviceRegistryManagementClient client. * * @param httpPipeline The HTTP pipeline to send requests through. * @param serializerAdapter The serializer to serialize an object into a string. @@ -192,18 +282,24 @@ public AssetEndpointProfilesClient getAssetEndpointProfiles() { * @param endpoint Service host. * @param subscriptionId The ID of the target subscription. The value must be an UUID. */ - DeviceRegistryClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + DeviceRegistryManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; this.endpoint = endpoint; this.subscriptionId = subscriptionId; - this.apiVersion = "2023-11-01-preview"; + this.apiVersion = "2024-09-01-preview"; this.operations = new OperationsClientImpl(this); this.operationStatus = new OperationStatusClientImpl(this); this.assets = new AssetsClientImpl(this); this.assetEndpointProfiles = new AssetEndpointProfilesClientImpl(this); + this.billingContainers = new BillingContainersClientImpl(this); + this.discoveredAssets = new DiscoveredAssetsClientImpl(this); + this.discoveredAssetEndpointProfiles = new DiscoveredAssetEndpointProfilesClientImpl(this); + this.schemaRegistries = new SchemaRegistriesClientImpl(this); + this.schemas = new SchemasClientImpl(this); + this.schemaVersions = new SchemaVersionsClientImpl(this); } /** @@ -332,5 +428,5 @@ public Mono getBodyAsString(Charset charset) { } } - private static final ClientLogger LOGGER = new ClientLogger(DeviceRegistryClientImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(DeviceRegistryManagementClientImpl.class); } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetEndpointProfileImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetEndpointProfileImpl.java new file mode 100644 index 0000000000000..88b31fc2df856 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetEndpointProfileImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetEndpointProfileInner; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfile; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileProperties; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileUpdateProperties; +import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; +import java.util.Collections; +import java.util.Map; + +public final class DiscoveredAssetEndpointProfileImpl implements DiscoveredAssetEndpointProfile, + DiscoveredAssetEndpointProfile.Definition, DiscoveredAssetEndpointProfile.Update { + private DiscoveredAssetEndpointProfileInner innerObject; + + private final com.azure.resourcemanager.deviceregistry.DeviceRegistryManager 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 DiscoveredAssetEndpointProfileProperties properties() { + return this.innerModel().properties(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DiscoveredAssetEndpointProfileInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String discoveredAssetEndpointProfileName; + + private DiscoveredAssetEndpointProfileUpdate updateProperties; + + public DiscoveredAssetEndpointProfileImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DiscoveredAssetEndpointProfile create() { + this.innerObject = serviceManager.serviceClient() + .getDiscoveredAssetEndpointProfiles() + .createOrReplace(resourceGroupName, discoveredAssetEndpointProfileName, this.innerModel(), Context.NONE); + return this; + } + + public DiscoveredAssetEndpointProfile create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDiscoveredAssetEndpointProfiles() + .createOrReplace(resourceGroupName, discoveredAssetEndpointProfileName, this.innerModel(), context); + return this; + } + + DiscoveredAssetEndpointProfileImpl(String name, + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerObject = new DiscoveredAssetEndpointProfileInner(); + this.serviceManager = serviceManager; + this.discoveredAssetEndpointProfileName = name; + } + + public DiscoveredAssetEndpointProfileImpl update() { + this.updateProperties = new DiscoveredAssetEndpointProfileUpdate(); + return this; + } + + public DiscoveredAssetEndpointProfile apply() { + this.innerObject = serviceManager.serviceClient() + .getDiscoveredAssetEndpointProfiles() + .update(resourceGroupName, discoveredAssetEndpointProfileName, updateProperties, Context.NONE); + return this; + } + + public DiscoveredAssetEndpointProfile apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDiscoveredAssetEndpointProfiles() + .update(resourceGroupName, discoveredAssetEndpointProfileName, updateProperties, context); + return this; + } + + DiscoveredAssetEndpointProfileImpl(DiscoveredAssetEndpointProfileInner innerObject, + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.discoveredAssetEndpointProfileName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "discoveredAssetEndpointProfiles"); + } + + public DiscoveredAssetEndpointProfile refresh() { + this.innerObject = serviceManager.serviceClient() + .getDiscoveredAssetEndpointProfiles() + .getByResourceGroupWithResponse(resourceGroupName, discoveredAssetEndpointProfileName, Context.NONE) + .getValue(); + return this; + } + + public DiscoveredAssetEndpointProfile refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDiscoveredAssetEndpointProfiles() + .getByResourceGroupWithResponse(resourceGroupName, discoveredAssetEndpointProfileName, context) + .getValue(); + return this; + } + + public DiscoveredAssetEndpointProfileImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DiscoveredAssetEndpointProfileImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DiscoveredAssetEndpointProfileImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public DiscoveredAssetEndpointProfileImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public DiscoveredAssetEndpointProfileImpl withProperties(DiscoveredAssetEndpointProfileProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public DiscoveredAssetEndpointProfileImpl + withProperties(DiscoveredAssetEndpointProfileUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetEndpointProfilesClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetEndpointProfilesClientImpl.java new file mode 100644 index 0000000000000..0075dd1ba2ab9 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetEndpointProfilesClientImpl.java @@ -0,0 +1,1337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.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.deviceregistry.fluent.DiscoveredAssetEndpointProfilesClient; +import com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetEndpointProfileInner; +import com.azure.resourcemanager.deviceregistry.implementation.models.DiscoveredAssetEndpointProfileListResult; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate; +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 DiscoveredAssetEndpointProfilesClient. + */ +public final class DiscoveredAssetEndpointProfilesClientImpl implements DiscoveredAssetEndpointProfilesClient { + /** + * The proxy service used to perform REST calls. + */ + private final DiscoveredAssetEndpointProfilesService service; + + /** + * The service client containing this operation class. + */ + private final DeviceRegistryManagementClientImpl client; + + /** + * Initializes an instance of DiscoveredAssetEndpointProfilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DiscoveredAssetEndpointProfilesClientImpl(DeviceRegistryManagementClientImpl client) { + this.service = RestProxy.create(DiscoveredAssetEndpointProfilesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DeviceRegistryManagementClientDiscoveredAssetEndpointProfiles to be + * used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DeviceRegistryManage") + public interface DiscoveredAssetEndpointProfilesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("discoveredAssetEndpointProfileName") String discoveredAssetEndpointProfileName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("discoveredAssetEndpointProfileName") String discoveredAssetEndpointProfileName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DiscoveredAssetEndpointProfileInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("discoveredAssetEndpointProfileName") String discoveredAssetEndpointProfileName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DiscoveredAssetEndpointProfileUpdate properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles/{discoveredAssetEndpointProfileName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("discoveredAssetEndpointProfileName") String discoveredAssetEndpointProfileName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("endpoint") 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}/providers/Microsoft.DeviceRegistry/discoveredAssetEndpointProfiles") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, + @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 DiscoveredAssetEndpointProfile along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getByResourceGroupWithResponseAsync(String resourceGroupName, String discoveredAssetEndpointProfileName) { + 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 (discoveredAssetEndpointProfileName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter discoveredAssetEndpointProfileName 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, discoveredAssetEndpointProfileName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 DiscoveredAssetEndpointProfile along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String discoveredAssetEndpointProfileName, 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 (discoveredAssetEndpointProfileName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter discoveredAssetEndpointProfileName 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, discoveredAssetEndpointProfileName, accept, context); + } + + /** + * Get a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 DiscoveredAssetEndpointProfile on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, discoveredAssetEndpointProfileName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 DiscoveredAssetEndpointProfile along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String discoveredAssetEndpointProfileName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, discoveredAssetEndpointProfileName, context) + .block(); + } + + /** + * Get a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 DiscoveredAssetEndpointProfile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredAssetEndpointProfileInner getByResourceGroup(String resourceGroupName, + String discoveredAssetEndpointProfileName) { + return getByResourceGroupWithResponse(resourceGroupName, discoveredAssetEndpointProfileName, Context.NONE) + .getValue(); + } + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileInner 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 (discoveredAssetEndpointProfileName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter discoveredAssetEndpointProfileName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, discoveredAssetEndpointProfileName, contentType, + accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileInner 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 (discoveredAssetEndpointProfileName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter discoveredAssetEndpointProfileName 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, discoveredAssetEndpointProfileName, contentType, accept, + resource, context); + } + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoveredAssetEndpointProfileInner> + beginCreateOrReplaceAsync(String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileInner resource) { + Mono>> mono + = createOrReplaceWithResponseAsync(resourceGroupName, discoveredAssetEndpointProfileName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DiscoveredAssetEndpointProfileInner.class, + DiscoveredAssetEndpointProfileInner.class, this.client.getContext()); + } + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoveredAssetEndpointProfileInner> + beginCreateOrReplaceAsync(String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrReplaceWithResponseAsync(resourceGroupName, + discoveredAssetEndpointProfileName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DiscoveredAssetEndpointProfileInner.class, + DiscoveredAssetEndpointProfileInner.class, context); + } + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoveredAssetEndpointProfileInner> + beginCreateOrReplace(String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileInner resource) { + return this.beginCreateOrReplaceAsync(resourceGroupName, discoveredAssetEndpointProfileName, resource) + .getSyncPoller(); + } + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoveredAssetEndpointProfileInner> + beginCreateOrReplace(String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileInner resource, Context context) { + return this.beginCreateOrReplaceAsync(resourceGroupName, discoveredAssetEndpointProfileName, resource, context) + .getSyncPoller(); + } + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileInner resource) { + return beginCreateOrReplaceAsync(resourceGroupName, discoveredAssetEndpointProfileName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileInner resource, Context context) { + return beginCreateOrReplaceAsync(resourceGroupName, discoveredAssetEndpointProfileName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredAssetEndpointProfileInner createOrReplace(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileInner resource) { + return createOrReplaceAsync(resourceGroupName, discoveredAssetEndpointProfileName, resource).block(); + } + + /** + * Create a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredAssetEndpointProfileInner createOrReplace(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileInner resource, Context context) { + return createOrReplaceAsync(resourceGroupName, discoveredAssetEndpointProfileName, resource, context).block(); + } + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileUpdate 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 (discoveredAssetEndpointProfileName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter discoveredAssetEndpointProfileName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, discoveredAssetEndpointProfileName, contentType, + accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileUpdate 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 (discoveredAssetEndpointProfileName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter discoveredAssetEndpointProfileName 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, discoveredAssetEndpointProfileName, contentType, accept, properties, context); + } + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoveredAssetEndpointProfileInner> + beginUpdateAsync(String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, discoveredAssetEndpointProfileName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DiscoveredAssetEndpointProfileInner.class, + DiscoveredAssetEndpointProfileInner.class, this.client.getContext()); + } + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoveredAssetEndpointProfileInner> + beginUpdateAsync(String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileUpdate properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, discoveredAssetEndpointProfileName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DiscoveredAssetEndpointProfileInner.class, + DiscoveredAssetEndpointProfileInner.class, context); + } + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoveredAssetEndpointProfileInner> beginUpdate( + String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, discoveredAssetEndpointProfileName, properties).getSyncPoller(); + } + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoveredAssetEndpointProfileInner> beginUpdate( + String resourceGroupName, String discoveredAssetEndpointProfileName, + DiscoveredAssetEndpointProfileUpdate properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, discoveredAssetEndpointProfileName, properties, context) + .getSyncPoller(); + } + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileUpdate properties) { + return beginUpdateAsync(resourceGroupName, discoveredAssetEndpointProfileName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, discoveredAssetEndpointProfileName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredAssetEndpointProfileInner update(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileUpdate properties) { + return updateAsync(resourceGroupName, discoveredAssetEndpointProfileName, properties).block(); + } + + /** + * Update a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discovered Asset Endpoint Profile definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredAssetEndpointProfileInner update(String resourceGroupName, + String discoveredAssetEndpointProfileName, DiscoveredAssetEndpointProfileUpdate properties, Context context) { + return updateAsync(resourceGroupName, discoveredAssetEndpointProfileName, properties, context).block(); + } + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName) { + 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 (discoveredAssetEndpointProfileName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter discoveredAssetEndpointProfileName 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, discoveredAssetEndpointProfileName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName, 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 (discoveredAssetEndpointProfileName == null) { + return Mono.error(new IllegalArgumentException( + "Parameter discoveredAssetEndpointProfileName 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, discoveredAssetEndpointProfileName, accept, context); + } + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, discoveredAssetEndpointProfileName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String discoveredAssetEndpointProfileName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, discoveredAssetEndpointProfileName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, + String discoveredAssetEndpointProfileName) { + return this.beginDeleteAsync(resourceGroupName, discoveredAssetEndpointProfileName).getSyncPoller(); + } + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, + String discoveredAssetEndpointProfileName, Context context) { + return this.beginDeleteAsync(resourceGroupName, discoveredAssetEndpointProfileName, context).getSyncPoller(); + } + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String discoveredAssetEndpointProfileName) { + return beginDeleteAsync(resourceGroupName, discoveredAssetEndpointProfileName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String discoveredAssetEndpointProfileName, + Context context) { + return beginDeleteAsync(resourceGroupName, discoveredAssetEndpointProfileName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String discoveredAssetEndpointProfileName) { + deleteAsync(resourceGroupName, discoveredAssetEndpointProfileName).block(); + } + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String discoveredAssetEndpointProfileName, Context context) { + deleteAsync(resourceGroupName, discoveredAssetEndpointProfileName, context).block(); + } + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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)); + } + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile list operation 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 DiscoveredAssetEndpointProfile 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. + * @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 DiscoveredAssetEndpointProfile 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 DiscoveredAssetEndpointProfile 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. + * @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 DiscoveredAssetEndpointProfile 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)); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetEndpointProfilesImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetEndpointProfilesImpl.java new file mode 100644 index 0000000000000..34c7bc45c5dfb --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetEndpointProfilesImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.DiscoveredAssetEndpointProfilesClient; +import com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetEndpointProfileInner; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfile; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfiles; + +public final class DiscoveredAssetEndpointProfilesImpl implements DiscoveredAssetEndpointProfiles { + private static final ClientLogger LOGGER = new ClientLogger(DiscoveredAssetEndpointProfilesImpl.class); + + private final DiscoveredAssetEndpointProfilesClient innerClient; + + private final com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager; + + public DiscoveredAssetEndpointProfilesImpl(DiscoveredAssetEndpointProfilesClient innerClient, + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String discoveredAssetEndpointProfileName, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, discoveredAssetEndpointProfileName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DiscoveredAssetEndpointProfileImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DiscoveredAssetEndpointProfile getByResourceGroup(String resourceGroupName, + String discoveredAssetEndpointProfileName) { + DiscoveredAssetEndpointProfileInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, discoveredAssetEndpointProfileName); + if (inner != null) { + return new DiscoveredAssetEndpointProfileImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String discoveredAssetEndpointProfileName) { + this.serviceClient().delete(resourceGroupName, discoveredAssetEndpointProfileName); + } + + public void delete(String resourceGroupName, String discoveredAssetEndpointProfileName, Context context) { + this.serviceClient().delete(resourceGroupName, discoveredAssetEndpointProfileName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new DiscoveredAssetEndpointProfileImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, + Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new DiscoveredAssetEndpointProfileImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new DiscoveredAssetEndpointProfileImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new DiscoveredAssetEndpointProfileImpl(inner1, this.manager())); + } + + public DiscoveredAssetEndpointProfile getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String discoveredAssetEndpointProfileName + = ResourceManagerUtils.getValueFromIdByName(id, "discoveredAssetEndpointProfiles"); + if (discoveredAssetEndpointProfileName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'discoveredAssetEndpointProfiles'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, discoveredAssetEndpointProfileName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String discoveredAssetEndpointProfileName + = ResourceManagerUtils.getValueFromIdByName(id, "discoveredAssetEndpointProfiles"); + if (discoveredAssetEndpointProfileName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'discoveredAssetEndpointProfiles'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, discoveredAssetEndpointProfileName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String discoveredAssetEndpointProfileName + = ResourceManagerUtils.getValueFromIdByName(id, "discoveredAssetEndpointProfiles"); + if (discoveredAssetEndpointProfileName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'discoveredAssetEndpointProfiles'.", id))); + } + this.delete(resourceGroupName, discoveredAssetEndpointProfileName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String discoveredAssetEndpointProfileName + = ResourceManagerUtils.getValueFromIdByName(id, "discoveredAssetEndpointProfiles"); + if (discoveredAssetEndpointProfileName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format( + "The resource ID '%s' is not valid. Missing path segment 'discoveredAssetEndpointProfiles'.", id))); + } + this.delete(resourceGroupName, discoveredAssetEndpointProfileName, context); + } + + private DiscoveredAssetEndpointProfilesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager() { + return this.serviceManager; + } + + public DiscoveredAssetEndpointProfileImpl define(String name) { + return new DiscoveredAssetEndpointProfileImpl(name, this.manager()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetImpl.java new file mode 100644 index 0000000000000..06cf3ec63c155 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetInner; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAsset; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetProperties; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetUpdate; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetUpdateProperties; +import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; +import java.util.Collections; +import java.util.Map; + +public final class DiscoveredAssetImpl implements DiscoveredAsset, DiscoveredAsset.Definition, DiscoveredAsset.Update { + private DiscoveredAssetInner innerObject; + + private final com.azure.resourcemanager.deviceregistry.DeviceRegistryManager 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 DiscoveredAssetProperties properties() { + return this.innerModel().properties(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DiscoveredAssetInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String discoveredAssetName; + + private DiscoveredAssetUpdate updateProperties; + + public DiscoveredAssetImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DiscoveredAsset create() { + this.innerObject = serviceManager.serviceClient() + .getDiscoveredAssets() + .createOrReplace(resourceGroupName, discoveredAssetName, this.innerModel(), Context.NONE); + return this; + } + + public DiscoveredAsset create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDiscoveredAssets() + .createOrReplace(resourceGroupName, discoveredAssetName, this.innerModel(), context); + return this; + } + + DiscoveredAssetImpl(String name, com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerObject = new DiscoveredAssetInner(); + this.serviceManager = serviceManager; + this.discoveredAssetName = name; + } + + public DiscoveredAssetImpl update() { + this.updateProperties = new DiscoveredAssetUpdate(); + return this; + } + + public DiscoveredAsset apply() { + this.innerObject = serviceManager.serviceClient() + .getDiscoveredAssets() + .update(resourceGroupName, discoveredAssetName, updateProperties, Context.NONE); + return this; + } + + public DiscoveredAsset apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDiscoveredAssets() + .update(resourceGroupName, discoveredAssetName, updateProperties, context); + return this; + } + + DiscoveredAssetImpl(DiscoveredAssetInner innerObject, + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.discoveredAssetName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "discoveredAssets"); + } + + public DiscoveredAsset refresh() { + this.innerObject = serviceManager.serviceClient() + .getDiscoveredAssets() + .getByResourceGroupWithResponse(resourceGroupName, discoveredAssetName, Context.NONE) + .getValue(); + return this; + } + + public DiscoveredAsset refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDiscoveredAssets() + .getByResourceGroupWithResponse(resourceGroupName, discoveredAssetName, context) + .getValue(); + return this; + } + + public DiscoveredAssetImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DiscoveredAssetImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DiscoveredAssetImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public DiscoveredAssetImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public DiscoveredAssetImpl withProperties(DiscoveredAssetProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public DiscoveredAssetImpl withProperties(DiscoveredAssetUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetsClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetsClientImpl.java new file mode 100644 index 0000000000000..17a821c7e2ddb --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetsClientImpl.java @@ -0,0 +1,1296 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.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.deviceregistry.fluent.DiscoveredAssetsClient; +import com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetInner; +import com.azure.resourcemanager.deviceregistry.implementation.models.DiscoveredAssetListResult; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetUpdate; +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 DiscoveredAssetsClient. + */ +public final class DiscoveredAssetsClientImpl implements DiscoveredAssetsClient { + /** + * The proxy service used to perform REST calls. + */ + private final DiscoveredAssetsService service; + + /** + * The service client containing this operation class. + */ + private final DeviceRegistryManagementClientImpl client; + + /** + * Initializes an instance of DiscoveredAssetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DiscoveredAssetsClientImpl(DeviceRegistryManagementClientImpl client) { + this.service + = RestProxy.create(DiscoveredAssetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DeviceRegistryManagementClientDiscoveredAssets to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DeviceRegistryManage") + public interface DiscoveredAssetsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("discoveredAssetName") String discoveredAssetName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("discoveredAssetName") String discoveredAssetName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DiscoveredAssetInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("discoveredAssetName") String discoveredAssetName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") DiscoveredAssetUpdate properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets/{discoveredAssetName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("discoveredAssetName") String discoveredAssetName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/discoveredAssets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") 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}/providers/Microsoft.DeviceRegistry/discoveredAssets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, + @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 DiscoveredAsset along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String discoveredAssetName) { + 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 (discoveredAssetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter discoveredAssetName 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, discoveredAssetName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 DiscoveredAsset along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String discoveredAssetName, 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 (discoveredAssetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter discoveredAssetName 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, discoveredAssetName, accept, context); + } + + /** + * Get a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 DiscoveredAsset on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String discoveredAssetName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, discoveredAssetName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 DiscoveredAsset along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String discoveredAssetName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, discoveredAssetName, context).block(); + } + + /** + * Get a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 DiscoveredAsset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredAssetInner getByResourceGroup(String resourceGroupName, String discoveredAssetName) { + return getByResourceGroupWithResponse(resourceGroupName, discoveredAssetName, Context.NONE).getValue(); + } + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, + String discoveredAssetName, DiscoveredAssetInner 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 (discoveredAssetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter discoveredAssetName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, discoveredAssetName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, + String discoveredAssetName, DiscoveredAssetInner 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 (discoveredAssetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter discoveredAssetName 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, discoveredAssetName, contentType, accept, resource, + context); + } + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoveredAssetInner> + beginCreateOrReplaceAsync(String resourceGroupName, String discoveredAssetName, DiscoveredAssetInner resource) { + Mono>> mono + = createOrReplaceWithResponseAsync(resourceGroupName, discoveredAssetName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + DiscoveredAssetInner.class, DiscoveredAssetInner.class, this.client.getContext()); + } + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoveredAssetInner> beginCreateOrReplaceAsync( + String resourceGroupName, String discoveredAssetName, DiscoveredAssetInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrReplaceWithResponseAsync(resourceGroupName, discoveredAssetName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + DiscoveredAssetInner.class, DiscoveredAssetInner.class, context); + } + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoveredAssetInner> + beginCreateOrReplace(String resourceGroupName, String discoveredAssetName, DiscoveredAssetInner resource) { + return this.beginCreateOrReplaceAsync(resourceGroupName, discoveredAssetName, resource).getSyncPoller(); + } + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoveredAssetInner> beginCreateOrReplace( + String resourceGroupName, String discoveredAssetName, DiscoveredAssetInner resource, Context context) { + return this.beginCreateOrReplaceAsync(resourceGroupName, discoveredAssetName, resource, context) + .getSyncPoller(); + } + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, String discoveredAssetName, + DiscoveredAssetInner resource) { + return beginCreateOrReplaceAsync(resourceGroupName, discoveredAssetName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, String discoveredAssetName, + DiscoveredAssetInner resource, Context context) { + return beginCreateOrReplaceAsync(resourceGroupName, discoveredAssetName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredAssetInner createOrReplace(String resourceGroupName, String discoveredAssetName, + DiscoveredAssetInner resource) { + return createOrReplaceAsync(resourceGroupName, discoveredAssetName, resource).block(); + } + + /** + * Create a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredAssetInner createOrReplace(String resourceGroupName, String discoveredAssetName, + DiscoveredAssetInner resource, Context context) { + return createOrReplaceAsync(resourceGroupName, discoveredAssetName, resource, context).block(); + } + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String discoveredAssetName, DiscoveredAssetUpdate 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 (discoveredAssetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter discoveredAssetName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, discoveredAssetName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String discoveredAssetName, DiscoveredAssetUpdate 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 (discoveredAssetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter discoveredAssetName 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, discoveredAssetName, contentType, accept, properties, context); + } + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoveredAssetInner> + beginUpdateAsync(String resourceGroupName, String discoveredAssetName, DiscoveredAssetUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, discoveredAssetName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + DiscoveredAssetInner.class, DiscoveredAssetInner.class, this.client.getContext()); + } + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoveredAssetInner> beginUpdateAsync( + String resourceGroupName, String discoveredAssetName, DiscoveredAssetUpdate properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, discoveredAssetName, properties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + DiscoveredAssetInner.class, DiscoveredAssetInner.class, context); + } + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoveredAssetInner> beginUpdate(String resourceGroupName, + String discoveredAssetName, DiscoveredAssetUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, discoveredAssetName, properties).getSyncPoller(); + } + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoveredAssetInner> beginUpdate(String resourceGroupName, + String discoveredAssetName, DiscoveredAssetUpdate properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, discoveredAssetName, properties, context).getSyncPoller(); + } + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String discoveredAssetName, + DiscoveredAssetUpdate properties) { + return beginUpdateAsync(resourceGroupName, discoveredAssetName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String discoveredAssetName, + DiscoveredAssetUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, discoveredAssetName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredAssetInner update(String resourceGroupName, String discoveredAssetName, + DiscoveredAssetUpdate properties) { + return updateAsync(resourceGroupName, discoveredAssetName, properties).block(); + } + + /** + * Update a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discovered Asset definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveredAssetInner update(String resourceGroupName, String discoveredAssetName, + DiscoveredAssetUpdate properties, Context context) { + return updateAsync(resourceGroupName, discoveredAssetName, properties, context).block(); + } + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String discoveredAssetName) { + 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 (discoveredAssetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter discoveredAssetName 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, discoveredAssetName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String discoveredAssetName, 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 (discoveredAssetName == null) { + return Mono + .error(new IllegalArgumentException("Parameter discoveredAssetName 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, discoveredAssetName, accept, context); + } + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String discoveredAssetName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, discoveredAssetName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String discoveredAssetName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, discoveredAssetName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String discoveredAssetName) { + return this.beginDeleteAsync(resourceGroupName, discoveredAssetName).getSyncPoller(); + } + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String discoveredAssetName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, discoveredAssetName, context).getSyncPoller(); + } + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String discoveredAssetName) { + return beginDeleteAsync(resourceGroupName, discoveredAssetName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String discoveredAssetName, Context context) { + return beginDeleteAsync(resourceGroupName, discoveredAssetName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String discoveredAssetName) { + deleteAsync(resourceGroupName, discoveredAssetName).block(); + } + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String discoveredAssetName, Context context) { + deleteAsync(resourceGroupName, discoveredAssetName, context).block(); + } + + /** + * List DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List DiscoveredAsset 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 DiscoveredAsset 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)); + } + + /** + * List DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset 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 DiscoveredAsset list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List DiscoveredAsset 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 DiscoveredAsset list operation 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 DiscoveredAsset 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. + * @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 DiscoveredAsset 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 DiscoveredAsset 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. + * @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 DiscoveredAsset 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)); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetsImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetsImpl.java new file mode 100644 index 0000000000000..e4c26f8f15dbe --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/DiscoveredAssetsImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.DiscoveredAssetsClient; +import com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetInner; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAsset; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssets; + +public final class DiscoveredAssetsImpl implements DiscoveredAssets { + private static final ClientLogger LOGGER = new ClientLogger(DiscoveredAssetsImpl.class); + + private final DiscoveredAssetsClient innerClient; + + private final com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager; + + public DiscoveredAssetsImpl(DiscoveredAssetsClient innerClient, + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String discoveredAssetName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, discoveredAssetName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DiscoveredAssetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DiscoveredAsset getByResourceGroup(String resourceGroupName, String discoveredAssetName) { + DiscoveredAssetInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, discoveredAssetName); + if (inner != null) { + return new DiscoveredAssetImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String discoveredAssetName) { + this.serviceClient().delete(resourceGroupName, discoveredAssetName); + } + + public void delete(String resourceGroupName, String discoveredAssetName, Context context) { + this.serviceClient().delete(resourceGroupName, discoveredAssetName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DiscoveredAssetImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DiscoveredAssetImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DiscoveredAssetImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DiscoveredAssetImpl(inner1, this.manager())); + } + + public DiscoveredAsset getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String discoveredAssetName = ResourceManagerUtils.getValueFromIdByName(id, "discoveredAssets"); + if (discoveredAssetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'discoveredAssets'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, discoveredAssetName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String discoveredAssetName = ResourceManagerUtils.getValueFromIdByName(id, "discoveredAssets"); + if (discoveredAssetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'discoveredAssets'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, discoveredAssetName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String discoveredAssetName = ResourceManagerUtils.getValueFromIdByName(id, "discoveredAssets"); + if (discoveredAssetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'discoveredAssets'.", id))); + } + this.delete(resourceGroupName, discoveredAssetName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String discoveredAssetName = ResourceManagerUtils.getValueFromIdByName(id, "discoveredAssets"); + if (discoveredAssetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'discoveredAssets'.", id))); + } + this.delete(resourceGroupName, discoveredAssetName, context); + } + + private DiscoveredAssetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager() { + return this.serviceManager; + } + + public DiscoveredAssetImpl define(String name) { + return new DiscoveredAssetImpl(name, this.manager()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/OperationStatusClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/OperationStatusClientImpl.java index 43559249df707..474a3ddf8d791 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/OperationStatusClientImpl.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/OperationStatusClientImpl.java @@ -37,25 +37,25 @@ public final class OperationStatusClientImpl implements OperationStatusClient { /** * The service client containing this operation class. */ - private final DeviceRegistryClientImpl client; + private final DeviceRegistryManagementClientImpl client; /** * Initializes an instance of OperationStatusClientImpl. * * @param client the instance of the service client containing this operation class. */ - OperationStatusClientImpl(DeviceRegistryClientImpl client) { + OperationStatusClientImpl(DeviceRegistryManagementClientImpl client) { this.service = RestProxy.create(OperationStatusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for DeviceRegistryClientOperationStatus to be used by the proxy service - * to perform REST calls. + * The interface defining all the services for DeviceRegistryManagementClientOperationStatus to be used by the proxy + * service to perform REST calls. */ @Host("{endpoint}") - @ServiceInterface(name = "DeviceRegistryClient") + @ServiceInterface(name = "DeviceRegistryManage") public interface OperationStatusService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/locations/{location}/operationStatuses/{operationId}") diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/OperationStatusResultImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/OperationStatusResultImpl.java index adf05ea2a2a26..db6aeb1dfeeb1 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/OperationStatusResultImpl.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/OperationStatusResultImpl.java @@ -62,6 +62,10 @@ public ManagementError error() { return this.innerModel().error(); } + public String resourceId() { + return this.innerModel().resourceId(); + } + public OperationStatusResultInner innerModel() { return this.innerObject; } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/OperationsClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/OperationsClientImpl.java index 9665ac95f650f..9080503034ea8 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/OperationsClientImpl.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/OperationsClientImpl.java @@ -42,25 +42,25 @@ public final class OperationsClientImpl implements OperationsClient { /** * The service client containing this operation class. */ - private final DeviceRegistryClientImpl client; + private final DeviceRegistryManagementClientImpl client; /** * Initializes an instance of OperationsClientImpl. * * @param client the instance of the service client containing this operation class. */ - OperationsClientImpl(DeviceRegistryClientImpl client) { + OperationsClientImpl(DeviceRegistryManagementClientImpl client) { this.service = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for DeviceRegistryClientOperations to be used by the proxy service to - * perform REST calls. + * The interface defining all the services for DeviceRegistryManagementClientOperations to be used by the proxy + * service to perform REST calls. */ @Host("{endpoint}") - @ServiceInterface(name = "DeviceRegistryClient") + @ServiceInterface(name = "DeviceRegistryManage") public interface OperationsService { @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.DeviceRegistry/operations") diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaImpl.java new file mode 100644 index 0000000000000..19245be6f64eb --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaImpl.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaInner; +import com.azure.resourcemanager.deviceregistry.models.Schema; +import com.azure.resourcemanager.deviceregistry.models.SchemaProperties; + +public final class SchemaImpl implements Schema, Schema.Definition { + private SchemaInner innerObject; + + private final com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager; + + SchemaImpl(SchemaInner innerObject, com.azure.resourcemanager.deviceregistry.DeviceRegistryManager 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 SchemaProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SchemaInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String schemaRegistryName; + + private String schemaName; + + public SchemaImpl withExistingSchemaRegistry(String resourceGroupName, String schemaRegistryName) { + this.resourceGroupName = resourceGroupName; + this.schemaRegistryName = schemaRegistryName; + return this; + } + + public Schema create() { + this.innerObject = serviceManager.serviceClient() + .getSchemas() + .createOrReplaceWithResponse(resourceGroupName, schemaRegistryName, schemaName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public Schema create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSchemas() + .createOrReplaceWithResponse(resourceGroupName, schemaRegistryName, schemaName, this.innerModel(), context) + .getValue(); + return this; + } + + SchemaImpl(String name, com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerObject = new SchemaInner(); + this.serviceManager = serviceManager; + this.schemaName = name; + } + + public Schema refresh() { + this.innerObject = serviceManager.serviceClient() + .getSchemas() + .getWithResponse(resourceGroupName, schemaRegistryName, schemaName, Context.NONE) + .getValue(); + return this; + } + + public Schema refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSchemas() + .getWithResponse(resourceGroupName, schemaRegistryName, schemaName, context) + .getValue(); + return this; + } + + public SchemaImpl withProperties(SchemaProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaRegistriesClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaRegistriesClientImpl.java new file mode 100644 index 0000000000000..761f2767beb51 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaRegistriesClientImpl.java @@ -0,0 +1,1294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.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.deviceregistry.fluent.SchemaRegistriesClient; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaRegistryInner; +import com.azure.resourcemanager.deviceregistry.implementation.models.SchemaRegistryListResult; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryUpdate; +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 SchemaRegistriesClient. + */ +public final class SchemaRegistriesClientImpl implements SchemaRegistriesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SchemaRegistriesService service; + + /** + * The service client containing this operation class. + */ + private final DeviceRegistryManagementClientImpl client; + + /** + * Initializes an instance of SchemaRegistriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SchemaRegistriesClientImpl(DeviceRegistryManagementClientImpl client) { + this.service + = RestProxy.create(SchemaRegistriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DeviceRegistryManagementClientSchemaRegistries to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DeviceRegistryManage") + public interface SchemaRegistriesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("schemaRegistryName") String schemaRegistryName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("schemaRegistryName") String schemaRegistryName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SchemaRegistryInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("schemaRegistryName") String schemaRegistryName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SchemaRegistryUpdate properties, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("schemaRegistryName") String schemaRegistryName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") 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}/providers/Microsoft.DeviceRegistry/schemaRegistries") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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("endpoint") String endpoint, + @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 SchemaRegistry along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String schemaRegistryName) { + 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName 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, schemaRegistryName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 SchemaRegistry along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String schemaRegistryName, 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName 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, schemaRegistryName, accept, context); + } + + /** + * Get a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 SchemaRegistry on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String schemaRegistryName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, schemaRegistryName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 SchemaRegistry along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String schemaRegistryName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, schemaRegistryName, context).block(); + } + + /** + * Get a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 SchemaRegistry. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SchemaRegistryInner getByResourceGroup(String resourceGroupName, String schemaRegistryName) { + return getByResourceGroupWithResponse(resourceGroupName, schemaRegistryName, Context.NONE).getValue(); + } + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, + String schemaRegistryName, SchemaRegistryInner 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schemaRegistryName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, + String schemaRegistryName, SchemaRegistryInner 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schemaRegistryName, contentType, accept, resource, + context); + } + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SchemaRegistryInner> + beginCreateOrReplaceAsync(String resourceGroupName, String schemaRegistryName, SchemaRegistryInner resource) { + Mono>> mono + = createOrReplaceWithResponseAsync(resourceGroupName, schemaRegistryName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + SchemaRegistryInner.class, SchemaRegistryInner.class, this.client.getContext()); + } + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SchemaRegistryInner> beginCreateOrReplaceAsync( + String resourceGroupName, String schemaRegistryName, SchemaRegistryInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrReplaceWithResponseAsync(resourceGroupName, schemaRegistryName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + SchemaRegistryInner.class, SchemaRegistryInner.class, context); + } + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SchemaRegistryInner> + beginCreateOrReplace(String resourceGroupName, String schemaRegistryName, SchemaRegistryInner resource) { + return this.beginCreateOrReplaceAsync(resourceGroupName, schemaRegistryName, resource).getSyncPoller(); + } + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SchemaRegistryInner> beginCreateOrReplace( + String resourceGroupName, String schemaRegistryName, SchemaRegistryInner resource, Context context) { + return this.beginCreateOrReplaceAsync(resourceGroupName, schemaRegistryName, resource, context).getSyncPoller(); + } + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, String schemaRegistryName, + SchemaRegistryInner resource) { + return beginCreateOrReplaceAsync(resourceGroupName, schemaRegistryName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, String schemaRegistryName, + SchemaRegistryInner resource, Context context) { + return beginCreateOrReplaceAsync(resourceGroupName, schemaRegistryName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SchemaRegistryInner createOrReplace(String resourceGroupName, String schemaRegistryName, + SchemaRegistryInner resource) { + return createOrReplaceAsync(resourceGroupName, schemaRegistryName, resource).block(); + } + + /** + * Create a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SchemaRegistryInner createOrReplace(String resourceGroupName, String schemaRegistryName, + SchemaRegistryInner resource, Context context) { + return createOrReplaceAsync(resourceGroupName, schemaRegistryName, resource, context).block(); + } + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String schemaRegistryName, SchemaRegistryUpdate 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schemaRegistryName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String schemaRegistryName, SchemaRegistryUpdate 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, schemaRegistryName, contentType, accept, properties, context); + } + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SchemaRegistryInner> beginUpdateAsync(String resourceGroupName, + String schemaRegistryName, SchemaRegistryUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, schemaRegistryName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + SchemaRegistryInner.class, SchemaRegistryInner.class, this.client.getContext()); + } + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SchemaRegistryInner> beginUpdateAsync(String resourceGroupName, + String schemaRegistryName, SchemaRegistryUpdate properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, schemaRegistryName, properties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + SchemaRegistryInner.class, SchemaRegistryInner.class, context); + } + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SchemaRegistryInner> beginUpdate(String resourceGroupName, + String schemaRegistryName, SchemaRegistryUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, schemaRegistryName, properties).getSyncPoller(); + } + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SchemaRegistryInner> beginUpdate(String resourceGroupName, + String schemaRegistryName, SchemaRegistryUpdate properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, schemaRegistryName, properties, context).getSyncPoller(); + } + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String schemaRegistryName, + SchemaRegistryUpdate properties) { + return beginUpdateAsync(resourceGroupName, schemaRegistryName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String schemaRegistryName, + SchemaRegistryUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, schemaRegistryName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SchemaRegistryInner update(String resourceGroupName, String schemaRegistryName, + SchemaRegistryUpdate properties) { + return updateAsync(resourceGroupName, schemaRegistryName, properties).block(); + } + + /** + * Update a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schema registry definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SchemaRegistryInner update(String resourceGroupName, String schemaRegistryName, + SchemaRegistryUpdate properties, Context context) { + return updateAsync(resourceGroupName, schemaRegistryName, properties, context).block(); + } + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String schemaRegistryName) { + 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName 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, schemaRegistryName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String schemaRegistryName, 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName 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, schemaRegistryName, accept, context); + } + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String schemaRegistryName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, schemaRegistryName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String schemaRegistryName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, schemaRegistryName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String schemaRegistryName) { + return this.beginDeleteAsync(resourceGroupName, schemaRegistryName).getSyncPoller(); + } + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String schemaRegistryName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, schemaRegistryName, context).getSyncPoller(); + } + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String schemaRegistryName) { + return beginDeleteAsync(resourceGroupName, schemaRegistryName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String schemaRegistryName, Context context) { + return beginDeleteAsync(resourceGroupName, schemaRegistryName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String schemaRegistryName) { + deleteAsync(resourceGroupName, schemaRegistryName).block(); + } + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String schemaRegistryName, Context context) { + deleteAsync(resourceGroupName, schemaRegistryName, context).block(); + } + + /** + * List SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List SchemaRegistry 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 SchemaRegistry 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)); + } + + /** + * List SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List SchemaRegistry 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 SchemaRegistry list operation 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SchemaRegistry 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. + * @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 SchemaRegistry 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SchemaRegistry 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. + * @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 SchemaRegistry 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)); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaRegistriesImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaRegistriesImpl.java new file mode 100644 index 0000000000000..b5aa03b8e1a1c --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaRegistriesImpl.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.SchemaRegistriesClient; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaRegistryInner; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistries; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistry; + +public final class SchemaRegistriesImpl implements SchemaRegistries { + private static final ClientLogger LOGGER = new ClientLogger(SchemaRegistriesImpl.class); + + private final SchemaRegistriesClient innerClient; + + private final com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager; + + public SchemaRegistriesImpl(SchemaRegistriesClient innerClient, + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String schemaRegistryName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, schemaRegistryName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SchemaRegistryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SchemaRegistry getByResourceGroup(String resourceGroupName, String schemaRegistryName) { + SchemaRegistryInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, schemaRegistryName); + if (inner != null) { + return new SchemaRegistryImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String schemaRegistryName) { + this.serviceClient().delete(resourceGroupName, schemaRegistryName); + } + + public void delete(String resourceGroupName, String schemaRegistryName, Context context) { + this.serviceClient().delete(resourceGroupName, schemaRegistryName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SchemaRegistryImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SchemaRegistryImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SchemaRegistryImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SchemaRegistryImpl(inner1, this.manager())); + } + + public SchemaRegistry getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(id, "schemaRegistries"); + if (schemaRegistryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaRegistries'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, schemaRegistryName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(id, "schemaRegistries"); + if (schemaRegistryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaRegistries'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, schemaRegistryName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(id, "schemaRegistries"); + if (schemaRegistryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaRegistries'.", id))); + } + this.delete(resourceGroupName, schemaRegistryName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(id, "schemaRegistries"); + if (schemaRegistryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaRegistries'.", id))); + } + this.delete(resourceGroupName, schemaRegistryName, context); + } + + private SchemaRegistriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager() { + return this.serviceManager; + } + + public SchemaRegistryImpl define(String name) { + return new SchemaRegistryImpl(name, this.manager()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaRegistryImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaRegistryImpl.java new file mode 100644 index 0000000000000..91428a0ac6ee5 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaRegistryImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaRegistryInner; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistry; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryProperties; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryUpdate; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryUpdateProperties; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentity; +import java.util.Collections; +import java.util.Map; + +public final class SchemaRegistryImpl implements SchemaRegistry, SchemaRegistry.Definition, SchemaRegistry.Update { + private SchemaRegistryInner innerObject; + + private final com.azure.resourcemanager.deviceregistry.DeviceRegistryManager 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 SchemaRegistryProperties properties() { + return this.innerModel().properties(); + } + + public SystemAssignedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SchemaRegistryInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String schemaRegistryName; + + private SchemaRegistryUpdate updateProperties; + + public SchemaRegistryImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public SchemaRegistry create() { + this.innerObject = serviceManager.serviceClient() + .getSchemaRegistries() + .createOrReplace(resourceGroupName, schemaRegistryName, this.innerModel(), Context.NONE); + return this; + } + + public SchemaRegistry create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSchemaRegistries() + .createOrReplace(resourceGroupName, schemaRegistryName, this.innerModel(), context); + return this; + } + + SchemaRegistryImpl(String name, com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerObject = new SchemaRegistryInner(); + this.serviceManager = serviceManager; + this.schemaRegistryName = name; + } + + public SchemaRegistryImpl update() { + this.updateProperties = new SchemaRegistryUpdate(); + return this; + } + + public SchemaRegistry apply() { + this.innerObject = serviceManager.serviceClient() + .getSchemaRegistries() + .update(resourceGroupName, schemaRegistryName, updateProperties, Context.NONE); + return this; + } + + public SchemaRegistry apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSchemaRegistries() + .update(resourceGroupName, schemaRegistryName, updateProperties, context); + return this; + } + + SchemaRegistryImpl(SchemaRegistryInner innerObject, + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "schemaRegistries"); + } + + public SchemaRegistry refresh() { + this.innerObject = serviceManager.serviceClient() + .getSchemaRegistries() + .getByResourceGroupWithResponse(resourceGroupName, schemaRegistryName, Context.NONE) + .getValue(); + return this; + } + + public SchemaRegistry refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSchemaRegistries() + .getByResourceGroupWithResponse(resourceGroupName, schemaRegistryName, context) + .getValue(); + return this; + } + + public SchemaRegistryImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SchemaRegistryImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SchemaRegistryImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public SchemaRegistryImpl withProperties(SchemaRegistryProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public SchemaRegistryImpl withIdentity(SystemAssignedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + public SchemaRegistryImpl withProperties(SchemaRegistryUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaVersionImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaVersionImpl.java new file mode 100644 index 0000000000000..942a8c00390b4 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaVersionImpl.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaVersionInner; +import com.azure.resourcemanager.deviceregistry.models.SchemaVersion; +import com.azure.resourcemanager.deviceregistry.models.SchemaVersionProperties; + +public final class SchemaVersionImpl implements SchemaVersion, SchemaVersion.Definition { + private SchemaVersionInner innerObject; + + private final com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager; + + SchemaVersionImpl(SchemaVersionInner innerObject, + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager 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 SchemaVersionProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SchemaVersionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String schemaRegistryName; + + private String schemaName; + + private String schemaVersionName; + + public SchemaVersionImpl withExistingSchema(String resourceGroupName, String schemaRegistryName, + String schemaName) { + this.resourceGroupName = resourceGroupName; + this.schemaRegistryName = schemaRegistryName; + this.schemaName = schemaName; + return this; + } + + public SchemaVersion create() { + this.innerObject = serviceManager.serviceClient() + .getSchemaVersions() + .createOrReplaceWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SchemaVersion create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSchemaVersions() + .createOrReplaceWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, + this.innerModel(), context) + .getValue(); + return this; + } + + SchemaVersionImpl(String name, com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerObject = new SchemaVersionInner(); + this.serviceManager = serviceManager; + this.schemaVersionName = name; + } + + public SchemaVersion refresh() { + this.innerObject = serviceManager.serviceClient() + .getSchemaVersions() + .getWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, Context.NONE) + .getValue(); + return this; + } + + public SchemaVersion refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSchemaVersions() + .getWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, context) + .getValue(); + return this; + } + + public SchemaVersionImpl withProperties(SchemaVersionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaVersionsClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaVersionsClientImpl.java new file mode 100644 index 0000000000000..d2adc087fef15 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaVersionsClientImpl.java @@ -0,0 +1,797 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.deviceregistry.fluent.SchemaVersionsClient; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaVersionInner; +import com.azure.resourcemanager.deviceregistry.implementation.models.SchemaVersionListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SchemaVersionsClient. + */ +public final class SchemaVersionsClientImpl implements SchemaVersionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final SchemaVersionsService service; + + /** + * The service client containing this operation class. + */ + private final DeviceRegistryManagementClientImpl client; + + /** + * Initializes an instance of SchemaVersionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SchemaVersionsClientImpl(DeviceRegistryManagementClientImpl client) { + this.service + = RestProxy.create(SchemaVersionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DeviceRegistryManagementClientSchemaVersions to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DeviceRegistryManage") + public interface SchemaVersionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("schemaRegistryName") String schemaRegistryName, @PathParam("schemaName") String schemaName, + @PathParam("schemaVersionName") String schemaVersionName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("schemaRegistryName") String schemaRegistryName, @PathParam("schemaName") String schemaName, + @PathParam("schemaVersionName") String schemaVersionName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SchemaVersionInner resource, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions/{schemaVersionName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("schemaRegistryName") String schemaRegistryName, @PathParam("schemaName") String schemaName, + @PathParam("schemaVersionName") String schemaVersionName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}/schemaVersions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySchema(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("schemaRegistryName") String schemaRegistryName, @PathParam("schemaName") String schemaName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySchemaNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name 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 SchemaVersion along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String schemaRegistryName, + String schemaName, String schemaVersionName) { + 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (schemaVersionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaVersionName 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, schemaRegistryName, schemaName, schemaVersionName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name 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 SchemaVersion along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String schemaRegistryName, + String schemaName, String schemaVersionName, 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (schemaVersionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaVersionName 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, schemaRegistryName, schemaName, schemaVersionName, accept, context); + } + + /** + * Get a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name 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 SchemaVersion on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName) { + return getWithResponseAsync(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name 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 SchemaVersion along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String schemaRegistryName, + String schemaName, String schemaVersionName, Context context) { + return getWithResponseAsync(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, context) + .block(); + } + + /** + * Get a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name 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 SchemaVersion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SchemaVersionInner get(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName) { + return getWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, Context.NONE) + .getValue(); + } + + /** + * Create a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @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 schema version's definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrReplaceWithResponseAsync(String resourceGroupName, + String schemaRegistryName, String schemaName, String schemaVersionName, SchemaVersionInner 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (schemaVersionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaVersionName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @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 schema version's definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrReplaceWithResponseAsync(String resourceGroupName, + String schemaRegistryName, String schemaName, String schemaVersionName, SchemaVersionInner 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (schemaVersionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaVersionName 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, + contentType, accept, resource, context); + } + + /** + * Create a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @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 schema version's definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, String schemaRegistryName, + String schemaName, String schemaVersionName, SchemaVersionInner resource) { + return createOrReplaceWithResponseAsync(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, + resource).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @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 schema version's definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrReplaceWithResponse(String resourceGroupName, String schemaRegistryName, + String schemaName, String schemaVersionName, SchemaVersionInner resource, Context context) { + return createOrReplaceWithResponseAsync(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, + resource, context).block(); + } + + /** + * Create a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @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 schema version's definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SchemaVersionInner createOrReplace(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName, SchemaVersionInner resource) { + return createOrReplaceWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, + resource, Context.NONE).getValue(); + } + + /** + * Delete a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String schemaRegistryName, + String schemaName, String schemaVersionName) { + 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (schemaVersionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaVersionName 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, schemaRegistryName, schemaName, schemaVersionName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String schemaRegistryName, + String schemaName, String schemaVersionName, 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (schemaVersionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaVersionName 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, schemaRegistryName, schemaName, schemaVersionName, accept, context); + } + + /** + * Delete a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName) { + return deleteWithResponseAsync(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name 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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName, Context context) { + return deleteWithResponseAsync(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, context) + .block(); + } + + /** + * Delete a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName) { + deleteWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, Context.NONE); + } + + /** + * List SchemaVersion resources by Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 SchemaVersion list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaSinglePageAsync(String resourceGroupName, + String schemaRegistryName, String schemaName) { + 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySchema(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schemaRegistryName, schemaName, 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 SchemaVersion resources by Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 SchemaVersion list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaSinglePageAsync(String resourceGroupName, + String schemaRegistryName, String schemaName, 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySchema(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, schemaRegistryName, schemaName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List SchemaVersion resources by Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 SchemaVersion list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync(String resourceGroupName, String schemaRegistryName, + String schemaName) { + return new PagedFlux<>(() -> listBySchemaSinglePageAsync(resourceGroupName, schemaRegistryName, schemaName), + nextLink -> listBySchemaNextSinglePageAsync(nextLink)); + } + + /** + * List SchemaVersion resources by Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 SchemaVersion list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync(String resourceGroupName, String schemaRegistryName, + String schemaName, Context context) { + return new PagedFlux<>( + () -> listBySchemaSinglePageAsync(resourceGroupName, schemaRegistryName, schemaName, context), + nextLink -> listBySchemaNextSinglePageAsync(nextLink, context)); + } + + /** + * List SchemaVersion resources by Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 SchemaVersion list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySchema(String resourceGroupName, String schemaRegistryName, + String schemaName) { + return new PagedIterable<>(listBySchemaAsync(resourceGroupName, schemaRegistryName, schemaName)); + } + + /** + * List SchemaVersion resources by Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 SchemaVersion list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySchema(String resourceGroupName, String schemaRegistryName, + String schemaName, Context context) { + return new PagedIterable<>(listBySchemaAsync(resourceGroupName, schemaRegistryName, schemaName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a SchemaVersion list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaNextSinglePageAsync(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.listBySchemaNext(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. + * @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 SchemaVersion list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaNextSinglePageAsync(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.listBySchemaNext(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/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaVersionsImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaVersionsImpl.java new file mode 100644 index 0000000000000..cd010688dbf63 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemaVersionsImpl.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.SchemaVersionsClient; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaVersionInner; +import com.azure.resourcemanager.deviceregistry.models.SchemaVersion; +import com.azure.resourcemanager.deviceregistry.models.SchemaVersions; + +public final class SchemaVersionsImpl implements SchemaVersions { + private static final ClientLogger LOGGER = new ClientLogger(SchemaVersionsImpl.class); + + private final SchemaVersionsClient innerClient; + + private final com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager; + + public SchemaVersionsImpl(SchemaVersionsClient innerClient, + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String schemaRegistryName, + String schemaName, String schemaVersionName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SchemaVersionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SchemaVersion get(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName) { + SchemaVersionInner inner + = this.serviceClient().get(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName); + if (inner != null) { + return new SchemaVersionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, context); + } + + public void delete(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName) { + this.serviceClient().delete(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName); + } + + public PagedIterable listBySchema(String resourceGroupName, String schemaRegistryName, + String schemaName) { + PagedIterable inner + = this.serviceClient().listBySchema(resourceGroupName, schemaRegistryName, schemaName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SchemaVersionImpl(inner1, this.manager())); + } + + public PagedIterable listBySchema(String resourceGroupName, String schemaRegistryName, + String schemaName, Context context) { + PagedIterable inner + = this.serviceClient().listBySchema(resourceGroupName, schemaRegistryName, schemaName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SchemaVersionImpl(inner1, this.manager())); + } + + public SchemaVersion getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(id, "schemaRegistries"); + if (schemaRegistryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaRegistries'.", id))); + } + String schemaName = ResourceManagerUtils.getValueFromIdByName(id, "schemas"); + if (schemaName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemas'.", id))); + } + String schemaVersionName = ResourceManagerUtils.getValueFromIdByName(id, "schemaVersions"); + if (schemaVersionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaVersions'.", id))); + } + return this.getWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(id, "schemaRegistries"); + if (schemaRegistryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaRegistries'.", id))); + } + String schemaName = ResourceManagerUtils.getValueFromIdByName(id, "schemas"); + if (schemaName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemas'.", id))); + } + String schemaVersionName = ResourceManagerUtils.getValueFromIdByName(id, "schemaVersions"); + if (schemaVersionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaVersions'.", id))); + } + return this.getWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(id, "schemaRegistries"); + if (schemaRegistryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaRegistries'.", id))); + } + String schemaName = ResourceManagerUtils.getValueFromIdByName(id, "schemas"); + if (schemaName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemas'.", id))); + } + String schemaVersionName = ResourceManagerUtils.getValueFromIdByName(id, "schemaVersions"); + if (schemaVersionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaVersions'.", id))); + } + this.deleteWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(id, "schemaRegistries"); + if (schemaRegistryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaRegistries'.", id))); + } + String schemaName = ResourceManagerUtils.getValueFromIdByName(id, "schemas"); + if (schemaName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemas'.", id))); + } + String schemaVersionName = ResourceManagerUtils.getValueFromIdByName(id, "schemaVersions"); + if (schemaVersionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaVersions'.", id))); + } + return this.deleteWithResponse(resourceGroupName, schemaRegistryName, schemaName, schemaVersionName, context); + } + + private SchemaVersionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager() { + return this.serviceManager; + } + + public SchemaVersionImpl define(String name) { + return new SchemaVersionImpl(name, this.manager()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemasClientImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemasClientImpl.java new file mode 100644 index 0000000000000..d678c0266990a --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemasClientImpl.java @@ -0,0 +1,731 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.deviceregistry.fluent.SchemasClient; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaInner; +import com.azure.resourcemanager.deviceregistry.implementation.models.SchemaListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SchemasClient. + */ +public final class SchemasClientImpl implements SchemasClient { + /** + * The proxy service used to perform REST calls. + */ + private final SchemasService service; + + /** + * The service client containing this operation class. + */ + private final DeviceRegistryManagementClientImpl client; + + /** + * Initializes an instance of SchemasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SchemasClientImpl(DeviceRegistryManagementClientImpl client) { + this.service = RestProxy.create(SchemasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DeviceRegistryManagementClientSchemas to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DeviceRegistryManage") + public interface SchemasService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("schemaRegistryName") String schemaRegistryName, @PathParam("schemaName") String schemaName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("schemaRegistryName") String schemaRegistryName, @PathParam("schemaName") String schemaName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SchemaInner resource, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas/{schemaName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("schemaRegistryName") String schemaRegistryName, @PathParam("schemaName") String schemaName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/schemaRegistries/{schemaRegistryName}/schemas") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySchemaRegistry(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("schemaRegistryName") String schemaRegistryName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySchemaRegistryNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 Schema along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String schemaRegistryName, + String schemaName) { + 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName 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, schemaRegistryName, schemaName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 Schema along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String schemaRegistryName, + String schemaName, 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName 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, schemaRegistryName, schemaName, accept, context); + } + + /** + * Get a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 Schema on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String schemaRegistryName, String schemaName) { + return getWithResponseAsync(resourceGroupName, schemaRegistryName, schemaName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 Schema along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + Context context) { + return getWithResponseAsync(resourceGroupName, schemaRegistryName, schemaName, context).block(); + } + + /** + * Get a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 Schema. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SchemaInner get(String resourceGroupName, String schemaRegistryName, String schemaName) { + return getWithResponse(resourceGroupName, schemaRegistryName, schemaName, Context.NONE).getValue(); + } + + /** + * Create a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 schema definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrReplaceWithResponseAsync(String resourceGroupName, + String schemaRegistryName, String schemaName, SchemaInner 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schemaRegistryName, schemaName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 schema definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrReplaceWithResponseAsync(String resourceGroupName, + String schemaRegistryName, String schemaName, SchemaInner 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName 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 contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schemaRegistryName, schemaName, contentType, accept, + resource, context); + } + + /** + * Create a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 schema definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, String schemaRegistryName, + String schemaName, SchemaInner resource) { + return createOrReplaceWithResponseAsync(resourceGroupName, schemaRegistryName, schemaName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 schema definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrReplaceWithResponse(String resourceGroupName, String schemaRegistryName, + String schemaName, SchemaInner resource, Context context) { + return createOrReplaceWithResponseAsync(resourceGroupName, schemaRegistryName, schemaName, resource, context) + .block(); + } + + /** + * Create a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 schema definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SchemaInner createOrReplace(String resourceGroupName, String schemaRegistryName, String schemaName, + SchemaInner resource) { + return createOrReplaceWithResponse(resourceGroupName, schemaRegistryName, schemaName, resource, Context.NONE) + .getValue(); + } + + /** + * Delete a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String schemaRegistryName, + String schemaName) { + 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName 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, schemaRegistryName, schemaName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String schemaRegistryName, + String schemaName, 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName 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, schemaRegistryName, schemaName, accept, context); + } + + /** + * Delete a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String schemaRegistryName, String schemaName) { + return deleteWithResponseAsync(resourceGroupName, schemaRegistryName, schemaName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, schemaRegistryName, schemaName, context).block(); + } + + /** + * Delete a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String schemaRegistryName, String schemaName) { + deleteWithResponse(resourceGroupName, schemaRegistryName, schemaName, Context.NONE); + } + + /** + * List Schema resources by SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 Schema list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaRegistrySinglePageAsync(String resourceGroupName, + String schemaRegistryName) { + 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySchemaRegistry(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schemaRegistryName, 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 Schema resources by SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 Schema list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaRegistrySinglePageAsync(String resourceGroupName, + String schemaRegistryName, 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 (schemaRegistryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter schemaRegistryName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySchemaRegistry(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schemaRegistryName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List Schema resources by SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 Schema list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaRegistryAsync(String resourceGroupName, String schemaRegistryName) { + return new PagedFlux<>(() -> listBySchemaRegistrySinglePageAsync(resourceGroupName, schemaRegistryName), + nextLink -> listBySchemaRegistryNextSinglePageAsync(nextLink)); + } + + /** + * List Schema resources by SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 Schema list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaRegistryAsync(String resourceGroupName, String schemaRegistryName, + Context context) { + return new PagedFlux<>( + () -> listBySchemaRegistrySinglePageAsync(resourceGroupName, schemaRegistryName, context), + nextLink -> listBySchemaRegistryNextSinglePageAsync(nextLink, context)); + } + + /** + * List Schema resources by SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 Schema list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySchemaRegistry(String resourceGroupName, String schemaRegistryName) { + return new PagedIterable<>(listBySchemaRegistryAsync(resourceGroupName, schemaRegistryName)); + } + + /** + * List Schema resources by SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name 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 Schema list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySchemaRegistry(String resourceGroupName, String schemaRegistryName, + Context context) { + return new PagedIterable<>(listBySchemaRegistryAsync(resourceGroupName, schemaRegistryName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Schema list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaRegistryNextSinglePageAsync(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.listBySchemaRegistryNext(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. + * @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 Schema list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaRegistryNextSinglePageAsync(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.listBySchemaRegistryNext(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/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemasImpl.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemasImpl.java new file mode 100644 index 0000000000000..1ab0e703460ff --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/SchemasImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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.deviceregistry.fluent.SchemasClient; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaInner; +import com.azure.resourcemanager.deviceregistry.models.Schema; +import com.azure.resourcemanager.deviceregistry.models.Schemas; + +public final class SchemasImpl implements Schemas { + private static final ClientLogger LOGGER = new ClientLogger(SchemasImpl.class); + + private final SchemasClient innerClient; + + private final com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager; + + public SchemasImpl(SchemasClient innerClient, + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, schemaRegistryName, schemaName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SchemaImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Schema get(String resourceGroupName, String schemaRegistryName, String schemaName) { + SchemaInner inner = this.serviceClient().get(resourceGroupName, schemaRegistryName, schemaName); + if (inner != null) { + return new SchemaImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, schemaRegistryName, schemaName, context); + } + + public void delete(String resourceGroupName, String schemaRegistryName, String schemaName) { + this.serviceClient().delete(resourceGroupName, schemaRegistryName, schemaName); + } + + public PagedIterable listBySchemaRegistry(String resourceGroupName, String schemaRegistryName) { + PagedIterable inner + = this.serviceClient().listBySchemaRegistry(resourceGroupName, schemaRegistryName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SchemaImpl(inner1, this.manager())); + } + + public PagedIterable listBySchemaRegistry(String resourceGroupName, String schemaRegistryName, + Context context) { + PagedIterable inner + = this.serviceClient().listBySchemaRegistry(resourceGroupName, schemaRegistryName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SchemaImpl(inner1, this.manager())); + } + + public Schema getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(id, "schemaRegistries"); + if (schemaRegistryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaRegistries'.", id))); + } + String schemaName = ResourceManagerUtils.getValueFromIdByName(id, "schemas"); + if (schemaName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemas'.", id))); + } + return this.getWithResponse(resourceGroupName, schemaRegistryName, schemaName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(id, "schemaRegistries"); + if (schemaRegistryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaRegistries'.", id))); + } + String schemaName = ResourceManagerUtils.getValueFromIdByName(id, "schemas"); + if (schemaName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemas'.", id))); + } + return this.getWithResponse(resourceGroupName, schemaRegistryName, schemaName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(id, "schemaRegistries"); + if (schemaRegistryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaRegistries'.", id))); + } + String schemaName = ResourceManagerUtils.getValueFromIdByName(id, "schemas"); + if (schemaName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemas'.", id))); + } + this.deleteWithResponse(resourceGroupName, schemaRegistryName, schemaName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String schemaRegistryName = ResourceManagerUtils.getValueFromIdByName(id, "schemaRegistries"); + if (schemaRegistryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemaRegistries'.", id))); + } + String schemaName = ResourceManagerUtils.getValueFromIdByName(id, "schemas"); + if (schemaName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemas'.", id))); + } + return this.deleteWithResponse(resourceGroupName, schemaRegistryName, schemaName, context); + } + + private SchemasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager() { + return this.serviceManager; + } + + public SchemaImpl define(String name) { + return new SchemaImpl(name, this.manager()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/BillingContainerListResult.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/BillingContainerListResult.java new file mode 100644 index 0000000000000..ae74340479fde --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/BillingContainerListResult.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.fluent.models.BillingContainerInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a BillingContainer list operation. + */ +@Immutable +public final class BillingContainerListResult implements JsonSerializable { + /* + * The BillingContainer items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of BillingContainerListResult class. + */ + private BillingContainerListResult() { + } + + /** + * Get the value property: The BillingContainer items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model BillingContainerListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BillingContainerListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BillingContainerListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BillingContainerListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BillingContainerListResult. + */ + public static BillingContainerListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BillingContainerListResult deserializedBillingContainerListResult = new BillingContainerListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> BillingContainerInner.fromJson(reader1)); + deserializedBillingContainerListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedBillingContainerListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBillingContainerListResult; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/DiscoveredAssetEndpointProfileListResult.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/DiscoveredAssetEndpointProfileListResult.java new file mode 100644 index 0000000000000..ab54f80a63f3e --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/DiscoveredAssetEndpointProfileListResult.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetEndpointProfileInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a DiscoveredAssetEndpointProfile list operation. + */ +@Immutable +public final class DiscoveredAssetEndpointProfileListResult + implements JsonSerializable { + /* + * The DiscoveredAssetEndpointProfile items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of DiscoveredAssetEndpointProfileListResult class. + */ + private DiscoveredAssetEndpointProfileListResult() { + } + + /** + * Get the value property: The DiscoveredAssetEndpointProfile items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model DiscoveredAssetEndpointProfileListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoveredAssetEndpointProfileListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredAssetEndpointProfileListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredAssetEndpointProfileListResult if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscoveredAssetEndpointProfileListResult. + */ + public static DiscoveredAssetEndpointProfileListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredAssetEndpointProfileListResult deserializedDiscoveredAssetEndpointProfileListResult + = new DiscoveredAssetEndpointProfileListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DiscoveredAssetEndpointProfileInner.fromJson(reader1)); + deserializedDiscoveredAssetEndpointProfileListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredAssetEndpointProfileListResult; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/DiscoveredAssetListResult.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/DiscoveredAssetListResult.java new file mode 100644 index 0000000000000..bb97da2021d31 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/DiscoveredAssetListResult.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a DiscoveredAsset list operation. + */ +@Immutable +public final class DiscoveredAssetListResult implements JsonSerializable { + /* + * The DiscoveredAsset items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of DiscoveredAssetListResult class. + */ + private DiscoveredAssetListResult() { + } + + /** + * Get the value property: The DiscoveredAsset items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property value in model DiscoveredAssetListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoveredAssetListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredAssetListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredAssetListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscoveredAssetListResult. + */ + public static DiscoveredAssetListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredAssetListResult deserializedDiscoveredAssetListResult = new DiscoveredAssetListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DiscoveredAssetInner.fromJson(reader1)); + deserializedDiscoveredAssetListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDiscoveredAssetListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredAssetListResult; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/SchemaListResult.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/SchemaListResult.java new file mode 100644 index 0000000000000..a32b045693cfb --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/SchemaListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Schema list operation. + */ +@Immutable +public final class SchemaListResult implements JsonSerializable { + /* + * The Schema items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of SchemaListResult class. + */ + private SchemaListResult() { + } + + /** + * Get the value property: The Schema items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model SchemaListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SchemaListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SchemaListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SchemaListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SchemaListResult. + */ + public static SchemaListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SchemaListResult deserializedSchemaListResult = new SchemaListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> SchemaInner.fromJson(reader1)); + deserializedSchemaListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSchemaListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSchemaListResult; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/SchemaRegistryListResult.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/SchemaRegistryListResult.java new file mode 100644 index 0000000000000..550f36d7844aa --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/SchemaRegistryListResult.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaRegistryInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a SchemaRegistry list operation. + */ +@Immutable +public final class SchemaRegistryListResult implements JsonSerializable { + /* + * The SchemaRegistry items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of SchemaRegistryListResult class. + */ + private SchemaRegistryListResult() { + } + + /** + * Get the value property: The SchemaRegistry items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model SchemaRegistryListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SchemaRegistryListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SchemaRegistryListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SchemaRegistryListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SchemaRegistryListResult. + */ + public static SchemaRegistryListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SchemaRegistryListResult deserializedSchemaRegistryListResult = new SchemaRegistryListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> SchemaRegistryInner.fromJson(reader1)); + deserializedSchemaRegistryListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSchemaRegistryListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSchemaRegistryListResult; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/SchemaVersionListResult.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/SchemaVersionListResult.java new file mode 100644 index 0000000000000..f90715495873e --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/implementation/models/SchemaVersionListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaVersionInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a SchemaVersion list operation. + */ +@Immutable +public final class SchemaVersionListResult implements JsonSerializable { + /* + * The SchemaVersion items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of SchemaVersionListResult class. + */ + private SchemaVersionListResult() { + } + + /** + * Get the value property: The SchemaVersion items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model SchemaVersionListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SchemaVersionListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SchemaVersionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SchemaVersionListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SchemaVersionListResult. + */ + public static SchemaVersionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SchemaVersionListResult deserializedSchemaVersionListResult = new SchemaVersionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> SchemaVersionInner.fromJson(reader1)); + deserializedSchemaVersionListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSchemaVersionListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSchemaVersionListResult; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileProperties.java index 0900b967a5617..fb5d8081270c8 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileProperties.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileProperties.java @@ -30,20 +30,32 @@ public final class AssetEndpointProfileProperties implements JsonSerializable { + /* + * Array object to transfer and persist errors that originate from the Edge. + */ + private List errors; + + /** + * Creates an instance of AssetEndpointProfileStatus class. + */ + private AssetEndpointProfileStatus() { + } + + /** + * Get the errors property: Array object to transfer and persist errors that originate from the Edge. + * + * @return the errors value. + */ + public List errors() { + return this.errors; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errors() != null) { + errors().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssetEndpointProfileStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssetEndpointProfileStatus if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AssetEndpointProfileStatus. + */ + public static AssetEndpointProfileStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssetEndpointProfileStatus deserializedAssetEndpointProfileStatus = new AssetEndpointProfileStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errors".equals(fieldName)) { + List errors + = reader.readArray(reader1 -> AssetEndpointProfileStatusError.fromJson(reader1)); + deserializedAssetEndpointProfileStatus.errors = errors; + } else { + reader.skipChildren(); + } + } + + return deserializedAssetEndpointProfileStatus; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileStatusError.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileStatusError.java new file mode 100644 index 0000000000000..f703992185408 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileStatusError.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines the asset endpoint profile status error properties. + */ +@Immutable +public final class AssetEndpointProfileStatusError implements JsonSerializable { + /* + * Error code for classification of errors (ex: 400, 404, 500, etc.). + */ + private Integer code; + + /* + * Human readable helpful error message to provide additional context for error (ex: “targetAddress 'foo' is not a + * valid url”). + */ + private String message; + + /** + * Creates an instance of AssetEndpointProfileStatusError class. + */ + private AssetEndpointProfileStatusError() { + } + + /** + * Get the code property: Error code for classification of errors (ex: 400, 404, 500, etc.). + * + * @return the code value. + */ + public Integer code() { + return this.code; + } + + /** + * Get the message property: Human readable helpful error message to provide additional context for error (ex: + * “targetAddress 'foo' is not a valid url”). + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssetEndpointProfileStatusError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssetEndpointProfileStatusError if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AssetEndpointProfileStatusError. + */ + public static AssetEndpointProfileStatusError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssetEndpointProfileStatusError deserializedAssetEndpointProfileStatusError + = new AssetEndpointProfileStatusError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedAssetEndpointProfileStatusError.code = reader.getNullable(JsonReader::getInt); + } else if ("message".equals(fieldName)) { + deserializedAssetEndpointProfileStatusError.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssetEndpointProfileStatusError; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileUpdateProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileUpdateProperties.java index 9655b4270d813..f4bfc3ab37af2 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileUpdateProperties.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetEndpointProfileUpdateProperties.java @@ -25,17 +25,17 @@ public final class AssetEndpointProfileUpdateProperties private String targetAddress; /* - * Defines the client authentication mechanism to the server. + * Defines the configuration for the connector type that is being used with the endpoint profile. */ - private UserAuthentication userAuthentication; + private String endpointProfileType; /* - * Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device. + * Defines the client authentication mechanism to the server. */ - private TransportAuthentication transportAuthentication; + private Authentication authentication; /* - * Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + * Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). */ private String additionalConfiguration; @@ -70,51 +70,50 @@ public AssetEndpointProfileUpdateProperties withTargetAddress(String targetAddre } /** - * Get the userAuthentication property: Defines the client authentication mechanism to the server. + * Get the endpointProfileType property: Defines the configuration for the connector type that is being used with + * the endpoint profile. * - * @return the userAuthentication value. + * @return the endpointProfileType value. */ - public UserAuthentication userAuthentication() { - return this.userAuthentication; + public String endpointProfileType() { + return this.endpointProfileType; } /** - * Set the userAuthentication property: Defines the client authentication mechanism to the server. + * Set the endpointProfileType property: Defines the configuration for the connector type that is being used with + * the endpoint profile. * - * @param userAuthentication the userAuthentication value to set. + * @param endpointProfileType the endpointProfileType value to set. * @return the AssetEndpointProfileUpdateProperties object itself. */ - public AssetEndpointProfileUpdateProperties withUserAuthentication(UserAuthentication userAuthentication) { - this.userAuthentication = userAuthentication; + public AssetEndpointProfileUpdateProperties withEndpointProfileType(String endpointProfileType) { + this.endpointProfileType = endpointProfileType; return this; } /** - * Get the transportAuthentication property: Defines the authentication mechanism for the southbound connector - * connecting to the shop floor/OT device. + * Get the authentication property: Defines the client authentication mechanism to the server. * - * @return the transportAuthentication value. + * @return the authentication value. */ - public TransportAuthentication transportAuthentication() { - return this.transportAuthentication; + public Authentication authentication() { + return this.authentication; } /** - * Set the transportAuthentication property: Defines the authentication mechanism for the southbound connector - * connecting to the shop floor/OT device. + * Set the authentication property: Defines the client authentication mechanism to the server. * - * @param transportAuthentication the transportAuthentication value to set. + * @param authentication the authentication value to set. * @return the AssetEndpointProfileUpdateProperties object itself. */ - public AssetEndpointProfileUpdateProperties - withTransportAuthentication(TransportAuthentication transportAuthentication) { - this.transportAuthentication = transportAuthentication; + public AssetEndpointProfileUpdateProperties withAuthentication(Authentication authentication) { + this.authentication = authentication; return this; } /** - * Get the additionalConfiguration property: Contains connectivity type specific further configuration (e.g. OPC UA, - * Modbus, ONVIF). + * Get the additionalConfiguration property: Stringified JSON that contains connectivity type specific further + * configuration (e.g. OPC UA, Modbus, ONVIF). * * @return the additionalConfiguration value. */ @@ -123,8 +122,8 @@ public String additionalConfiguration() { } /** - * Set the additionalConfiguration property: Contains connectivity type specific further configuration (e.g. OPC UA, - * Modbus, ONVIF). + * Set the additionalConfiguration property: Stringified JSON that contains connectivity type specific further + * configuration (e.g. OPC UA, Modbus, ONVIF). * * @param additionalConfiguration the additionalConfiguration value to set. * @return the AssetEndpointProfileUpdateProperties object itself. @@ -140,11 +139,8 @@ public AssetEndpointProfileUpdateProperties withAdditionalConfiguration(String a * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (userAuthentication() != null) { - userAuthentication().validate(); - } - if (transportAuthentication() != null) { - transportAuthentication().validate(); + if (authentication() != null) { + authentication().validate(); } } @@ -155,8 +151,8 @@ public void validate() { public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("targetAddress", this.targetAddress); - jsonWriter.writeJsonField("userAuthentication", this.userAuthentication); - jsonWriter.writeJsonField("transportAuthentication", this.transportAuthentication); + jsonWriter.writeStringField("endpointProfileType", this.endpointProfileType); + jsonWriter.writeJsonField("authentication", this.authentication); jsonWriter.writeStringField("additionalConfiguration", this.additionalConfiguration); return jsonWriter.writeEndObject(); } @@ -179,12 +175,10 @@ public static AssetEndpointProfileUpdateProperties fromJson(JsonReader jsonReade if ("targetAddress".equals(fieldName)) { deserializedAssetEndpointProfileUpdateProperties.targetAddress = reader.getString(); - } else if ("userAuthentication".equals(fieldName)) { - deserializedAssetEndpointProfileUpdateProperties.userAuthentication - = UserAuthentication.fromJson(reader); - } else if ("transportAuthentication".equals(fieldName)) { - deserializedAssetEndpointProfileUpdateProperties.transportAuthentication - = TransportAuthentication.fromJson(reader); + } else if ("endpointProfileType".equals(fieldName)) { + deserializedAssetEndpointProfileUpdateProperties.endpointProfileType = reader.getString(); + } else if ("authentication".equals(fieldName)) { + deserializedAssetEndpointProfileUpdateProperties.authentication = Authentication.fromJson(reader); } else if ("additionalConfiguration".equals(fieldName)) { deserializedAssetEndpointProfileUpdateProperties.additionalConfiguration = reader.getString(); } else { diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetProperties.java index 1272695fdcff5..60a07ab0a53db 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetProperties.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetProperties.java @@ -25,11 +25,6 @@ public final class AssetProperties implements JsonSerializable */ private String uuid; - /* - * Resource path to asset type (model) definition. - */ - private String assetType; - /* * Enabled/Disabled status of the asset. */ @@ -52,14 +47,14 @@ public final class AssetProperties implements JsonSerializable /* * A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that - * provides data points for this asset. Must have the format /. + * provides data points for this asset. Must provide asset endpoint profile name. */ - private String assetEndpointProfileUri; + private String assetEndpointProfileRef; /* * An integer that is incremented each time the resource is modified. */ - private Integer version; + private Long version; /* * Asset manufacturer name. @@ -107,26 +102,35 @@ public final class AssetProperties implements JsonSerializable private Map attributes; /* - * Protocol-specific default configuration for all data points. Each data point can have its own configuration that - * overrides the default settings here. This assumes that each asset instance has one protocol. + * Reference to a list of discovered assets. Populated only if the asset has been created from discovery flow. + * Discovered asset names must be provided. + */ + private List discoveredAssetRefs; + + /* + * Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have + * its own configuration that overrides the default settings here. */ - private String defaultDataPointsConfiguration; + private String defaultDatasetsConfiguration; /* - * Protocol-specific default configuration for all events. Each event can have its own configuration that overrides - * the default settings here. This assumes that each asset instance has one protocol. + * Stringified JSON that contains connector-specific default configuration for all events. Each event can have its + * own configuration that overrides the default settings here. */ private String defaultEventsConfiguration; /* - * Array of data points that are part of the asset. Each data point can reference an asset type capability and have - * per-data point configuration. See below for more details for the definition of the dataPoints element. + * Object that describes the default topic information for the asset. */ - private List dataPoints; + private Topic defaultTopic; /* - * Array of events that are part of the asset. Each event can reference an asset type capability and have per-event - * configuration. See below for more details about the definition of the events element. + * Array of datasets that are part of the asset. Each dataset describes the data points that make up the set. + */ + private List datasets; + + /* + * Array of events that are part of the asset. Each event can have per-event configuration. */ private List events; @@ -156,26 +160,6 @@ public String uuid() { return this.uuid; } - /** - * Get the assetType property: Resource path to asset type (model) definition. - * - * @return the assetType value. - */ - public String assetType() { - return this.assetType; - } - - /** - * Set the assetType property: Resource path to asset type (model) definition. - * - * @param assetType the assetType value to set. - * @return the AssetProperties object itself. - */ - public AssetProperties withAssetType(String assetType) { - this.assetType = assetType; - return this; - } - /** * Get the enabled property: Enabled/Disabled status of the asset. * @@ -257,26 +241,26 @@ public AssetProperties withDescription(String description) { } /** - * Get the assetEndpointProfileUri property: A reference to the asset endpoint profile (connection information) used - * by brokers to connect to an endpoint that provides data points for this asset. Must have the format - * <ModuleCR.metadata.namespace>/<ModuleCR.metadata.name>. + * Get the assetEndpointProfileRef property: A reference to the asset endpoint profile (connection information) used + * by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint + * profile name. * - * @return the assetEndpointProfileUri value. + * @return the assetEndpointProfileRef value. */ - public String assetEndpointProfileUri() { - return this.assetEndpointProfileUri; + public String assetEndpointProfileRef() { + return this.assetEndpointProfileRef; } /** - * Set the assetEndpointProfileUri property: A reference to the asset endpoint profile (connection information) used - * by brokers to connect to an endpoint that provides data points for this asset. Must have the format - * <ModuleCR.metadata.namespace>/<ModuleCR.metadata.name>. + * Set the assetEndpointProfileRef property: A reference to the asset endpoint profile (connection information) used + * by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint + * profile name. * - * @param assetEndpointProfileUri the assetEndpointProfileUri value to set. + * @param assetEndpointProfileRef the assetEndpointProfileRef value to set. * @return the AssetProperties object itself. */ - public AssetProperties withAssetEndpointProfileUri(String assetEndpointProfileUri) { - this.assetEndpointProfileUri = assetEndpointProfileUri; + public AssetProperties withAssetEndpointProfileRef(String assetEndpointProfileRef) { + this.assetEndpointProfileRef = assetEndpointProfileRef; return this; } @@ -285,7 +269,7 @@ public AssetProperties withAssetEndpointProfileUri(String assetEndpointProfileUr * * @return the version value. */ - public Integer version() { + public Long version() { return this.version; } @@ -470,33 +454,54 @@ public AssetProperties withAttributes(Map attributes) { } /** - * Get the defaultDataPointsConfiguration property: Protocol-specific default configuration for all data points. - * Each data point can have its own configuration that overrides the default settings here. This assumes that each - * asset instance has one protocol. + * Get the discoveredAssetRefs property: Reference to a list of discovered assets. Populated only if the asset has + * been created from discovery flow. Discovered asset names must be provided. + * + * @return the discoveredAssetRefs value. + */ + public List discoveredAssetRefs() { + return this.discoveredAssetRefs; + } + + /** + * Set the discoveredAssetRefs property: Reference to a list of discovered assets. Populated only if the asset has + * been created from discovery flow. Discovered asset names must be provided. + * + * @param discoveredAssetRefs the discoveredAssetRefs value to set. + * @return the AssetProperties object itself. + */ + public AssetProperties withDiscoveredAssetRefs(List discoveredAssetRefs) { + this.discoveredAssetRefs = discoveredAssetRefs; + return this; + } + + /** + * Get the defaultDatasetsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all datasets. Each dataset can have its own configuration that overrides the default settings + * here. * - * @return the defaultDataPointsConfiguration value. + * @return the defaultDatasetsConfiguration value. */ - public String defaultDataPointsConfiguration() { - return this.defaultDataPointsConfiguration; + public String defaultDatasetsConfiguration() { + return this.defaultDatasetsConfiguration; } /** - * Set the defaultDataPointsConfiguration property: Protocol-specific default configuration for all data points. - * Each data point can have its own configuration that overrides the default settings here. This assumes that each - * asset instance has one protocol. + * Set the defaultDatasetsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all datasets. Each dataset can have its own configuration that overrides the default settings + * here. * - * @param defaultDataPointsConfiguration the defaultDataPointsConfiguration value to set. + * @param defaultDatasetsConfiguration the defaultDatasetsConfiguration value to set. * @return the AssetProperties object itself. */ - public AssetProperties withDefaultDataPointsConfiguration(String defaultDataPointsConfiguration) { - this.defaultDataPointsConfiguration = defaultDataPointsConfiguration; + public AssetProperties withDefaultDatasetsConfiguration(String defaultDatasetsConfiguration) { + this.defaultDatasetsConfiguration = defaultDatasetsConfiguration; return this; } /** - * Get the defaultEventsConfiguration property: Protocol-specific default configuration for all events. Each event - * can have its own configuration that overrides the default settings here. This assumes that each asset instance - * has one protocol. + * Get the defaultEventsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all events. Each event can have its own configuration that overrides the default settings here. * * @return the defaultEventsConfiguration value. */ @@ -505,9 +510,8 @@ public String defaultEventsConfiguration() { } /** - * Set the defaultEventsConfiguration property: Protocol-specific default configuration for all events. Each event - * can have its own configuration that overrides the default settings here. This assumes that each asset instance - * has one protocol. + * Set the defaultEventsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all events. Each event can have its own configuration that overrides the default settings here. * * @param defaultEventsConfiguration the defaultEventsConfiguration value to set. * @return the AssetProperties object itself. @@ -518,33 +522,49 @@ public AssetProperties withDefaultEventsConfiguration(String defaultEventsConfig } /** - * Get the dataPoints property: Array of data points that are part of the asset. Each data point can reference an - * asset type capability and have per-data point configuration. See below for more details for the definition of the - * dataPoints element. + * Get the defaultTopic property: Object that describes the default topic information for the asset. * - * @return the dataPoints value. + * @return the defaultTopic value. */ - public List dataPoints() { - return this.dataPoints; + public Topic defaultTopic() { + return this.defaultTopic; } /** - * Set the dataPoints property: Array of data points that are part of the asset. Each data point can reference an - * asset type capability and have per-data point configuration. See below for more details for the definition of the - * dataPoints element. + * Set the defaultTopic property: Object that describes the default topic information for the asset. * - * @param dataPoints the dataPoints value to set. + * @param defaultTopic the defaultTopic value to set. * @return the AssetProperties object itself. */ - public AssetProperties withDataPoints(List dataPoints) { - this.dataPoints = dataPoints; + public AssetProperties withDefaultTopic(Topic defaultTopic) { + this.defaultTopic = defaultTopic; return this; } /** - * Get the events property: Array of events that are part of the asset. Each event can reference an asset type - * capability and have per-event configuration. See below for more details about the definition of the events - * element. + * Get the datasets property: Array of datasets that are part of the asset. Each dataset describes the data points + * that make up the set. + * + * @return the datasets value. + */ + public List datasets() { + return this.datasets; + } + + /** + * Set the datasets property: Array of datasets that are part of the asset. Each dataset describes the data points + * that make up the set. + * + * @param datasets the datasets value to set. + * @return the AssetProperties object itself. + */ + public AssetProperties withDatasets(List datasets) { + this.datasets = datasets; + return this; + } + + /** + * Get the events property: Array of events that are part of the asset. Each event can have per-event configuration. * * @return the events value. */ @@ -553,9 +573,7 @@ public List events() { } /** - * Set the events property: Array of events that are part of the asset. Each event can reference an asset type - * capability and have per-event configuration. See below for more details about the definition of the events - * element. + * Set the events property: Array of events that are part of the asset. Each event can have per-event configuration. * * @param events the events value to set. * @return the AssetProperties object itself. @@ -590,13 +608,16 @@ public ProvisioningState provisioningState() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (assetEndpointProfileUri() == null) { + if (assetEndpointProfileRef() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( - "Missing required property assetEndpointProfileUri in model AssetProperties")); + "Missing required property assetEndpointProfileRef in model AssetProperties")); + } + if (defaultTopic() != null) { + defaultTopic().validate(); } - if (dataPoints() != null) { - dataPoints().forEach(e -> e.validate()); + if (datasets() != null) { + datasets().forEach(e -> e.validate()); } if (events() != null) { events().forEach(e -> e.validate()); @@ -614,8 +635,7 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("assetEndpointProfileUri", this.assetEndpointProfileUri); - jsonWriter.writeStringField("assetType", this.assetType); + jsonWriter.writeStringField("assetEndpointProfileRef", this.assetEndpointProfileRef); jsonWriter.writeBooleanField("enabled", this.enabled); jsonWriter.writeStringField("externalAssetId", this.externalAssetId); jsonWriter.writeStringField("displayName", this.displayName); @@ -630,9 +650,12 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("serialNumber", this.serialNumber); jsonWriter.writeMapField("attributes", this.attributes, (writer, element) -> writer.writeUntyped(element == null ? null : element.toObject(Object.class))); - jsonWriter.writeStringField("defaultDataPointsConfiguration", this.defaultDataPointsConfiguration); + jsonWriter.writeArrayField("discoveredAssetRefs", this.discoveredAssetRefs, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("defaultDatasetsConfiguration", this.defaultDatasetsConfiguration); jsonWriter.writeStringField("defaultEventsConfiguration", this.defaultEventsConfiguration); - jsonWriter.writeArrayField("dataPoints", this.dataPoints, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("defaultTopic", this.defaultTopic); + jsonWriter.writeArrayField("datasets", this.datasets, (writer, element) -> writer.writeJson(element)); jsonWriter.writeArrayField("events", this.events, (writer, element) -> writer.writeJson(element)); return jsonWriter.writeEndObject(); } @@ -653,12 +676,10 @@ public static AssetProperties fromJson(JsonReader jsonReader) throws IOException String fieldName = reader.getFieldName(); reader.nextToken(); - if ("assetEndpointProfileUri".equals(fieldName)) { - deserializedAssetProperties.assetEndpointProfileUri = reader.getString(); + if ("assetEndpointProfileRef".equals(fieldName)) { + deserializedAssetProperties.assetEndpointProfileRef = reader.getString(); } else if ("uuid".equals(fieldName)) { deserializedAssetProperties.uuid = reader.getString(); - } else if ("assetType".equals(fieldName)) { - deserializedAssetProperties.assetType = reader.getString(); } else if ("enabled".equals(fieldName)) { deserializedAssetProperties.enabled = reader.getNullable(JsonReader::getBoolean); } else if ("externalAssetId".equals(fieldName)) { @@ -668,7 +689,7 @@ public static AssetProperties fromJson(JsonReader jsonReader) throws IOException } else if ("description".equals(fieldName)) { deserializedAssetProperties.description = reader.getString(); } else if ("version".equals(fieldName)) { - deserializedAssetProperties.version = reader.getNullable(JsonReader::getInt); + deserializedAssetProperties.version = reader.getNullable(JsonReader::getLong); } else if ("manufacturer".equals(fieldName)) { deserializedAssetProperties.manufacturer = reader.getString(); } else if ("manufacturerUri".equals(fieldName)) { @@ -689,13 +710,18 @@ public static AssetProperties fromJson(JsonReader jsonReader) throws IOException Map attributes = reader.readMap(reader1 -> reader1 .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); deserializedAssetProperties.attributes = attributes; - } else if ("defaultDataPointsConfiguration".equals(fieldName)) { - deserializedAssetProperties.defaultDataPointsConfiguration = reader.getString(); + } else if ("discoveredAssetRefs".equals(fieldName)) { + List discoveredAssetRefs = reader.readArray(reader1 -> reader1.getString()); + deserializedAssetProperties.discoveredAssetRefs = discoveredAssetRefs; + } else if ("defaultDatasetsConfiguration".equals(fieldName)) { + deserializedAssetProperties.defaultDatasetsConfiguration = reader.getString(); } else if ("defaultEventsConfiguration".equals(fieldName)) { deserializedAssetProperties.defaultEventsConfiguration = reader.getString(); - } else if ("dataPoints".equals(fieldName)) { - List dataPoints = reader.readArray(reader1 -> DataPoint.fromJson(reader1)); - deserializedAssetProperties.dataPoints = dataPoints; + } else if ("defaultTopic".equals(fieldName)) { + deserializedAssetProperties.defaultTopic = Topic.fromJson(reader); + } else if ("datasets".equals(fieldName)) { + List datasets = reader.readArray(reader1 -> Dataset.fromJson(reader1)); + deserializedAssetProperties.datasets = datasets; } else if ("events".equals(fieldName)) { List events = reader.readArray(reader1 -> Event.fromJson(reader1)); deserializedAssetProperties.events = events; diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatus.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatus.java index 980d31c416a3c..e4be52b91e60a 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatus.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatus.java @@ -27,7 +27,17 @@ public final class AssetStatus implements JsonSerializable { * perspective of the current actual (Edge) state of the Asset. Edge would be the only writer of this value and * would sync back up to the cloud. In steady state, this should equal version. */ - private Integer version; + private Long version; + + /* + * Array of dataset statuses that describe the status of each dataset. + */ + private List datasets; + + /* + * Array of event statuses that describe the status of each event. + */ + private List events; /** * Creates an instance of AssetStatus class. @@ -51,10 +61,28 @@ public List errors() { * * @return the version value. */ - public Integer version() { + public Long version() { return this.version; } + /** + * Get the datasets property: Array of dataset statuses that describe the status of each dataset. + * + * @return the datasets value. + */ + public List datasets() { + return this.datasets; + } + + /** + * Get the events property: Array of event statuses that describe the status of each event. + * + * @return the events value. + */ + public List events() { + return this.events; + } + /** * Validates the instance. * @@ -64,6 +92,12 @@ public void validate() { if (errors() != null) { errors().forEach(e -> e.validate()); } + if (datasets() != null) { + datasets().forEach(e -> e.validate()); + } + if (events() != null) { + events().forEach(e -> e.validate()); + } } /** @@ -72,8 +106,6 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("errors", this.errors, (writer, element) -> writer.writeJson(element)); - jsonWriter.writeNumberField("version", this.version); return jsonWriter.writeEndObject(); } @@ -96,7 +128,14 @@ public static AssetStatus fromJson(JsonReader jsonReader) throws IOException { List errors = reader.readArray(reader1 -> AssetStatusError.fromJson(reader1)); deserializedAssetStatus.errors = errors; } else if ("version".equals(fieldName)) { - deserializedAssetStatus.version = reader.getNullable(JsonReader::getInt); + deserializedAssetStatus.version = reader.getNullable(JsonReader::getLong); + } else if ("datasets".equals(fieldName)) { + List datasets + = reader.readArray(reader1 -> AssetStatusDataset.fromJson(reader1)); + deserializedAssetStatus.datasets = datasets; + } else if ("events".equals(fieldName)) { + List events = reader.readArray(reader1 -> AssetStatusEvent.fromJson(reader1)); + deserializedAssetStatus.events = events; } else { reader.skipChildren(); } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatusDataset.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatusDataset.java new file mode 100644 index 0000000000000..5c3b34725bdac --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatusDataset.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines the asset status dataset properties. + */ +@Immutable +public final class AssetStatusDataset implements JsonSerializable { + /* + * The name of the dataset. Must be unique within the status.datasets array. This name is used to correlate between + * the spec and status dataset information. + */ + private String name; + + /* + * The message schema reference object. + */ + private MessageSchemaReference messageSchemaReference; + + /** + * Creates an instance of AssetStatusDataset class. + */ + private AssetStatusDataset() { + } + + /** + * Get the name property: The name of the dataset. Must be unique within the status.datasets array. This name is + * used to correlate between the spec and status dataset information. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the messageSchemaReference property: The message schema reference object. + * + * @return the messageSchemaReference value. + */ + public MessageSchemaReference messageSchemaReference() { + return this.messageSchemaReference; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (messageSchemaReference() != null) { + messageSchemaReference().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssetStatusDataset from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssetStatusDataset if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AssetStatusDataset. + */ + public static AssetStatusDataset fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssetStatusDataset deserializedAssetStatusDataset = new AssetStatusDataset(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedAssetStatusDataset.name = reader.getString(); + } else if ("messageSchemaReference".equals(fieldName)) { + deserializedAssetStatusDataset.messageSchemaReference = MessageSchemaReference.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAssetStatusDataset; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatusError.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatusError.java index 0374f4b4d0e07..f269e25e8ca27 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatusError.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatusError.java @@ -66,8 +66,6 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeNumberField("code", this.code); - jsonWriter.writeStringField("message", this.message); return jsonWriter.writeEndObject(); } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatusEvent.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatusEvent.java new file mode 100644 index 0000000000000..100e03d4e2740 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetStatusEvent.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines the asset status event properties. + */ +@Immutable +public final class AssetStatusEvent implements JsonSerializable { + /* + * The name of the event. Must be unique within the status.events array. This name is used to correlate between the + * spec and status event information. + */ + private String name; + + /* + * The message schema reference object. + */ + private MessageSchemaReference messageSchemaReference; + + /** + * Creates an instance of AssetStatusEvent class. + */ + private AssetStatusEvent() { + } + + /** + * Get the name property: The name of the event. Must be unique within the status.events array. This name is used to + * correlate between the spec and status event information. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the messageSchemaReference property: The message schema reference object. + * + * @return the messageSchemaReference value. + */ + public MessageSchemaReference messageSchemaReference() { + return this.messageSchemaReference; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (messageSchemaReference() != null) { + messageSchemaReference().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssetStatusEvent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssetStatusEvent if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AssetStatusEvent. + */ + public static AssetStatusEvent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssetStatusEvent deserializedAssetStatusEvent = new AssetStatusEvent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedAssetStatusEvent.name = reader.getString(); + } else if ("messageSchemaReference".equals(fieldName)) { + deserializedAssetStatusEvent.messageSchemaReference = MessageSchemaReference.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAssetStatusEvent; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetUpdateProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetUpdateProperties.java index cd47290ccd8fc..09d1c3c3a3324 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetUpdateProperties.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AssetUpdateProperties.java @@ -19,11 +19,6 @@ */ @Fluent public final class AssetUpdateProperties implements JsonSerializable { - /* - * Resource path to asset type (model) definition. - */ - private String assetType; - /* * Enabled/Disabled status of the asset. */ @@ -85,26 +80,29 @@ public final class AssetUpdateProperties implements JsonSerializable attributes; /* - * Protocol-specific default configuration for all data points. Each data point can have its own configuration that - * overrides the default settings here. This assumes that each asset instance has one protocol. + * Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have + * its own configuration that overrides the default settings here. */ - private String defaultDataPointsConfiguration; + private String defaultDatasetsConfiguration; /* - * Protocol-specific default configuration for all events. Each event can have its own configuration that overrides - * the default settings here. This assumes that each asset instance has one protocol. + * Stringified JSON that contains connector-specific default configuration for all events. Each event can have its + * own configuration that overrides the default settings here. */ private String defaultEventsConfiguration; /* - * Array of data points that are part of the asset. Each data point can reference an asset type capability and have - * per-data point configuration. See below for more details for the definition of the dataPoints element. + * Object that describes the default topic information for the asset. + */ + private Topic defaultTopic; + + /* + * Array of datasets that are part of the asset. Each dataset describes the data points that make up the set. */ - private List dataPoints; + private List datasets; /* - * Array of events that are part of the asset. Each event can reference an asset type capability and have per-event - * configuration. See below for more details about the definition of the events element. + * Array of events that are part of the asset. Each event can have per-event configuration. */ private List events; @@ -114,26 +112,6 @@ public final class AssetUpdateProperties implements JsonSerializable attributes) } /** - * Get the defaultDataPointsConfiguration property: Protocol-specific default configuration for all data points. - * Each data point can have its own configuration that overrides the default settings here. This assumes that each - * asset instance has one protocol. + * Get the defaultDatasetsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all datasets. Each dataset can have its own configuration that overrides the default settings + * here. * - * @return the defaultDataPointsConfiguration value. + * @return the defaultDatasetsConfiguration value. */ - public String defaultDataPointsConfiguration() { - return this.defaultDataPointsConfiguration; + public String defaultDatasetsConfiguration() { + return this.defaultDatasetsConfiguration; } /** - * Set the defaultDataPointsConfiguration property: Protocol-specific default configuration for all data points. - * Each data point can have its own configuration that overrides the default settings here. This assumes that each - * asset instance has one protocol. + * Set the defaultDatasetsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all datasets. Each dataset can have its own configuration that overrides the default settings + * here. * - * @param defaultDataPointsConfiguration the defaultDataPointsConfiguration value to set. + * @param defaultDatasetsConfiguration the defaultDatasetsConfiguration value to set. * @return the AssetUpdateProperties object itself. */ - public AssetUpdateProperties withDefaultDataPointsConfiguration(String defaultDataPointsConfiguration) { - this.defaultDataPointsConfiguration = defaultDataPointsConfiguration; + public AssetUpdateProperties withDefaultDatasetsConfiguration(String defaultDatasetsConfiguration) { + this.defaultDatasetsConfiguration = defaultDatasetsConfiguration; return this; } /** - * Get the defaultEventsConfiguration property: Protocol-specific default configuration for all events. Each event - * can have its own configuration that overrides the default settings here. This assumes that each asset instance - * has one protocol. + * Get the defaultEventsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all events. Each event can have its own configuration that overrides the default settings here. * * @return the defaultEventsConfiguration value. */ @@ -410,9 +387,8 @@ public String defaultEventsConfiguration() { } /** - * Set the defaultEventsConfiguration property: Protocol-specific default configuration for all events. Each event - * can have its own configuration that overrides the default settings here. This assumes that each asset instance - * has one protocol. + * Set the defaultEventsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all events. Each event can have its own configuration that overrides the default settings here. * * @param defaultEventsConfiguration the defaultEventsConfiguration value to set. * @return the AssetUpdateProperties object itself. @@ -423,33 +399,49 @@ public AssetUpdateProperties withDefaultEventsConfiguration(String defaultEvents } /** - * Get the dataPoints property: Array of data points that are part of the asset. Each data point can reference an - * asset type capability and have per-data point configuration. See below for more details for the definition of the - * dataPoints element. + * Get the defaultTopic property: Object that describes the default topic information for the asset. * - * @return the dataPoints value. + * @return the defaultTopic value. */ - public List dataPoints() { - return this.dataPoints; + public Topic defaultTopic() { + return this.defaultTopic; } /** - * Set the dataPoints property: Array of data points that are part of the asset. Each data point can reference an - * asset type capability and have per-data point configuration. See below for more details for the definition of the - * dataPoints element. + * Set the defaultTopic property: Object that describes the default topic information for the asset. * - * @param dataPoints the dataPoints value to set. + * @param defaultTopic the defaultTopic value to set. * @return the AssetUpdateProperties object itself. */ - public AssetUpdateProperties withDataPoints(List dataPoints) { - this.dataPoints = dataPoints; + public AssetUpdateProperties withDefaultTopic(Topic defaultTopic) { + this.defaultTopic = defaultTopic; return this; } /** - * Get the events property: Array of events that are part of the asset. Each event can reference an asset type - * capability and have per-event configuration. See below for more details about the definition of the events - * element. + * Get the datasets property: Array of datasets that are part of the asset. Each dataset describes the data points + * that make up the set. + * + * @return the datasets value. + */ + public List datasets() { + return this.datasets; + } + + /** + * Set the datasets property: Array of datasets that are part of the asset. Each dataset describes the data points + * that make up the set. + * + * @param datasets the datasets value to set. + * @return the AssetUpdateProperties object itself. + */ + public AssetUpdateProperties withDatasets(List datasets) { + this.datasets = datasets; + return this; + } + + /** + * Get the events property: Array of events that are part of the asset. Each event can have per-event configuration. * * @return the events value. */ @@ -458,9 +450,7 @@ public List events() { } /** - * Set the events property: Array of events that are part of the asset. Each event can reference an asset type - * capability and have per-event configuration. See below for more details about the definition of the events - * element. + * Set the events property: Array of events that are part of the asset. Each event can have per-event configuration. * * @param events the events value to set. * @return the AssetUpdateProperties object itself. @@ -476,8 +466,11 @@ public AssetUpdateProperties withEvents(List events) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (dataPoints() != null) { - dataPoints().forEach(e -> e.validate()); + if (defaultTopic() != null) { + defaultTopic().validate(); + } + if (datasets() != null) { + datasets().forEach(e -> e.validate()); } if (events() != null) { events().forEach(e -> e.validate()); @@ -490,7 +483,6 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("assetType", this.assetType); jsonWriter.writeBooleanField("enabled", this.enabled); jsonWriter.writeStringField("displayName", this.displayName); jsonWriter.writeStringField("description", this.description); @@ -504,9 +496,10 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("serialNumber", this.serialNumber); jsonWriter.writeMapField("attributes", this.attributes, (writer, element) -> writer.writeUntyped(element == null ? null : element.toObject(Object.class))); - jsonWriter.writeStringField("defaultDataPointsConfiguration", this.defaultDataPointsConfiguration); + jsonWriter.writeStringField("defaultDatasetsConfiguration", this.defaultDatasetsConfiguration); jsonWriter.writeStringField("defaultEventsConfiguration", this.defaultEventsConfiguration); - jsonWriter.writeArrayField("dataPoints", this.dataPoints, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("defaultTopic", this.defaultTopic); + jsonWriter.writeArrayField("datasets", this.datasets, (writer, element) -> writer.writeJson(element)); jsonWriter.writeArrayField("events", this.events, (writer, element) -> writer.writeJson(element)); return jsonWriter.writeEndObject(); } @@ -526,9 +519,7 @@ public static AssetUpdateProperties fromJson(JsonReader jsonReader) throws IOExc String fieldName = reader.getFieldName(); reader.nextToken(); - if ("assetType".equals(fieldName)) { - deserializedAssetUpdateProperties.assetType = reader.getString(); - } else if ("enabled".equals(fieldName)) { + if ("enabled".equals(fieldName)) { deserializedAssetUpdateProperties.enabled = reader.getNullable(JsonReader::getBoolean); } else if ("displayName".equals(fieldName)) { deserializedAssetUpdateProperties.displayName = reader.getString(); @@ -554,13 +545,15 @@ public static AssetUpdateProperties fromJson(JsonReader jsonReader) throws IOExc Map attributes = reader.readMap(reader1 -> reader1 .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); deserializedAssetUpdateProperties.attributes = attributes; - } else if ("defaultDataPointsConfiguration".equals(fieldName)) { - deserializedAssetUpdateProperties.defaultDataPointsConfiguration = reader.getString(); + } else if ("defaultDatasetsConfiguration".equals(fieldName)) { + deserializedAssetUpdateProperties.defaultDatasetsConfiguration = reader.getString(); } else if ("defaultEventsConfiguration".equals(fieldName)) { deserializedAssetUpdateProperties.defaultEventsConfiguration = reader.getString(); - } else if ("dataPoints".equals(fieldName)) { - List dataPoints = reader.readArray(reader1 -> DataPoint.fromJson(reader1)); - deserializedAssetUpdateProperties.dataPoints = dataPoints; + } else if ("defaultTopic".equals(fieldName)) { + deserializedAssetUpdateProperties.defaultTopic = Topic.fromJson(reader); + } else if ("datasets".equals(fieldName)) { + List datasets = reader.readArray(reader1 -> Dataset.fromJson(reader1)); + deserializedAssetUpdateProperties.datasets = datasets; } else if ("events".equals(fieldName)) { List events = reader.readArray(reader1 -> Event.fromJson(reader1)); deserializedAssetUpdateProperties.events = events; diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/UserAuthentication.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Authentication.java similarity index 66% rename from sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/UserAuthentication.java rename to sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Authentication.java index e17d5ba8f48a1..e72dc9e78d60b 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/UserAuthentication.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Authentication.java @@ -16,11 +16,11 @@ * Definition of the client authentication mechanism to the server. */ @Fluent -public final class UserAuthentication implements JsonSerializable { +public final class Authentication implements JsonSerializable { /* - * Defines the mode to authenticate the user of the client at the server. + * Defines the method to authenticate the user of the client at the server. */ - private UserAuthenticationMode mode; + private AuthenticationMethod method; /* * Defines the username and password references when UsernamePassword user authentication mode is selected. @@ -33,28 +33,28 @@ public final class UserAuthentication implements JsonSerializable { - UserAuthentication deserializedUserAuthentication = new UserAuthentication(); + Authentication deserializedAuthentication = new Authentication(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("mode".equals(fieldName)) { - deserializedUserAuthentication.mode = UserAuthenticationMode.fromString(reader.getString()); + if ("method".equals(fieldName)) { + deserializedAuthentication.method = AuthenticationMethod.fromString(reader.getString()); } else if ("usernamePasswordCredentials".equals(fieldName)) { - deserializedUserAuthentication.usernamePasswordCredentials + deserializedAuthentication.usernamePasswordCredentials = UsernamePasswordCredentials.fromJson(reader); } else if ("x509Credentials".equals(fieldName)) { - deserializedUserAuthentication.x509Credentials = X509Credentials.fromJson(reader); + deserializedAuthentication.x509Credentials = X509Credentials.fromJson(reader); } else { reader.skipChildren(); } } - return deserializedUserAuthentication; + return deserializedAuthentication; }); } } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AuthenticationMethod.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AuthenticationMethod.java new file mode 100644 index 0000000000000..ae36c63b800b9 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/AuthenticationMethod.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The method to authenticate the user of the client at the server. + */ +public final class AuthenticationMethod extends ExpandableStringEnum { + /** + * The user authentication method is anonymous. + */ + public static final AuthenticationMethod ANONYMOUS = fromString("Anonymous"); + + /** + * The user authentication method is an x509 certificate. + */ + public static final AuthenticationMethod CERTIFICATE = fromString("Certificate"); + + /** + * The user authentication method is a username and password. + */ + public static final AuthenticationMethod USERNAME_PASSWORD = fromString("UsernamePassword"); + + /** + * Creates a new instance of AuthenticationMethod value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AuthenticationMethod() { + } + + /** + * Creates or finds a AuthenticationMethod from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthenticationMethod. + */ + public static AuthenticationMethod fromString(String name) { + return fromString(name, AuthenticationMethod.class); + } + + /** + * Gets known AuthenticationMethod values. + * + * @return known AuthenticationMethod values. + */ + public static Collection values() { + return values(AuthenticationMethod.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/BillingContainer.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/BillingContainer.java new file mode 100644 index 0000000000000..521af64f71d4f --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/BillingContainer.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.deviceregistry.fluent.models.BillingContainerInner; + +/** + * An immutable client-side representation of BillingContainer. + */ +public interface BillingContainer { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + BillingContainerProperties properties(); + + /** + * Gets the etag property: Resource ETag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.deviceregistry.fluent.models.BillingContainerInner object. + * + * @return the inner object. + */ + BillingContainerInner innerModel(); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/BillingContainerProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/BillingContainerProperties.java new file mode 100644 index 0000000000000..aa81f58992d6a --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/BillingContainerProperties.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines the billingContainer properties. + */ +@Immutable +public final class BillingContainerProperties implements JsonSerializable { + /* + * Provisioning state of the resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of BillingContainerProperties class. + */ + private BillingContainerProperties() { + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BillingContainerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BillingContainerProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the BillingContainerProperties. + */ + public static BillingContainerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BillingContainerProperties deserializedBillingContainerProperties = new BillingContainerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedBillingContainerProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBillingContainerProperties; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/BillingContainers.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/BillingContainers.java new file mode 100644 index 0000000000000..b2a9bfa6d1e9b --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/BillingContainers.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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 BillingContainers. + */ +public interface BillingContainers { + /** + * Get a BillingContainer. + * + * @param billingContainerName Name of the billing container. + * @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 BillingContainer along with {@link Response}. + */ + Response getWithResponse(String billingContainerName, Context context); + + /** + * Get a BillingContainer. + * + * @param billingContainerName Name of the billing container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 BillingContainer. + */ + BillingContainer get(String billingContainerName); + + /** + * List BillingContainer 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 BillingContainer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List BillingContainer 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 BillingContainer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPoint.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPoint.java index f087945f24d0b..cfea11b801de1 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPoint.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPoint.java @@ -7,7 +7,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import java.io.IOException; @@ -16,34 +15,11 @@ * Defines the data point properties. */ @Fluent -public final class DataPoint implements JsonSerializable { - /* - * The name of the data point. - */ - private String name; - - /* - * The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the - * asset. - */ - private String dataSource; - - /* - * The path to the type definition of the capability (e.g. DTMI, OPC UA information model node id, etc.), for - * example dtmi:com:example:Robot:_contents:__prop1;1. - */ - private String capabilityId; - +public final class DataPoint extends DataPointBase { /* * An indication of how the data point should be mapped to OpenTelemetry. */ - private DataPointsObservabilityMode observabilityMode; - - /* - * Protocol-specific configuration for the data point. For OPC UA, this could include configuration like, - * publishingInterval, samplingInterval, and queueSize. - */ - private String dataPointConfiguration; + private DataPointObservabilityMode observabilityMode; /** * Creates an instance of DataPoint class. @@ -51,76 +27,12 @@ public final class DataPoint implements JsonSerializable { public DataPoint() { } - /** - * Get the name property: The name of the data point. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name of the data point. - * - * @param name the name value to set. - * @return the DataPoint object itself. - */ - public DataPoint withName(String name) { - this.name = name; - return this; - } - - /** - * Get the dataSource property: The address of the source of the data in the asset (e.g. URL) so that a client can - * access the data source on the asset. - * - * @return the dataSource value. - */ - public String dataSource() { - return this.dataSource; - } - - /** - * Set the dataSource property: The address of the source of the data in the asset (e.g. URL) so that a client can - * access the data source on the asset. - * - * @param dataSource the dataSource value to set. - * @return the DataPoint object itself. - */ - public DataPoint withDataSource(String dataSource) { - this.dataSource = dataSource; - return this; - } - - /** - * Get the capabilityId property: The path to the type definition of the capability (e.g. DTMI, OPC UA information - * model node id, etc.), for example dtmi:com:example:Robot:_contents:__prop1;1. - * - * @return the capabilityId value. - */ - public String capabilityId() { - return this.capabilityId; - } - - /** - * Set the capabilityId property: The path to the type definition of the capability (e.g. DTMI, OPC UA information - * model node id, etc.), for example dtmi:com:example:Robot:_contents:__prop1;1. - * - * @param capabilityId the capabilityId value to set. - * @return the DataPoint object itself. - */ - public DataPoint withCapabilityId(String capabilityId) { - this.capabilityId = capabilityId; - return this; - } - /** * Get the observabilityMode property: An indication of how the data point should be mapped to OpenTelemetry. * * @return the observabilityMode value. */ - public DataPointsObservabilityMode observabilityMode() { + public DataPointObservabilityMode observabilityMode() { return this.observabilityMode; } @@ -130,30 +42,35 @@ public DataPointsObservabilityMode observabilityMode() { * @param observabilityMode the observabilityMode value to set. * @return the DataPoint object itself. */ - public DataPoint withObservabilityMode(DataPointsObservabilityMode observabilityMode) { + public DataPoint withObservabilityMode(DataPointObservabilityMode observabilityMode) { this.observabilityMode = observabilityMode; return this; } /** - * Get the dataPointConfiguration property: Protocol-specific configuration for the data point. For OPC UA, this - * could include configuration like, publishingInterval, samplingInterval, and queueSize. - * - * @return the dataPointConfiguration value. + * {@inheritDoc} + */ + @Override + public DataPoint withName(String name) { + super.withName(name); + return this; + } + + /** + * {@inheritDoc} */ - public String dataPointConfiguration() { - return this.dataPointConfiguration; + @Override + public DataPoint withDataSource(String dataSource) { + super.withDataSource(dataSource); + return this; } /** - * Set the dataPointConfiguration property: Protocol-specific configuration for the data point. For OPC UA, this - * could include configuration like, publishingInterval, samplingInterval, and queueSize. - * - * @param dataPointConfiguration the dataPointConfiguration value to set. - * @return the DataPoint object itself. + * {@inheritDoc} */ + @Override public DataPoint withDataPointConfiguration(String dataPointConfiguration) { - this.dataPointConfiguration = dataPointConfiguration; + super.withDataPointConfiguration(dataPointConfiguration); return this; } @@ -162,7 +79,12 @@ public DataPoint withDataPointConfiguration(String dataPointConfiguration) { * * @throws IllegalArgumentException thrown if the instance is not valid. */ + @Override public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model DataPoint")); + } if (dataSource() == null) { throw LOGGER.atError() .log(new IllegalArgumentException("Missing required property dataSource in model DataPoint")); @@ -177,12 +99,11 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("dataSource", this.dataSource); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("capabilityId", this.capabilityId); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeStringField("dataSource", dataSource()); + jsonWriter.writeStringField("dataPointConfiguration", dataPointConfiguration()); jsonWriter.writeStringField("observabilityMode", this.observabilityMode == null ? null : this.observabilityMode.toString()); - jsonWriter.writeStringField("dataPointConfiguration", this.dataPointConfiguration); return jsonWriter.writeEndObject(); } @@ -202,17 +123,14 @@ public static DataPoint fromJson(JsonReader jsonReader) throws IOException { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("dataSource".equals(fieldName)) { - deserializedDataPoint.dataSource = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedDataPoint.name = reader.getString(); - } else if ("capabilityId".equals(fieldName)) { - deserializedDataPoint.capabilityId = reader.getString(); - } else if ("observabilityMode".equals(fieldName)) { - deserializedDataPoint.observabilityMode - = DataPointsObservabilityMode.fromString(reader.getString()); + if ("name".equals(fieldName)) { + deserializedDataPoint.withName(reader.getString()); + } else if ("dataSource".equals(fieldName)) { + deserializedDataPoint.withDataSource(reader.getString()); } else if ("dataPointConfiguration".equals(fieldName)) { - deserializedDataPoint.dataPointConfiguration = reader.getString(); + deserializedDataPoint.withDataPointConfiguration(reader.getString()); + } else if ("observabilityMode".equals(fieldName)) { + deserializedDataPoint.observabilityMode = DataPointObservabilityMode.fromString(reader.getString()); } else { reader.skipChildren(); } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPointBase.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPointBase.java new file mode 100644 index 0000000000000..b8c3beab42bb5 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPointBase.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines the data point properties. + */ +@Fluent +public class DataPointBase implements JsonSerializable { + /* + * The name of the data point. + */ + private String name; + + /* + * The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the + * asset. + */ + private String dataSource; + + /* + * Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, this could + * include configuration like, publishingInterval, samplingInterval, and queueSize. + */ + private String dataPointConfiguration; + + /** + * Creates an instance of DataPointBase class. + */ + public DataPointBase() { + } + + /** + * Get the name property: The name of the data point. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the data point. + * + * @param name the name value to set. + * @return the DataPointBase object itself. + */ + public DataPointBase withName(String name) { + this.name = name; + return this; + } + + /** + * Get the dataSource property: The address of the source of the data in the asset (e.g. URL) so that a client can + * access the data source on the asset. + * + * @return the dataSource value. + */ + public String dataSource() { + return this.dataSource; + } + + /** + * Set the dataSource property: The address of the source of the data in the asset (e.g. URL) so that a client can + * access the data source on the asset. + * + * @param dataSource the dataSource value to set. + * @return the DataPointBase object itself. + */ + public DataPointBase withDataSource(String dataSource) { + this.dataSource = dataSource; + return this; + } + + /** + * Get the dataPointConfiguration property: Stringified JSON that contains connector-specific configuration for the + * data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and + * queueSize. + * + * @return the dataPointConfiguration value. + */ + public String dataPointConfiguration() { + return this.dataPointConfiguration; + } + + /** + * Set the dataPointConfiguration property: Stringified JSON that contains connector-specific configuration for the + * data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and + * queueSize. + * + * @param dataPointConfiguration the dataPointConfiguration value to set. + * @return the DataPointBase object itself. + */ + public DataPointBase withDataPointConfiguration(String dataPointConfiguration) { + this.dataPointConfiguration = dataPointConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model DataPointBase")); + } + if (dataSource() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property dataSource in model DataPointBase")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataPointBase.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("dataSource", this.dataSource); + jsonWriter.writeStringField("dataPointConfiguration", this.dataPointConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DataPointBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DataPointBase if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DataPointBase. + */ + public static DataPointBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DataPointBase deserializedDataPointBase = new DataPointBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDataPointBase.name = reader.getString(); + } else if ("dataSource".equals(fieldName)) { + deserializedDataPointBase.dataSource = reader.getString(); + } else if ("dataPointConfiguration".equals(fieldName)) { + deserializedDataPointBase.dataPointConfiguration = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDataPointBase; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPointObservabilityMode.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPointObservabilityMode.java new file mode 100644 index 0000000000000..d654035332fc2 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPointObservabilityMode.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the data point observability mode. + */ +public final class DataPointObservabilityMode extends ExpandableStringEnum { + /** + * No mapping to OpenTelemetry. + */ + public static final DataPointObservabilityMode NONE = fromString("None"); + + /** + * Map as counter to OpenTelemetry. + */ + public static final DataPointObservabilityMode COUNTER = fromString("Counter"); + + /** + * Map as gauge to OpenTelemetry. + */ + public static final DataPointObservabilityMode GAUGE = fromString("Gauge"); + + /** + * Map as histogram to OpenTelemetry. + */ + public static final DataPointObservabilityMode HISTOGRAM = fromString("Histogram"); + + /** + * Map as log to OpenTelemetry. + */ + public static final DataPointObservabilityMode LOG = fromString("Log"); + + /** + * Creates a new instance of DataPointObservabilityMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DataPointObservabilityMode() { + } + + /** + * Creates or finds a DataPointObservabilityMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataPointObservabilityMode. + */ + public static DataPointObservabilityMode fromString(String name) { + return fromString(name, DataPointObservabilityMode.class); + } + + /** + * Gets known DataPointObservabilityMode values. + * + * @return known DataPointObservabilityMode values. + */ + public static Collection values() { + return values(DataPointObservabilityMode.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPointsObservabilityMode.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPointsObservabilityMode.java deleted file mode 100644 index 7ddd6ac27a06e..0000000000000 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DataPointsObservabilityMode.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.deviceregistry.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines the data point observability mode. - */ -public final class DataPointsObservabilityMode extends ExpandableStringEnum { - /** - * No mapping to OpenTelemetry. - */ - public static final DataPointsObservabilityMode NONE = fromString("none"); - - /** - * Map as counter to OpenTelemetry. - */ - public static final DataPointsObservabilityMode COUNTER = fromString("counter"); - - /** - * Map as gauge to OpenTelemetry. - */ - public static final DataPointsObservabilityMode GAUGE = fromString("gauge"); - - /** - * Map as histogram to OpenTelemetry. - */ - public static final DataPointsObservabilityMode HISTOGRAM = fromString("histogram"); - - /** - * Map as log to OpenTelemetry. - */ - public static final DataPointsObservabilityMode LOG = fromString("log"); - - /** - * Creates a new instance of DataPointsObservabilityMode value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public DataPointsObservabilityMode() { - } - - /** - * Creates or finds a DataPointsObservabilityMode from its string representation. - * - * @param name a name to look for. - * @return the corresponding DataPointsObservabilityMode. - */ - public static DataPointsObservabilityMode fromString(String name) { - return fromString(name, DataPointsObservabilityMode.class); - } - - /** - * Gets known DataPointsObservabilityMode values. - * - * @return known DataPointsObservabilityMode values. - */ - public static Collection values() { - return values(DataPointsObservabilityMode.class); - } -} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Dataset.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Dataset.java new file mode 100644 index 0000000000000..26e2ebd32bb97 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Dataset.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Defines the dataset properties. + */ +@Fluent +public final class Dataset implements JsonSerializable { + /* + * Name of the dataset. + */ + private String name; + + /* + * Stringified JSON that contains connector-specific JSON string that describes configuration for the specific + * dataset. + */ + private String datasetConfiguration; + + /* + * Object that describes the topic information for the specific dataset. + */ + private Topic topic; + + /* + * Array of data points that are part of the dataset. Each data point can have per-data point configuration. + */ + private List dataPoints; + + /** + * Creates an instance of Dataset class. + */ + public Dataset() { + } + + /** + * Get the name property: Name of the dataset. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the dataset. + * + * @param name the name value to set. + * @return the Dataset object itself. + */ + public Dataset withName(String name) { + this.name = name; + return this; + } + + /** + * Get the datasetConfiguration property: Stringified JSON that contains connector-specific JSON string that + * describes configuration for the specific dataset. + * + * @return the datasetConfiguration value. + */ + public String datasetConfiguration() { + return this.datasetConfiguration; + } + + /** + * Set the datasetConfiguration property: Stringified JSON that contains connector-specific JSON string that + * describes configuration for the specific dataset. + * + * @param datasetConfiguration the datasetConfiguration value to set. + * @return the Dataset object itself. + */ + public Dataset withDatasetConfiguration(String datasetConfiguration) { + this.datasetConfiguration = datasetConfiguration; + return this; + } + + /** + * Get the topic property: Object that describes the topic information for the specific dataset. + * + * @return the topic value. + */ + public Topic topic() { + return this.topic; + } + + /** + * Set the topic property: Object that describes the topic information for the specific dataset. + * + * @param topic the topic value to set. + * @return the Dataset object itself. + */ + public Dataset withTopic(Topic topic) { + this.topic = topic; + return this; + } + + /** + * Get the dataPoints property: Array of data points that are part of the dataset. Each data point can have per-data + * point configuration. + * + * @return the dataPoints value. + */ + public List dataPoints() { + return this.dataPoints; + } + + /** + * Set the dataPoints property: Array of data points that are part of the dataset. Each data point can have per-data + * point configuration. + * + * @param dataPoints the dataPoints value to set. + * @return the Dataset object itself. + */ + public Dataset withDataPoints(List dataPoints) { + this.dataPoints = dataPoints; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Dataset")); + } + if (topic() != null) { + topic().validate(); + } + if (dataPoints() != null) { + dataPoints().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Dataset.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("datasetConfiguration", this.datasetConfiguration); + jsonWriter.writeJsonField("topic", this.topic); + jsonWriter.writeArrayField("dataPoints", this.dataPoints, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Dataset from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Dataset if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Dataset. + */ + public static Dataset fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Dataset deserializedDataset = new Dataset(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDataset.name = reader.getString(); + } else if ("datasetConfiguration".equals(fieldName)) { + deserializedDataset.datasetConfiguration = reader.getString(); + } else if ("topic".equals(fieldName)) { + deserializedDataset.topic = Topic.fromJson(reader); + } else if ("dataPoints".equals(fieldName)) { + List dataPoints = reader.readArray(reader1 -> DataPoint.fromJson(reader1)); + deserializedDataset.dataPoints = dataPoints; + } else { + reader.skipChildren(); + } + } + + return deserializedDataset; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAsset.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAsset.java new file mode 100644 index 0000000000000..8f85247808786 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAsset.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetInner; +import java.util.Map; + +/** + * An immutable client-side representation of DiscoveredAsset. + */ +public interface DiscoveredAsset { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + DiscoveredAssetProperties properties(); + + /** + * Gets the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetInner object. + * + * @return the inner object. + */ + DiscoveredAssetInner innerModel(); + + /** + * The entirety of the DiscoveredAsset definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithExtendedLocation, DefinitionStages.WithCreate { + } + + /** + * The DiscoveredAsset definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the DiscoveredAsset definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the DiscoveredAsset 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 DiscoveredAsset 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. + */ + WithExtendedLocation withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the DiscoveredAsset definition allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location.. + * + * @param extendedLocation The extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + + /** + * The stage of the DiscoveredAsset 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, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + DiscoveredAsset create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DiscoveredAsset create(Context context); + } + + /** + * The stage of the DiscoveredAsset definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the DiscoveredAsset definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(DiscoveredAssetProperties properties); + } + } + + /** + * Begins update for the DiscoveredAsset resource. + * + * @return the stage of resource update. + */ + DiscoveredAsset.Update update(); + + /** + * The template for DiscoveredAsset update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DiscoveredAsset apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DiscoveredAsset apply(Context context); + } + + /** + * The DiscoveredAsset update stages. + */ + interface UpdateStages { + /** + * The stage of the DiscoveredAsset 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); + } + + /** + * The stage of the DiscoveredAsset update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(DiscoveredAssetUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DiscoveredAsset refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DiscoveredAsset refresh(Context context); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfile.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfile.java new file mode 100644 index 0000000000000..ae0646d90b83e --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfile.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetEndpointProfileInner; +import java.util.Map; + +/** + * An immutable client-side representation of DiscoveredAssetEndpointProfile. + */ +public interface DiscoveredAssetEndpointProfile { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + DiscoveredAssetEndpointProfileProperties properties(); + + /** + * Gets the extendedLocation property: The extended location. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetEndpointProfileInner object. + * + * @return the inner object. + */ + DiscoveredAssetEndpointProfileInner innerModel(); + + /** + * The entirety of the DiscoveredAssetEndpointProfile definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithExtendedLocation, DefinitionStages.WithCreate { + } + + /** + * The DiscoveredAssetEndpointProfile definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the DiscoveredAssetEndpointProfile definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile 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. + */ + WithExtendedLocation withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the DiscoveredAssetEndpointProfile definition allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extended location.. + * + * @param extendedLocation The extended location. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + + /** + * The stage of the DiscoveredAssetEndpointProfile 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, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + DiscoveredAssetEndpointProfile create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DiscoveredAssetEndpointProfile create(Context context); + } + + /** + * The stage of the DiscoveredAssetEndpointProfile definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the DiscoveredAssetEndpointProfile definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(DiscoveredAssetEndpointProfileProperties properties); + } + } + + /** + * Begins update for the DiscoveredAssetEndpointProfile resource. + * + * @return the stage of resource update. + */ + DiscoveredAssetEndpointProfile.Update update(); + + /** + * The template for DiscoveredAssetEndpointProfile update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DiscoveredAssetEndpointProfile apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DiscoveredAssetEndpointProfile apply(Context context); + } + + /** + * The DiscoveredAssetEndpointProfile update stages. + */ + interface UpdateStages { + /** + * The stage of the DiscoveredAssetEndpointProfile 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); + } + + /** + * The stage of the DiscoveredAssetEndpointProfile update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(DiscoveredAssetEndpointProfileUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DiscoveredAssetEndpointProfile refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DiscoveredAssetEndpointProfile refresh(Context context); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfileProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfileProperties.java new file mode 100644 index 0000000000000..d6df4e63298dd --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfileProperties.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Defines the Discovered Asset Endpoint Profile properties. + */ +@Fluent +public final class DiscoveredAssetEndpointProfileProperties + implements JsonSerializable { + /* + * The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the + * targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector + * type specific configuration. + */ + private String targetAddress; + + /* + * Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + */ + private String additionalConfiguration; + + /* + * List of supported authentication methods supported by the target server. + */ + private List supportedAuthenticationMethods; + + /* + * Defines the configuration for the connector type that is being used with the endpoint profile. + */ + private String endpointProfileType; + + /* + * Identifier used to detect changes in the asset endpoint profile. + */ + private String discoveryId; + + /* + * An integer that is incremented each time the resource is modified. + */ + private long version; + + /* + * Provisioning state of the resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of DiscoveredAssetEndpointProfileProperties class. + */ + public DiscoveredAssetEndpointProfileProperties() { + } + + /** + * Get the targetAddress property: The local valid URI specifying the network address/DNS name of a southbound + * device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration + * field holds further connector type specific configuration. + * + * @return the targetAddress value. + */ + public String targetAddress() { + return this.targetAddress; + } + + /** + * Set the targetAddress property: The local valid URI specifying the network address/DNS name of a southbound + * device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration + * field holds further connector type specific configuration. + * + * @param targetAddress the targetAddress value to set. + * @return the DiscoveredAssetEndpointProfileProperties object itself. + */ + public DiscoveredAssetEndpointProfileProperties withTargetAddress(String targetAddress) { + this.targetAddress = targetAddress; + return this; + } + + /** + * Get the additionalConfiguration property: Stringified JSON that contains connectivity type specific further + * configuration (e.g. OPC UA, Modbus, ONVIF). + * + * @return the additionalConfiguration value. + */ + public String additionalConfiguration() { + return this.additionalConfiguration; + } + + /** + * Set the additionalConfiguration property: Stringified JSON that contains connectivity type specific further + * configuration (e.g. OPC UA, Modbus, ONVIF). + * + * @param additionalConfiguration the additionalConfiguration value to set. + * @return the DiscoveredAssetEndpointProfileProperties object itself. + */ + public DiscoveredAssetEndpointProfileProperties withAdditionalConfiguration(String additionalConfiguration) { + this.additionalConfiguration = additionalConfiguration; + return this; + } + + /** + * Get the supportedAuthenticationMethods property: List of supported authentication methods supported by the target + * server. + * + * @return the supportedAuthenticationMethods value. + */ + public List supportedAuthenticationMethods() { + return this.supportedAuthenticationMethods; + } + + /** + * Set the supportedAuthenticationMethods property: List of supported authentication methods supported by the target + * server. + * + * @param supportedAuthenticationMethods the supportedAuthenticationMethods value to set. + * @return the DiscoveredAssetEndpointProfileProperties object itself. + */ + public DiscoveredAssetEndpointProfileProperties + withSupportedAuthenticationMethods(List supportedAuthenticationMethods) { + this.supportedAuthenticationMethods = supportedAuthenticationMethods; + return this; + } + + /** + * Get the endpointProfileType property: Defines the configuration for the connector type that is being used with + * the endpoint profile. + * + * @return the endpointProfileType value. + */ + public String endpointProfileType() { + return this.endpointProfileType; + } + + /** + * Set the endpointProfileType property: Defines the configuration for the connector type that is being used with + * the endpoint profile. + * + * @param endpointProfileType the endpointProfileType value to set. + * @return the DiscoveredAssetEndpointProfileProperties object itself. + */ + public DiscoveredAssetEndpointProfileProperties withEndpointProfileType(String endpointProfileType) { + this.endpointProfileType = endpointProfileType; + return this; + } + + /** + * Get the discoveryId property: Identifier used to detect changes in the asset endpoint profile. + * + * @return the discoveryId value. + */ + public String discoveryId() { + return this.discoveryId; + } + + /** + * Set the discoveryId property: Identifier used to detect changes in the asset endpoint profile. + * + * @param discoveryId the discoveryId value to set. + * @return the DiscoveredAssetEndpointProfileProperties object itself. + */ + public DiscoveredAssetEndpointProfileProperties withDiscoveryId(String discoveryId) { + this.discoveryId = discoveryId; + return this; + } + + /** + * Get the version property: An integer that is incremented each time the resource is modified. + * + * @return the version value. + */ + public long version() { + return this.version; + } + + /** + * Set the version property: An integer that is incremented each time the resource is modified. + * + * @param version the version value to set. + * @return the DiscoveredAssetEndpointProfileProperties object itself. + */ + public DiscoveredAssetEndpointProfileProperties withVersion(long version) { + this.version = version; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @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 (targetAddress() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property targetAddress in model DiscoveredAssetEndpointProfileProperties")); + } + if (endpointProfileType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property endpointProfileType in model DiscoveredAssetEndpointProfileProperties")); + } + if (discoveryId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property discoveryId in model DiscoveredAssetEndpointProfileProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoveredAssetEndpointProfileProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetAddress", this.targetAddress); + jsonWriter.writeStringField("endpointProfileType", this.endpointProfileType); + jsonWriter.writeStringField("discoveryId", this.discoveryId); + jsonWriter.writeLongField("version", this.version); + jsonWriter.writeStringField("additionalConfiguration", this.additionalConfiguration); + jsonWriter.writeArrayField("supportedAuthenticationMethods", this.supportedAuthenticationMethods, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredAssetEndpointProfileProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredAssetEndpointProfileProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscoveredAssetEndpointProfileProperties. + */ + public static DiscoveredAssetEndpointProfileProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredAssetEndpointProfileProperties deserializedDiscoveredAssetEndpointProfileProperties + = new DiscoveredAssetEndpointProfileProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetAddress".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileProperties.targetAddress = reader.getString(); + } else if ("endpointProfileType".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileProperties.endpointProfileType = reader.getString(); + } else if ("discoveryId".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileProperties.discoveryId = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileProperties.version = reader.getLong(); + } else if ("additionalConfiguration".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileProperties.additionalConfiguration = reader.getString(); + } else if ("supportedAuthenticationMethods".equals(fieldName)) { + List supportedAuthenticationMethods + = reader.readArray(reader1 -> AuthenticationMethod.fromString(reader1.getString())); + deserializedDiscoveredAssetEndpointProfileProperties.supportedAuthenticationMethods + = supportedAuthenticationMethods; + } else if ("provisioningState".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredAssetEndpointProfileProperties; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfileUpdate.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfileUpdate.java new file mode 100644 index 0000000000000..7391068cc5527 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfileUpdate.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for update operations of the DiscoveredAssetEndpointProfile. + */ +@Fluent +public final class DiscoveredAssetEndpointProfileUpdate + implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * The resource-specific properties for this resource. + */ + private DiscoveredAssetEndpointProfileUpdateProperties properties; + + /** + * Creates an instance of DiscoveredAssetEndpointProfileUpdate class. + */ + public DiscoveredAssetEndpointProfileUpdate() { + } + + /** + * 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 DiscoveredAssetEndpointProfileUpdate object itself. + */ + public DiscoveredAssetEndpointProfileUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public DiscoveredAssetEndpointProfileUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the DiscoveredAssetEndpointProfileUpdate object itself. + */ + public DiscoveredAssetEndpointProfileUpdate + withProperties(DiscoveredAssetEndpointProfileUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredAssetEndpointProfileUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredAssetEndpointProfileUpdate if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DiscoveredAssetEndpointProfileUpdate. + */ + public static DiscoveredAssetEndpointProfileUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredAssetEndpointProfileUpdate deserializedDiscoveredAssetEndpointProfileUpdate + = new DiscoveredAssetEndpointProfileUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDiscoveredAssetEndpointProfileUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileUpdate.properties + = DiscoveredAssetEndpointProfileUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredAssetEndpointProfileUpdate; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfileUpdateProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfileUpdateProperties.java new file mode 100644 index 0000000000000..9fbf0c0410ff9 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfileUpdateProperties.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The updatable properties of the DiscoveredAssetEndpointProfile. + */ +@Fluent +public final class DiscoveredAssetEndpointProfileUpdateProperties + implements JsonSerializable { + /* + * The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the + * targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector + * type specific configuration. + */ + private String targetAddress; + + /* + * Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + */ + private String additionalConfiguration; + + /* + * List of supported authentication methods supported by the target server. + */ + private List supportedAuthenticationMethods; + + /* + * Defines the configuration for the connector type that is being used with the endpoint profile. + */ + private String endpointProfileType; + + /* + * Identifier used to detect changes in the asset endpoint profile. + */ + private String discoveryId; + + /* + * An integer that is incremented each time the resource is modified. + */ + private Long version; + + /** + * Creates an instance of DiscoveredAssetEndpointProfileUpdateProperties class. + */ + public DiscoveredAssetEndpointProfileUpdateProperties() { + } + + /** + * Get the targetAddress property: The local valid URI specifying the network address/DNS name of a southbound + * device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration + * field holds further connector type specific configuration. + * + * @return the targetAddress value. + */ + public String targetAddress() { + return this.targetAddress; + } + + /** + * Set the targetAddress property: The local valid URI specifying the network address/DNS name of a southbound + * device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration + * field holds further connector type specific configuration. + * + * @param targetAddress the targetAddress value to set. + * @return the DiscoveredAssetEndpointProfileUpdateProperties object itself. + */ + public DiscoveredAssetEndpointProfileUpdateProperties withTargetAddress(String targetAddress) { + this.targetAddress = targetAddress; + return this; + } + + /** + * Get the additionalConfiguration property: Stringified JSON that contains connectivity type specific further + * configuration (e.g. OPC UA, Modbus, ONVIF). + * + * @return the additionalConfiguration value. + */ + public String additionalConfiguration() { + return this.additionalConfiguration; + } + + /** + * Set the additionalConfiguration property: Stringified JSON that contains connectivity type specific further + * configuration (e.g. OPC UA, Modbus, ONVIF). + * + * @param additionalConfiguration the additionalConfiguration value to set. + * @return the DiscoveredAssetEndpointProfileUpdateProperties object itself. + */ + public DiscoveredAssetEndpointProfileUpdateProperties withAdditionalConfiguration(String additionalConfiguration) { + this.additionalConfiguration = additionalConfiguration; + return this; + } + + /** + * Get the supportedAuthenticationMethods property: List of supported authentication methods supported by the target + * server. + * + * @return the supportedAuthenticationMethods value. + */ + public List supportedAuthenticationMethods() { + return this.supportedAuthenticationMethods; + } + + /** + * Set the supportedAuthenticationMethods property: List of supported authentication methods supported by the target + * server. + * + * @param supportedAuthenticationMethods the supportedAuthenticationMethods value to set. + * @return the DiscoveredAssetEndpointProfileUpdateProperties object itself. + */ + public DiscoveredAssetEndpointProfileUpdateProperties + withSupportedAuthenticationMethods(List supportedAuthenticationMethods) { + this.supportedAuthenticationMethods = supportedAuthenticationMethods; + return this; + } + + /** + * Get the endpointProfileType property: Defines the configuration for the connector type that is being used with + * the endpoint profile. + * + * @return the endpointProfileType value. + */ + public String endpointProfileType() { + return this.endpointProfileType; + } + + /** + * Set the endpointProfileType property: Defines the configuration for the connector type that is being used with + * the endpoint profile. + * + * @param endpointProfileType the endpointProfileType value to set. + * @return the DiscoveredAssetEndpointProfileUpdateProperties object itself. + */ + public DiscoveredAssetEndpointProfileUpdateProperties withEndpointProfileType(String endpointProfileType) { + this.endpointProfileType = endpointProfileType; + return this; + } + + /** + * Get the discoveryId property: Identifier used to detect changes in the asset endpoint profile. + * + * @return the discoveryId value. + */ + public String discoveryId() { + return this.discoveryId; + } + + /** + * Set the discoveryId property: Identifier used to detect changes in the asset endpoint profile. + * + * @param discoveryId the discoveryId value to set. + * @return the DiscoveredAssetEndpointProfileUpdateProperties object itself. + */ + public DiscoveredAssetEndpointProfileUpdateProperties withDiscoveryId(String discoveryId) { + this.discoveryId = discoveryId; + return this; + } + + /** + * Get the version property: An integer that is incremented each time the resource is modified. + * + * @return the version value. + */ + public Long version() { + return this.version; + } + + /** + * Set the version property: An integer that is incremented each time the resource is modified. + * + * @param version the version value to set. + * @return the DiscoveredAssetEndpointProfileUpdateProperties object itself. + */ + public DiscoveredAssetEndpointProfileUpdateProperties withVersion(Long version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetAddress", this.targetAddress); + jsonWriter.writeStringField("additionalConfiguration", this.additionalConfiguration); + jsonWriter.writeArrayField("supportedAuthenticationMethods", this.supportedAuthenticationMethods, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("endpointProfileType", this.endpointProfileType); + jsonWriter.writeStringField("discoveryId", this.discoveryId); + jsonWriter.writeNumberField("version", this.version); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredAssetEndpointProfileUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredAssetEndpointProfileUpdateProperties if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DiscoveredAssetEndpointProfileUpdateProperties. + */ + public static DiscoveredAssetEndpointProfileUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredAssetEndpointProfileUpdateProperties deserializedDiscoveredAssetEndpointProfileUpdateProperties + = new DiscoveredAssetEndpointProfileUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetAddress".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileUpdateProperties.targetAddress = reader.getString(); + } else if ("additionalConfiguration".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileUpdateProperties.additionalConfiguration + = reader.getString(); + } else if ("supportedAuthenticationMethods".equals(fieldName)) { + List supportedAuthenticationMethods + = reader.readArray(reader1 -> AuthenticationMethod.fromString(reader1.getString())); + deserializedDiscoveredAssetEndpointProfileUpdateProperties.supportedAuthenticationMethods + = supportedAuthenticationMethods; + } else if ("endpointProfileType".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileUpdateProperties.endpointProfileType = reader.getString(); + } else if ("discoveryId".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileUpdateProperties.discoveryId = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedDiscoveredAssetEndpointProfileUpdateProperties.version + = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredAssetEndpointProfileUpdateProperties; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfiles.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfiles.java new file mode 100644 index 0000000000000..4743ca56ef099 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetEndpointProfiles.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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 DiscoveredAssetEndpointProfiles. + */ +public interface DiscoveredAssetEndpointProfiles { + /** + * Get a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 DiscoveredAssetEndpointProfile along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String discoveredAssetEndpointProfileName, Context context); + + /** + * Get a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 DiscoveredAssetEndpointProfile. + */ + DiscoveredAssetEndpointProfile getByResourceGroup(String resourceGroupName, + String discoveredAssetEndpointProfileName); + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 discoveredAssetEndpointProfileName); + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetEndpointProfileName Discovered Asset Endpoint Profile name parameter. + * @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 discoveredAssetEndpointProfileName, Context context); + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List DiscoveredAssetEndpointProfile 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 DiscoveredAssetEndpointProfile list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a DiscoveredAssetEndpointProfile. + * + * @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 DiscoveredAssetEndpointProfile along with {@link Response}. + */ + DiscoveredAssetEndpointProfile getById(String id); + + /** + * Get a DiscoveredAssetEndpointProfile. + * + * @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 DiscoveredAssetEndpointProfile along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a DiscoveredAssetEndpointProfile. + * + * @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 DiscoveredAssetEndpointProfile. + * + * @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 DiscoveredAssetEndpointProfile resource. + * + * @param name resource name. + * @return the first stage of the new DiscoveredAssetEndpointProfile definition. + */ + DiscoveredAssetEndpointProfile.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetProperties.java new file mode 100644 index 0000000000000..294db13d46128 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetProperties.java @@ -0,0 +1,571 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Defines the discovered asset properties. + */ +@Fluent +public final class DiscoveredAssetProperties implements JsonSerializable { + /* + * A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that + * provides data points for this asset. Must provide asset endpoint profile name. + */ + private String assetEndpointProfileRef; + + /* + * Identifier used to detect changes in the asset. + */ + private String discoveryId; + + /* + * An integer that is incremented each time the resource is modified. + */ + private long version; + + /* + * Asset manufacturer name. + */ + private String manufacturer; + + /* + * Asset manufacturer URI. + */ + private String manufacturerUri; + + /* + * Asset model name. + */ + private String model; + + /* + * Asset product code. + */ + private String productCode; + + /* + * Revision number of the hardware. + */ + private String hardwareRevision; + + /* + * Revision number of the software. + */ + private String softwareRevision; + + /* + * Reference to the documentation. + */ + private String documentationUri; + + /* + * Asset serial number. + */ + private String serialNumber; + + /* + * Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have + * its own configuration that overrides the default settings here. + */ + private String defaultDatasetsConfiguration; + + /* + * Stringified JSON that contains connector-specific default configuration for all events. Each event can have its + * own configuration that overrides the default settings here. + */ + private String defaultEventsConfiguration; + + /* + * Object that describes the default topic information for the asset. + */ + private Topic defaultTopic; + + /* + * Array of datasets that are part of the asset. Each dataset spec describes the data points that make up the set. + */ + private List datasets; + + /* + * Array of events that are part of the asset. Each event can have per-event configuration. + */ + private List events; + + /* + * Provisioning state of the resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of DiscoveredAssetProperties class. + */ + public DiscoveredAssetProperties() { + } + + /** + * Get the assetEndpointProfileRef property: A reference to the asset endpoint profile (connection information) used + * by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint + * profile name. + * + * @return the assetEndpointProfileRef value. + */ + public String assetEndpointProfileRef() { + return this.assetEndpointProfileRef; + } + + /** + * Set the assetEndpointProfileRef property: A reference to the asset endpoint profile (connection information) used + * by brokers to connect to an endpoint that provides data points for this asset. Must provide asset endpoint + * profile name. + * + * @param assetEndpointProfileRef the assetEndpointProfileRef value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withAssetEndpointProfileRef(String assetEndpointProfileRef) { + this.assetEndpointProfileRef = assetEndpointProfileRef; + return this; + } + + /** + * Get the discoveryId property: Identifier used to detect changes in the asset. + * + * @return the discoveryId value. + */ + public String discoveryId() { + return this.discoveryId; + } + + /** + * Set the discoveryId property: Identifier used to detect changes in the asset. + * + * @param discoveryId the discoveryId value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withDiscoveryId(String discoveryId) { + this.discoveryId = discoveryId; + return this; + } + + /** + * Get the version property: An integer that is incremented each time the resource is modified. + * + * @return the version value. + */ + public long version() { + return this.version; + } + + /** + * Set the version property: An integer that is incremented each time the resource is modified. + * + * @param version the version value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withVersion(long version) { + this.version = version; + return this; + } + + /** + * Get the manufacturer property: Asset manufacturer name. + * + * @return the manufacturer value. + */ + public String manufacturer() { + return this.manufacturer; + } + + /** + * Set the manufacturer property: Asset manufacturer name. + * + * @param manufacturer the manufacturer value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + return this; + } + + /** + * Get the manufacturerUri property: Asset manufacturer URI. + * + * @return the manufacturerUri value. + */ + public String manufacturerUri() { + return this.manufacturerUri; + } + + /** + * Set the manufacturerUri property: Asset manufacturer URI. + * + * @param manufacturerUri the manufacturerUri value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withManufacturerUri(String manufacturerUri) { + this.manufacturerUri = manufacturerUri; + return this; + } + + /** + * Get the model property: Asset model name. + * + * @return the model value. + */ + public String model() { + return this.model; + } + + /** + * Set the model property: Asset model name. + * + * @param model the model value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withModel(String model) { + this.model = model; + return this; + } + + /** + * Get the productCode property: Asset product code. + * + * @return the productCode value. + */ + public String productCode() { + return this.productCode; + } + + /** + * Set the productCode property: Asset product code. + * + * @param productCode the productCode value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withProductCode(String productCode) { + this.productCode = productCode; + return this; + } + + /** + * Get the hardwareRevision property: Revision number of the hardware. + * + * @return the hardwareRevision value. + */ + public String hardwareRevision() { + return this.hardwareRevision; + } + + /** + * Set the hardwareRevision property: Revision number of the hardware. + * + * @param hardwareRevision the hardwareRevision value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withHardwareRevision(String hardwareRevision) { + this.hardwareRevision = hardwareRevision; + return this; + } + + /** + * Get the softwareRevision property: Revision number of the software. + * + * @return the softwareRevision value. + */ + public String softwareRevision() { + return this.softwareRevision; + } + + /** + * Set the softwareRevision property: Revision number of the software. + * + * @param softwareRevision the softwareRevision value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withSoftwareRevision(String softwareRevision) { + this.softwareRevision = softwareRevision; + return this; + } + + /** + * Get the documentationUri property: Reference to the documentation. + * + * @return the documentationUri value. + */ + public String documentationUri() { + return this.documentationUri; + } + + /** + * Set the documentationUri property: Reference to the documentation. + * + * @param documentationUri the documentationUri value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withDocumentationUri(String documentationUri) { + this.documentationUri = documentationUri; + return this; + } + + /** + * Get the serialNumber property: Asset serial number. + * + * @return the serialNumber value. + */ + public String serialNumber() { + return this.serialNumber; + } + + /** + * Set the serialNumber property: Asset serial number. + * + * @param serialNumber the serialNumber value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withSerialNumber(String serialNumber) { + this.serialNumber = serialNumber; + return this; + } + + /** + * Get the defaultDatasetsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all datasets. Each dataset can have its own configuration that overrides the default settings + * here. + * + * @return the defaultDatasetsConfiguration value. + */ + public String defaultDatasetsConfiguration() { + return this.defaultDatasetsConfiguration; + } + + /** + * Set the defaultDatasetsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all datasets. Each dataset can have its own configuration that overrides the default settings + * here. + * + * @param defaultDatasetsConfiguration the defaultDatasetsConfiguration value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withDefaultDatasetsConfiguration(String defaultDatasetsConfiguration) { + this.defaultDatasetsConfiguration = defaultDatasetsConfiguration; + return this; + } + + /** + * Get the defaultEventsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all events. Each event can have its own configuration that overrides the default settings here. + * + * @return the defaultEventsConfiguration value. + */ + public String defaultEventsConfiguration() { + return this.defaultEventsConfiguration; + } + + /** + * Set the defaultEventsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all events. Each event can have its own configuration that overrides the default settings here. + * + * @param defaultEventsConfiguration the defaultEventsConfiguration value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withDefaultEventsConfiguration(String defaultEventsConfiguration) { + this.defaultEventsConfiguration = defaultEventsConfiguration; + return this; + } + + /** + * Get the defaultTopic property: Object that describes the default topic information for the asset. + * + * @return the defaultTopic value. + */ + public Topic defaultTopic() { + return this.defaultTopic; + } + + /** + * Set the defaultTopic property: Object that describes the default topic information for the asset. + * + * @param defaultTopic the defaultTopic value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withDefaultTopic(Topic defaultTopic) { + this.defaultTopic = defaultTopic; + return this; + } + + /** + * Get the datasets property: Array of datasets that are part of the asset. Each dataset spec describes the data + * points that make up the set. + * + * @return the datasets value. + */ + public List datasets() { + return this.datasets; + } + + /** + * Set the datasets property: Array of datasets that are part of the asset. Each dataset spec describes the data + * points that make up the set. + * + * @param datasets the datasets value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withDatasets(List datasets) { + this.datasets = datasets; + return this; + } + + /** + * Get the events property: Array of events that are part of the asset. Each event can have per-event configuration. + * + * @return the events value. + */ + public List events() { + return this.events; + } + + /** + * Set the events property: Array of events that are part of the asset. Each event can have per-event configuration. + * + * @param events the events value to set. + * @return the DiscoveredAssetProperties object itself. + */ + public DiscoveredAssetProperties withEvents(List events) { + this.events = events; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @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 (assetEndpointProfileRef() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property assetEndpointProfileRef in model DiscoveredAssetProperties")); + } + if (discoveryId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property discoveryId in model DiscoveredAssetProperties")); + } + if (defaultTopic() != null) { + defaultTopic().validate(); + } + if (datasets() != null) { + datasets().forEach(e -> e.validate()); + } + if (events() != null) { + events().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoveredAssetProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("assetEndpointProfileRef", this.assetEndpointProfileRef); + jsonWriter.writeStringField("discoveryId", this.discoveryId); + jsonWriter.writeLongField("version", this.version); + jsonWriter.writeStringField("manufacturer", this.manufacturer); + jsonWriter.writeStringField("manufacturerUri", this.manufacturerUri); + jsonWriter.writeStringField("model", this.model); + jsonWriter.writeStringField("productCode", this.productCode); + jsonWriter.writeStringField("hardwareRevision", this.hardwareRevision); + jsonWriter.writeStringField("softwareRevision", this.softwareRevision); + jsonWriter.writeStringField("documentationUri", this.documentationUri); + jsonWriter.writeStringField("serialNumber", this.serialNumber); + jsonWriter.writeStringField("defaultDatasetsConfiguration", this.defaultDatasetsConfiguration); + jsonWriter.writeStringField("defaultEventsConfiguration", this.defaultEventsConfiguration); + jsonWriter.writeJsonField("defaultTopic", this.defaultTopic); + jsonWriter.writeArrayField("datasets", this.datasets, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("events", this.events, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredAssetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredAssetProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscoveredAssetProperties. + */ + public static DiscoveredAssetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredAssetProperties deserializedDiscoveredAssetProperties = new DiscoveredAssetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assetEndpointProfileRef".equals(fieldName)) { + deserializedDiscoveredAssetProperties.assetEndpointProfileRef = reader.getString(); + } else if ("discoveryId".equals(fieldName)) { + deserializedDiscoveredAssetProperties.discoveryId = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedDiscoveredAssetProperties.version = reader.getLong(); + } else if ("manufacturer".equals(fieldName)) { + deserializedDiscoveredAssetProperties.manufacturer = reader.getString(); + } else if ("manufacturerUri".equals(fieldName)) { + deserializedDiscoveredAssetProperties.manufacturerUri = reader.getString(); + } else if ("model".equals(fieldName)) { + deserializedDiscoveredAssetProperties.model = reader.getString(); + } else if ("productCode".equals(fieldName)) { + deserializedDiscoveredAssetProperties.productCode = reader.getString(); + } else if ("hardwareRevision".equals(fieldName)) { + deserializedDiscoveredAssetProperties.hardwareRevision = reader.getString(); + } else if ("softwareRevision".equals(fieldName)) { + deserializedDiscoveredAssetProperties.softwareRevision = reader.getString(); + } else if ("documentationUri".equals(fieldName)) { + deserializedDiscoveredAssetProperties.documentationUri = reader.getString(); + } else if ("serialNumber".equals(fieldName)) { + deserializedDiscoveredAssetProperties.serialNumber = reader.getString(); + } else if ("defaultDatasetsConfiguration".equals(fieldName)) { + deserializedDiscoveredAssetProperties.defaultDatasetsConfiguration = reader.getString(); + } else if ("defaultEventsConfiguration".equals(fieldName)) { + deserializedDiscoveredAssetProperties.defaultEventsConfiguration = reader.getString(); + } else if ("defaultTopic".equals(fieldName)) { + deserializedDiscoveredAssetProperties.defaultTopic = Topic.fromJson(reader); + } else if ("datasets".equals(fieldName)) { + List datasets = reader.readArray(reader1 -> DiscoveredDataset.fromJson(reader1)); + deserializedDiscoveredAssetProperties.datasets = datasets; + } else if ("events".equals(fieldName)) { + List events = reader.readArray(reader1 -> DiscoveredEvent.fromJson(reader1)); + deserializedDiscoveredAssetProperties.events = events; + } else if ("provisioningState".equals(fieldName)) { + deserializedDiscoveredAssetProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredAssetProperties; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetUpdate.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetUpdate.java new file mode 100644 index 0000000000000..916b32492f3ec --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetUpdate.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for update operations of the DiscoveredAsset. + */ +@Fluent +public final class DiscoveredAssetUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * The resource-specific properties for this resource. + */ + private DiscoveredAssetUpdateProperties properties; + + /** + * Creates an instance of DiscoveredAssetUpdate class. + */ + public DiscoveredAssetUpdate() { + } + + /** + * 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 DiscoveredAssetUpdate object itself. + */ + public DiscoveredAssetUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public DiscoveredAssetUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the DiscoveredAssetUpdate object itself. + */ + public DiscoveredAssetUpdate withProperties(DiscoveredAssetUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredAssetUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredAssetUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DiscoveredAssetUpdate. + */ + public static DiscoveredAssetUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredAssetUpdate deserializedDiscoveredAssetUpdate = new DiscoveredAssetUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDiscoveredAssetUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedDiscoveredAssetUpdate.properties = DiscoveredAssetUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredAssetUpdate; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetUpdateProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetUpdateProperties.java new file mode 100644 index 0000000000000..a7cffab66be8b --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssetUpdateProperties.java @@ -0,0 +1,508 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The updatable properties of the DiscoveredAsset. + */ +@Fluent +public final class DiscoveredAssetUpdateProperties implements JsonSerializable { + /* + * Identifier used to detect changes in the asset. + */ + private String discoveryId; + + /* + * An integer that is incremented each time the resource is modified. + */ + private Long version; + + /* + * Asset manufacturer name. + */ + private String manufacturer; + + /* + * Asset manufacturer URI. + */ + private String manufacturerUri; + + /* + * Asset model name. + */ + private String model; + + /* + * Asset product code. + */ + private String productCode; + + /* + * Revision number of the hardware. + */ + private String hardwareRevision; + + /* + * Revision number of the software. + */ + private String softwareRevision; + + /* + * Reference to the documentation. + */ + private String documentationUri; + + /* + * Asset serial number. + */ + private String serialNumber; + + /* + * Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have + * its own configuration that overrides the default settings here. + */ + private String defaultDatasetsConfiguration; + + /* + * Stringified JSON that contains connector-specific default configuration for all events. Each event can have its + * own configuration that overrides the default settings here. + */ + private String defaultEventsConfiguration; + + /* + * Object that describes the default topic information for the asset. + */ + private Topic defaultTopic; + + /* + * Array of datasets that are part of the asset. Each dataset spec describes the data points that make up the set. + */ + private List datasets; + + /* + * Array of events that are part of the asset. Each event can have per-event configuration. + */ + private List events; + + /** + * Creates an instance of DiscoveredAssetUpdateProperties class. + */ + public DiscoveredAssetUpdateProperties() { + } + + /** + * Get the discoveryId property: Identifier used to detect changes in the asset. + * + * @return the discoveryId value. + */ + public String discoveryId() { + return this.discoveryId; + } + + /** + * Set the discoveryId property: Identifier used to detect changes in the asset. + * + * @param discoveryId the discoveryId value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withDiscoveryId(String discoveryId) { + this.discoveryId = discoveryId; + return this; + } + + /** + * Get the version property: An integer that is incremented each time the resource is modified. + * + * @return the version value. + */ + public Long version() { + return this.version; + } + + /** + * Set the version property: An integer that is incremented each time the resource is modified. + * + * @param version the version value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withVersion(Long version) { + this.version = version; + return this; + } + + /** + * Get the manufacturer property: Asset manufacturer name. + * + * @return the manufacturer value. + */ + public String manufacturer() { + return this.manufacturer; + } + + /** + * Set the manufacturer property: Asset manufacturer name. + * + * @param manufacturer the manufacturer value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + return this; + } + + /** + * Get the manufacturerUri property: Asset manufacturer URI. + * + * @return the manufacturerUri value. + */ + public String manufacturerUri() { + return this.manufacturerUri; + } + + /** + * Set the manufacturerUri property: Asset manufacturer URI. + * + * @param manufacturerUri the manufacturerUri value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withManufacturerUri(String manufacturerUri) { + this.manufacturerUri = manufacturerUri; + return this; + } + + /** + * Get the model property: Asset model name. + * + * @return the model value. + */ + public String model() { + return this.model; + } + + /** + * Set the model property: Asset model name. + * + * @param model the model value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withModel(String model) { + this.model = model; + return this; + } + + /** + * Get the productCode property: Asset product code. + * + * @return the productCode value. + */ + public String productCode() { + return this.productCode; + } + + /** + * Set the productCode property: Asset product code. + * + * @param productCode the productCode value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withProductCode(String productCode) { + this.productCode = productCode; + return this; + } + + /** + * Get the hardwareRevision property: Revision number of the hardware. + * + * @return the hardwareRevision value. + */ + public String hardwareRevision() { + return this.hardwareRevision; + } + + /** + * Set the hardwareRevision property: Revision number of the hardware. + * + * @param hardwareRevision the hardwareRevision value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withHardwareRevision(String hardwareRevision) { + this.hardwareRevision = hardwareRevision; + return this; + } + + /** + * Get the softwareRevision property: Revision number of the software. + * + * @return the softwareRevision value. + */ + public String softwareRevision() { + return this.softwareRevision; + } + + /** + * Set the softwareRevision property: Revision number of the software. + * + * @param softwareRevision the softwareRevision value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withSoftwareRevision(String softwareRevision) { + this.softwareRevision = softwareRevision; + return this; + } + + /** + * Get the documentationUri property: Reference to the documentation. + * + * @return the documentationUri value. + */ + public String documentationUri() { + return this.documentationUri; + } + + /** + * Set the documentationUri property: Reference to the documentation. + * + * @param documentationUri the documentationUri value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withDocumentationUri(String documentationUri) { + this.documentationUri = documentationUri; + return this; + } + + /** + * Get the serialNumber property: Asset serial number. + * + * @return the serialNumber value. + */ + public String serialNumber() { + return this.serialNumber; + } + + /** + * Set the serialNumber property: Asset serial number. + * + * @param serialNumber the serialNumber value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withSerialNumber(String serialNumber) { + this.serialNumber = serialNumber; + return this; + } + + /** + * Get the defaultDatasetsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all datasets. Each dataset can have its own configuration that overrides the default settings + * here. + * + * @return the defaultDatasetsConfiguration value. + */ + public String defaultDatasetsConfiguration() { + return this.defaultDatasetsConfiguration; + } + + /** + * Set the defaultDatasetsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all datasets. Each dataset can have its own configuration that overrides the default settings + * here. + * + * @param defaultDatasetsConfiguration the defaultDatasetsConfiguration value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withDefaultDatasetsConfiguration(String defaultDatasetsConfiguration) { + this.defaultDatasetsConfiguration = defaultDatasetsConfiguration; + return this; + } + + /** + * Get the defaultEventsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all events. Each event can have its own configuration that overrides the default settings here. + * + * @return the defaultEventsConfiguration value. + */ + public String defaultEventsConfiguration() { + return this.defaultEventsConfiguration; + } + + /** + * Set the defaultEventsConfiguration property: Stringified JSON that contains connector-specific default + * configuration for all events. Each event can have its own configuration that overrides the default settings here. + * + * @param defaultEventsConfiguration the defaultEventsConfiguration value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withDefaultEventsConfiguration(String defaultEventsConfiguration) { + this.defaultEventsConfiguration = defaultEventsConfiguration; + return this; + } + + /** + * Get the defaultTopic property: Object that describes the default topic information for the asset. + * + * @return the defaultTopic value. + */ + public Topic defaultTopic() { + return this.defaultTopic; + } + + /** + * Set the defaultTopic property: Object that describes the default topic information for the asset. + * + * @param defaultTopic the defaultTopic value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withDefaultTopic(Topic defaultTopic) { + this.defaultTopic = defaultTopic; + return this; + } + + /** + * Get the datasets property: Array of datasets that are part of the asset. Each dataset spec describes the data + * points that make up the set. + * + * @return the datasets value. + */ + public List datasets() { + return this.datasets; + } + + /** + * Set the datasets property: Array of datasets that are part of the asset. Each dataset spec describes the data + * points that make up the set. + * + * @param datasets the datasets value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withDatasets(List datasets) { + this.datasets = datasets; + return this; + } + + /** + * Get the events property: Array of events that are part of the asset. Each event can have per-event configuration. + * + * @return the events value. + */ + public List events() { + return this.events; + } + + /** + * Set the events property: Array of events that are part of the asset. Each event can have per-event configuration. + * + * @param events the events value to set. + * @return the DiscoveredAssetUpdateProperties object itself. + */ + public DiscoveredAssetUpdateProperties withEvents(List events) { + this.events = events; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (defaultTopic() != null) { + defaultTopic().validate(); + } + if (datasets() != null) { + datasets().forEach(e -> e.validate()); + } + if (events() != null) { + events().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("discoveryId", this.discoveryId); + jsonWriter.writeNumberField("version", this.version); + jsonWriter.writeStringField("manufacturer", this.manufacturer); + jsonWriter.writeStringField("manufacturerUri", this.manufacturerUri); + jsonWriter.writeStringField("model", this.model); + jsonWriter.writeStringField("productCode", this.productCode); + jsonWriter.writeStringField("hardwareRevision", this.hardwareRevision); + jsonWriter.writeStringField("softwareRevision", this.softwareRevision); + jsonWriter.writeStringField("documentationUri", this.documentationUri); + jsonWriter.writeStringField("serialNumber", this.serialNumber); + jsonWriter.writeStringField("defaultDatasetsConfiguration", this.defaultDatasetsConfiguration); + jsonWriter.writeStringField("defaultEventsConfiguration", this.defaultEventsConfiguration); + jsonWriter.writeJsonField("defaultTopic", this.defaultTopic); + jsonWriter.writeArrayField("datasets", this.datasets, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("events", this.events, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredAssetUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredAssetUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DiscoveredAssetUpdateProperties. + */ + public static DiscoveredAssetUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredAssetUpdateProperties deserializedDiscoveredAssetUpdateProperties + = new DiscoveredAssetUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("discoveryId".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.discoveryId = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.version = reader.getNullable(JsonReader::getLong); + } else if ("manufacturer".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.manufacturer = reader.getString(); + } else if ("manufacturerUri".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.manufacturerUri = reader.getString(); + } else if ("model".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.model = reader.getString(); + } else if ("productCode".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.productCode = reader.getString(); + } else if ("hardwareRevision".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.hardwareRevision = reader.getString(); + } else if ("softwareRevision".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.softwareRevision = reader.getString(); + } else if ("documentationUri".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.documentationUri = reader.getString(); + } else if ("serialNumber".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.serialNumber = reader.getString(); + } else if ("defaultDatasetsConfiguration".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.defaultDatasetsConfiguration = reader.getString(); + } else if ("defaultEventsConfiguration".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.defaultEventsConfiguration = reader.getString(); + } else if ("defaultTopic".equals(fieldName)) { + deserializedDiscoveredAssetUpdateProperties.defaultTopic = Topic.fromJson(reader); + } else if ("datasets".equals(fieldName)) { + List datasets = reader.readArray(reader1 -> DiscoveredDataset.fromJson(reader1)); + deserializedDiscoveredAssetUpdateProperties.datasets = datasets; + } else if ("events".equals(fieldName)) { + List events = reader.readArray(reader1 -> DiscoveredEvent.fromJson(reader1)); + deserializedDiscoveredAssetUpdateProperties.events = events; + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredAssetUpdateProperties; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssets.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssets.java new file mode 100644 index 0000000000000..b573d15f12689 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredAssets.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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 DiscoveredAssets. + */ +public interface DiscoveredAssets { + /** + * Get a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 DiscoveredAsset along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String discoveredAssetName, + Context context); + + /** + * Get a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 DiscoveredAsset. + */ + DiscoveredAsset getByResourceGroup(String resourceGroupName, String discoveredAssetName); + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 discoveredAssetName); + + /** + * Delete a DiscoveredAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param discoveredAssetName Discovered Asset name parameter. + * @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 discoveredAssetName, Context context); + + /** + * List DiscoveredAsset 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 DiscoveredAsset list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List DiscoveredAsset 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 DiscoveredAsset list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List DiscoveredAsset 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 DiscoveredAsset list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List DiscoveredAsset 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 DiscoveredAsset list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a DiscoveredAsset. + * + * @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 DiscoveredAsset along with {@link Response}. + */ + DiscoveredAsset getById(String id); + + /** + * Get a DiscoveredAsset. + * + * @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 DiscoveredAsset along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a DiscoveredAsset. + * + * @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 DiscoveredAsset. + * + * @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 DiscoveredAsset resource. + * + * @param name resource name. + * @return the first stage of the new DiscoveredAsset definition. + */ + DiscoveredAsset.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredDataPoint.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredDataPoint.java new file mode 100644 index 0000000000000..bf5234410ffda --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredDataPoint.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Defines the data point properties. + */ +@Fluent +public final class DiscoveredDataPoint implements JsonSerializable { + /* + * The name of the data point. + */ + private String name; + + /* + * The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on the + * asset. + */ + private String dataSource; + + /* + * Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, this could + * include configuration like, publishingInterval, samplingInterval, and queueSize. + */ + private String dataPointConfiguration; + + /* + * UTC timestamp indicating when the data point was added or modified. + */ + private OffsetDateTime lastUpdatedOn; + + /** + * Creates an instance of DiscoveredDataPoint class. + */ + public DiscoveredDataPoint() { + } + + /** + * Get the name property: The name of the data point. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the data point. + * + * @param name the name value to set. + * @return the DiscoveredDataPoint object itself. + */ + public DiscoveredDataPoint withName(String name) { + this.name = name; + return this; + } + + /** + * Get the dataSource property: The address of the source of the data in the asset (e.g. URL) so that a client can + * access the data source on the asset. + * + * @return the dataSource value. + */ + public String dataSource() { + return this.dataSource; + } + + /** + * Set the dataSource property: The address of the source of the data in the asset (e.g. URL) so that a client can + * access the data source on the asset. + * + * @param dataSource the dataSource value to set. + * @return the DiscoveredDataPoint object itself. + */ + public DiscoveredDataPoint withDataSource(String dataSource) { + this.dataSource = dataSource; + return this; + } + + /** + * Get the dataPointConfiguration property: Stringified JSON that contains connector-specific configuration for the + * data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and + * queueSize. + * + * @return the dataPointConfiguration value. + */ + public String dataPointConfiguration() { + return this.dataPointConfiguration; + } + + /** + * Set the dataPointConfiguration property: Stringified JSON that contains connector-specific configuration for the + * data point. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and + * queueSize. + * + * @param dataPointConfiguration the dataPointConfiguration value to set. + * @return the DiscoveredDataPoint object itself. + */ + public DiscoveredDataPoint withDataPointConfiguration(String dataPointConfiguration) { + this.dataPointConfiguration = dataPointConfiguration; + return this; + } + + /** + * Get the lastUpdatedOn property: UTC timestamp indicating when the data point was added or modified. + * + * @return the lastUpdatedOn value. + */ + public OffsetDateTime lastUpdatedOn() { + return this.lastUpdatedOn; + } + + /** + * Set the lastUpdatedOn property: UTC timestamp indicating when the data point was added or modified. + * + * @param lastUpdatedOn the lastUpdatedOn value to set. + * @return the DiscoveredDataPoint object itself. + */ + public DiscoveredDataPoint withLastUpdatedOn(OffsetDateTime lastUpdatedOn) { + this.lastUpdatedOn = lastUpdatedOn; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model DiscoveredDataPoint")); + } + if (dataSource() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property dataSource in model DiscoveredDataPoint")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoveredDataPoint.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("dataSource", this.dataSource); + jsonWriter.writeStringField("dataPointConfiguration", this.dataPointConfiguration); + jsonWriter.writeStringField("lastUpdatedOn", + this.lastUpdatedOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdatedOn)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredDataPoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredDataPoint if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscoveredDataPoint. + */ + public static DiscoveredDataPoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredDataPoint deserializedDiscoveredDataPoint = new DiscoveredDataPoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDiscoveredDataPoint.name = reader.getString(); + } else if ("dataSource".equals(fieldName)) { + deserializedDiscoveredDataPoint.dataSource = reader.getString(); + } else if ("dataPointConfiguration".equals(fieldName)) { + deserializedDiscoveredDataPoint.dataPointConfiguration = reader.getString(); + } else if ("lastUpdatedOn".equals(fieldName)) { + deserializedDiscoveredDataPoint.lastUpdatedOn = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredDataPoint; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredDataset.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredDataset.java new file mode 100644 index 0000000000000..fd0d627590b48 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredDataset.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Defines the dataset properties. + */ +@Fluent +public final class DiscoveredDataset implements JsonSerializable { + /* + * Name of the dataset. + */ + private String name; + + /* + * Stringified JSON that contains connector-specific properties that describes configuration for the specific + * dataset. + */ + private String datasetConfiguration; + + /* + * Object that describes the topic information for the specific dataset. + */ + private Topic topic; + + /* + * Array of data points that are part of the dataset. Each data point can have per-data point configuration. + */ + private List dataPoints; + + /** + * Creates an instance of DiscoveredDataset class. + */ + public DiscoveredDataset() { + } + + /** + * Get the name property: Name of the dataset. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the dataset. + * + * @param name the name value to set. + * @return the DiscoveredDataset object itself. + */ + public DiscoveredDataset withName(String name) { + this.name = name; + return this; + } + + /** + * Get the datasetConfiguration property: Stringified JSON that contains connector-specific properties that + * describes configuration for the specific dataset. + * + * @return the datasetConfiguration value. + */ + public String datasetConfiguration() { + return this.datasetConfiguration; + } + + /** + * Set the datasetConfiguration property: Stringified JSON that contains connector-specific properties that + * describes configuration for the specific dataset. + * + * @param datasetConfiguration the datasetConfiguration value to set. + * @return the DiscoveredDataset object itself. + */ + public DiscoveredDataset withDatasetConfiguration(String datasetConfiguration) { + this.datasetConfiguration = datasetConfiguration; + return this; + } + + /** + * Get the topic property: Object that describes the topic information for the specific dataset. + * + * @return the topic value. + */ + public Topic topic() { + return this.topic; + } + + /** + * Set the topic property: Object that describes the topic information for the specific dataset. + * + * @param topic the topic value to set. + * @return the DiscoveredDataset object itself. + */ + public DiscoveredDataset withTopic(Topic topic) { + this.topic = topic; + return this; + } + + /** + * Get the dataPoints property: Array of data points that are part of the dataset. Each data point can have per-data + * point configuration. + * + * @return the dataPoints value. + */ + public List dataPoints() { + return this.dataPoints; + } + + /** + * Set the dataPoints property: Array of data points that are part of the dataset. Each data point can have per-data + * point configuration. + * + * @param dataPoints the dataPoints value to set. + * @return the DiscoveredDataset object itself. + */ + public DiscoveredDataset withDataPoints(List dataPoints) { + this.dataPoints = dataPoints; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model DiscoveredDataset")); + } + if (topic() != null) { + topic().validate(); + } + if (dataPoints() != null) { + dataPoints().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoveredDataset.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("datasetConfiguration", this.datasetConfiguration); + jsonWriter.writeJsonField("topic", this.topic); + jsonWriter.writeArrayField("dataPoints", this.dataPoints, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredDataset from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredDataset if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscoveredDataset. + */ + public static DiscoveredDataset fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredDataset deserializedDiscoveredDataset = new DiscoveredDataset(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDiscoveredDataset.name = reader.getString(); + } else if ("datasetConfiguration".equals(fieldName)) { + deserializedDiscoveredDataset.datasetConfiguration = reader.getString(); + } else if ("topic".equals(fieldName)) { + deserializedDiscoveredDataset.topic = Topic.fromJson(reader); + } else if ("dataPoints".equals(fieldName)) { + List dataPoints + = reader.readArray(reader1 -> DiscoveredDataPoint.fromJson(reader1)); + deserializedDiscoveredDataset.dataPoints = dataPoints; + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredDataset; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredEvent.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredEvent.java new file mode 100644 index 0000000000000..1a8a4f07f1dc6 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/DiscoveredEvent.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Defines the event properties. + */ +@Fluent +public final class DiscoveredEvent implements JsonSerializable { + /* + * The name of the event. + */ + private String name; + + /* + * The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the + * asset. + */ + private String eventNotifier; + + /* + * Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this could include + * configuration like, publishingInterval, samplingInterval, and queueSize. + */ + private String eventConfiguration; + + /* + * Object that describes the topic information for the specific event. + */ + private Topic topic; + + /* + * UTC timestamp indicating when the event was added or modified. + */ + private OffsetDateTime lastUpdatedOn; + + /** + * Creates an instance of DiscoveredEvent class. + */ + public DiscoveredEvent() { + } + + /** + * Get the name property: The name of the event. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the event. + * + * @param name the name value to set. + * @return the DiscoveredEvent object itself. + */ + public DiscoveredEvent withName(String name) { + this.name = name; + return this; + } + + /** + * Get the eventNotifier property: The address of the notifier of the event in the asset (e.g. URL) so that a client + * can access the event on the asset. + * + * @return the eventNotifier value. + */ + public String eventNotifier() { + return this.eventNotifier; + } + + /** + * Set the eventNotifier property: The address of the notifier of the event in the asset (e.g. URL) so that a client + * can access the event on the asset. + * + * @param eventNotifier the eventNotifier value to set. + * @return the DiscoveredEvent object itself. + */ + public DiscoveredEvent withEventNotifier(String eventNotifier) { + this.eventNotifier = eventNotifier; + return this; + } + + /** + * Get the eventConfiguration property: Stringified JSON that contains connector-specific configuration for the + * event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + * + * @return the eventConfiguration value. + */ + public String eventConfiguration() { + return this.eventConfiguration; + } + + /** + * Set the eventConfiguration property: Stringified JSON that contains connector-specific configuration for the + * event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + * + * @param eventConfiguration the eventConfiguration value to set. + * @return the DiscoveredEvent object itself. + */ + public DiscoveredEvent withEventConfiguration(String eventConfiguration) { + this.eventConfiguration = eventConfiguration; + return this; + } + + /** + * Get the topic property: Object that describes the topic information for the specific event. + * + * @return the topic value. + */ + public Topic topic() { + return this.topic; + } + + /** + * Set the topic property: Object that describes the topic information for the specific event. + * + * @param topic the topic value to set. + * @return the DiscoveredEvent object itself. + */ + public DiscoveredEvent withTopic(Topic topic) { + this.topic = topic; + return this; + } + + /** + * Get the lastUpdatedOn property: UTC timestamp indicating when the event was added or modified. + * + * @return the lastUpdatedOn value. + */ + public OffsetDateTime lastUpdatedOn() { + return this.lastUpdatedOn; + } + + /** + * Set the lastUpdatedOn property: UTC timestamp indicating when the event was added or modified. + * + * @param lastUpdatedOn the lastUpdatedOn value to set. + * @return the DiscoveredEvent object itself. + */ + public DiscoveredEvent withLastUpdatedOn(OffsetDateTime lastUpdatedOn) { + this.lastUpdatedOn = lastUpdatedOn; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model DiscoveredEvent")); + } + if (eventNotifier() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property eventNotifier in model DiscoveredEvent")); + } + if (topic() != null) { + topic().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoveredEvent.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("eventNotifier", this.eventNotifier); + jsonWriter.writeStringField("eventConfiguration", this.eventConfiguration); + jsonWriter.writeJsonField("topic", this.topic); + jsonWriter.writeStringField("lastUpdatedOn", + this.lastUpdatedOn == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdatedOn)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveredEvent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveredEvent if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscoveredEvent. + */ + public static DiscoveredEvent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveredEvent deserializedDiscoveredEvent = new DiscoveredEvent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedDiscoveredEvent.name = reader.getString(); + } else if ("eventNotifier".equals(fieldName)) { + deserializedDiscoveredEvent.eventNotifier = reader.getString(); + } else if ("eventConfiguration".equals(fieldName)) { + deserializedDiscoveredEvent.eventConfiguration = reader.getString(); + } else if ("topic".equals(fieldName)) { + deserializedDiscoveredEvent.topic = Topic.fromJson(reader); + } else if ("lastUpdatedOn".equals(fieldName)) { + deserializedDiscoveredEvent.lastUpdatedOn = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveredEvent; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Event.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Event.java index 2234069272fc9..04ecbdf59f509 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Event.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Event.java @@ -7,7 +7,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import java.io.IOException; @@ -16,34 +15,11 @@ * Defines the event properties. */ @Fluent -public final class Event implements JsonSerializable { - /* - * The name of the event. - */ - private String name; - - /* - * The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the - * asset. - */ - private String eventNotifier; - - /* - * The path to the type definition of the capability (e.g. DTMI, OPC UA information model node id, etc.), for - * example dtmi:com:example:Robot:_contents:__prop1;1. - */ - private String capabilityId; - +public final class Event extends EventBase { /* * An indication of how the event should be mapped to OpenTelemetry. */ - private EventsObservabilityMode observabilityMode; - - /* - * Protocol-specific configuration for the event. For OPC UA, this could include configuration like, - * publishingInterval, samplingInterval, and queueSize. - */ - private String eventConfiguration; + private EventObservabilityMode observabilityMode; /** * Creates an instance of Event class. @@ -52,108 +28,58 @@ public Event() { } /** - * Get the name property: The name of the event. + * Get the observabilityMode property: An indication of how the event should be mapped to OpenTelemetry. * - * @return the name value. + * @return the observabilityMode value. */ - public String name() { - return this.name; + public EventObservabilityMode observabilityMode() { + return this.observabilityMode; } /** - * Set the name property: The name of the event. + * Set the observabilityMode property: An indication of how the event should be mapped to OpenTelemetry. * - * @param name the name value to set. + * @param observabilityMode the observabilityMode value to set. * @return the Event object itself. */ - public Event withName(String name) { - this.name = name; + public Event withObservabilityMode(EventObservabilityMode observabilityMode) { + this.observabilityMode = observabilityMode; return this; } /** - * Get the eventNotifier property: The address of the notifier of the event in the asset (e.g. URL) so that a client - * can access the event on the asset. - * - * @return the eventNotifier value. - */ - public String eventNotifier() { - return this.eventNotifier; - } - - /** - * Set the eventNotifier property: The address of the notifier of the event in the asset (e.g. URL) so that a client - * can access the event on the asset. - * - * @param eventNotifier the eventNotifier value to set. - * @return the Event object itself. + * {@inheritDoc} */ - public Event withEventNotifier(String eventNotifier) { - this.eventNotifier = eventNotifier; + @Override + public Event withName(String name) { + super.withName(name); return this; } /** - * Get the capabilityId property: The path to the type definition of the capability (e.g. DTMI, OPC UA information - * model node id, etc.), for example dtmi:com:example:Robot:_contents:__prop1;1. - * - * @return the capabilityId value. - */ - public String capabilityId() { - return this.capabilityId; - } - - /** - * Set the capabilityId property: The path to the type definition of the capability (e.g. DTMI, OPC UA information - * model node id, etc.), for example dtmi:com:example:Robot:_contents:__prop1;1. - * - * @param capabilityId the capabilityId value to set. - * @return the Event object itself. + * {@inheritDoc} */ - public Event withCapabilityId(String capabilityId) { - this.capabilityId = capabilityId; + @Override + public Event withEventNotifier(String eventNotifier) { + super.withEventNotifier(eventNotifier); return this; } /** - * Get the observabilityMode property: An indication of how the event should be mapped to OpenTelemetry. - * - * @return the observabilityMode value. - */ - public EventsObservabilityMode observabilityMode() { - return this.observabilityMode; - } - - /** - * Set the observabilityMode property: An indication of how the event should be mapped to OpenTelemetry. - * - * @param observabilityMode the observabilityMode value to set. - * @return the Event object itself. + * {@inheritDoc} */ - public Event withObservabilityMode(EventsObservabilityMode observabilityMode) { - this.observabilityMode = observabilityMode; + @Override + public Event withEventConfiguration(String eventConfiguration) { + super.withEventConfiguration(eventConfiguration); return this; } /** - * Get the eventConfiguration property: Protocol-specific configuration for the event. For OPC UA, this could - * include configuration like, publishingInterval, samplingInterval, and queueSize. - * - * @return the eventConfiguration value. - */ - public String eventConfiguration() { - return this.eventConfiguration; - } - - /** - * Set the eventConfiguration property: Protocol-specific configuration for the event. For OPC UA, this could - * include configuration like, publishingInterval, samplingInterval, and queueSize. - * - * @param eventConfiguration the eventConfiguration value to set. - * @return the Event object itself. + * {@inheritDoc} */ - public Event withEventConfiguration(String eventConfiguration) { - this.eventConfiguration = eventConfiguration; + @Override + public Event withTopic(Topic topic) { + super.withTopic(topic); return this; } @@ -162,11 +88,18 @@ public Event withEventConfiguration(String eventConfiguration) { * * @throws IllegalArgumentException thrown if the instance is not valid. */ + @Override public void validate() { + if (name() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Event")); + } if (eventNotifier() == null) { throw LOGGER.atError() .log(new IllegalArgumentException("Missing required property eventNotifier in model Event")); } + if (topic() != null) { + topic().validate(); + } } private static final ClientLogger LOGGER = new ClientLogger(Event.class); @@ -177,12 +110,12 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("eventNotifier", this.eventNotifier); - jsonWriter.writeStringField("name", this.name); - jsonWriter.writeStringField("capabilityId", this.capabilityId); + jsonWriter.writeStringField("name", name()); + jsonWriter.writeStringField("eventNotifier", eventNotifier()); + jsonWriter.writeStringField("eventConfiguration", eventConfiguration()); + jsonWriter.writeJsonField("topic", topic()); jsonWriter.writeStringField("observabilityMode", this.observabilityMode == null ? null : this.observabilityMode.toString()); - jsonWriter.writeStringField("eventConfiguration", this.eventConfiguration); return jsonWriter.writeEndObject(); } @@ -202,16 +135,16 @@ public static Event fromJson(JsonReader jsonReader) throws IOException { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("eventNotifier".equals(fieldName)) { - deserializedEvent.eventNotifier = reader.getString(); - } else if ("name".equals(fieldName)) { - deserializedEvent.name = reader.getString(); - } else if ("capabilityId".equals(fieldName)) { - deserializedEvent.capabilityId = reader.getString(); - } else if ("observabilityMode".equals(fieldName)) { - deserializedEvent.observabilityMode = EventsObservabilityMode.fromString(reader.getString()); + if ("name".equals(fieldName)) { + deserializedEvent.withName(reader.getString()); + } else if ("eventNotifier".equals(fieldName)) { + deserializedEvent.withEventNotifier(reader.getString()); } else if ("eventConfiguration".equals(fieldName)) { - deserializedEvent.eventConfiguration = reader.getString(); + deserializedEvent.withEventConfiguration(reader.getString()); + } else if ("topic".equals(fieldName)) { + deserializedEvent.withTopic(Topic.fromJson(reader)); + } else if ("observabilityMode".equals(fieldName)) { + deserializedEvent.observabilityMode = EventObservabilityMode.fromString(reader.getString()); } else { reader.skipChildren(); } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/EventBase.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/EventBase.java new file mode 100644 index 0000000000000..781090ad31d85 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/EventBase.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines the event properties. + */ +@Fluent +public class EventBase implements JsonSerializable { + /* + * The name of the event. + */ + private String name; + + /* + * The address of the notifier of the event in the asset (e.g. URL) so that a client can access the event on the + * asset. + */ + private String eventNotifier; + + /* + * Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this could include + * configuration like, publishingInterval, samplingInterval, and queueSize. + */ + private String eventConfiguration; + + /* + * Object that describes the topic information for the specific event. + */ + private Topic topic; + + /** + * Creates an instance of EventBase class. + */ + public EventBase() { + } + + /** + * Get the name property: The name of the event. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the event. + * + * @param name the name value to set. + * @return the EventBase object itself. + */ + public EventBase withName(String name) { + this.name = name; + return this; + } + + /** + * Get the eventNotifier property: The address of the notifier of the event in the asset (e.g. URL) so that a client + * can access the event on the asset. + * + * @return the eventNotifier value. + */ + public String eventNotifier() { + return this.eventNotifier; + } + + /** + * Set the eventNotifier property: The address of the notifier of the event in the asset (e.g. URL) so that a client + * can access the event on the asset. + * + * @param eventNotifier the eventNotifier value to set. + * @return the EventBase object itself. + */ + public EventBase withEventNotifier(String eventNotifier) { + this.eventNotifier = eventNotifier; + return this; + } + + /** + * Get the eventConfiguration property: Stringified JSON that contains connector-specific configuration for the + * event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + * + * @return the eventConfiguration value. + */ + public String eventConfiguration() { + return this.eventConfiguration; + } + + /** + * Set the eventConfiguration property: Stringified JSON that contains connector-specific configuration for the + * event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, and queueSize. + * + * @param eventConfiguration the eventConfiguration value to set. + * @return the EventBase object itself. + */ + public EventBase withEventConfiguration(String eventConfiguration) { + this.eventConfiguration = eventConfiguration; + return this; + } + + /** + * Get the topic property: Object that describes the topic information for the specific event. + * + * @return the topic value. + */ + public Topic topic() { + return this.topic; + } + + /** + * Set the topic property: Object that describes the topic information for the specific event. + * + * @param topic the topic value to set. + * @return the EventBase object itself. + */ + public EventBase withTopic(Topic topic) { + this.topic = topic; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model EventBase")); + } + if (eventNotifier() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property eventNotifier in model EventBase")); + } + if (topic() != null) { + topic().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EventBase.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("eventNotifier", this.eventNotifier); + jsonWriter.writeStringField("eventConfiguration", this.eventConfiguration); + jsonWriter.writeJsonField("topic", this.topic); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EventBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EventBase if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EventBase. + */ + public static EventBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EventBase deserializedEventBase = new EventBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedEventBase.name = reader.getString(); + } else if ("eventNotifier".equals(fieldName)) { + deserializedEventBase.eventNotifier = reader.getString(); + } else if ("eventConfiguration".equals(fieldName)) { + deserializedEventBase.eventConfiguration = reader.getString(); + } else if ("topic".equals(fieldName)) { + deserializedEventBase.topic = Topic.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEventBase; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/EventObservabilityMode.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/EventObservabilityMode.java new file mode 100644 index 0000000000000..ed24ee3626a6d --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/EventObservabilityMode.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the event observability mode. + */ +public final class EventObservabilityMode extends ExpandableStringEnum { + /** + * No mapping to OpenTelemetry. + */ + public static final EventObservabilityMode NONE = fromString("None"); + + /** + * Map as log to OpenTelemetry. + */ + public static final EventObservabilityMode LOG = fromString("Log"); + + /** + * Creates a new instance of EventObservabilityMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EventObservabilityMode() { + } + + /** + * Creates or finds a EventObservabilityMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding EventObservabilityMode. + */ + public static EventObservabilityMode fromString(String name) { + return fromString(name, EventObservabilityMode.class); + } + + /** + * Gets known EventObservabilityMode values. + * + * @return known EventObservabilityMode values. + */ + public static Collection values() { + return values(EventObservabilityMode.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/EventsObservabilityMode.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/EventsObservabilityMode.java deleted file mode 100644 index f0060691e6912..0000000000000 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/EventsObservabilityMode.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.deviceregistry.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * Defines the event observability mode. - */ -public final class EventsObservabilityMode extends ExpandableStringEnum { - /** - * No mapping to OpenTelemetry. - */ - public static final EventsObservabilityMode NONE = fromString("none"); - - /** - * Map as log to OpenTelemetry. - */ - public static final EventsObservabilityMode LOG = fromString("log"); - - /** - * Creates a new instance of EventsObservabilityMode value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public EventsObservabilityMode() { - } - - /** - * Creates or finds a EventsObservabilityMode from its string representation. - * - * @param name a name to look for. - * @return the corresponding EventsObservabilityMode. - */ - public static EventsObservabilityMode fromString(String name) { - return fromString(name, EventsObservabilityMode.class); - } - - /** - * Gets known EventsObservabilityMode values. - * - * @return known EventsObservabilityMode values. - */ - public static Collection values() { - return values(EventsObservabilityMode.class); - } -} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Format.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Format.java new file mode 100644 index 0000000000000..775301f934508 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Format.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the schema format. + */ +public final class Format extends ExpandableStringEnum { + /** + * JSON Schema version draft 7 format. + */ + public static final Format JSON_SCHEMA_DRAFT7 = fromString("JsonSchema/draft-07"); + + /** + * Delta format. + */ + public static final Format DELTA_1_0 = fromString("Delta/1.0"); + + /** + * Creates a new instance of Format value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Format() { + } + + /** + * Creates or finds a Format from its string representation. + * + * @param name a name to look for. + * @return the corresponding Format. + */ + public static Format fromString(String name) { + return fromString(name, Format.class); + } + + /** + * Gets known Format values. + * + * @return known Format values. + */ + public static Collection values() { + return values(Format.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/MessageSchemaReference.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/MessageSchemaReference.java new file mode 100644 index 0000000000000..6298b51e8783e --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/MessageSchemaReference.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines the message schema reference properties. + */ +@Immutable +public final class MessageSchemaReference implements JsonSerializable { + /* + * The message schema registry namespace. + */ + private String schemaRegistryNamespace; + + /* + * The message schema name. + */ + private String schemaName; + + /* + * The message schema version. + */ + private String schemaVersion; + + /** + * Creates an instance of MessageSchemaReference class. + */ + private MessageSchemaReference() { + } + + /** + * Get the schemaRegistryNamespace property: The message schema registry namespace. + * + * @return the schemaRegistryNamespace value. + */ + public String schemaRegistryNamespace() { + return this.schemaRegistryNamespace; + } + + /** + * Get the schemaName property: The message schema name. + * + * @return the schemaName value. + */ + public String schemaName() { + return this.schemaName; + } + + /** + * Get the schemaVersion property: The message schema version. + * + * @return the schemaVersion value. + */ + public String schemaVersion() { + return this.schemaVersion; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MessageSchemaReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MessageSchemaReference if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MessageSchemaReference. + */ + public static MessageSchemaReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MessageSchemaReference deserializedMessageSchemaReference = new MessageSchemaReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("schemaRegistryNamespace".equals(fieldName)) { + deserializedMessageSchemaReference.schemaRegistryNamespace = reader.getString(); + } else if ("schemaName".equals(fieldName)) { + deserializedMessageSchemaReference.schemaName = reader.getString(); + } else if ("schemaVersion".equals(fieldName)) { + deserializedMessageSchemaReference.schemaVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMessageSchemaReference; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/OperationStatusResult.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/OperationStatusResult.java index c2e7a701ad8a9..e732e776d0430 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/OperationStatusResult.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/OperationStatusResult.java @@ -69,6 +69,14 @@ public interface OperationStatusResult { */ ManagementError error(); + /** + * Gets the resourceId property: Fully qualified ID of the resource against which the original async operation was + * started. + * + * @return the resourceId value. + */ + String resourceId(); + /** * Gets the inner com.azure.resourcemanager.deviceregistry.fluent.models.OperationStatusResultInner object. * diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/OwnCertificate.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/OwnCertificate.java deleted file mode 100644 index 2920caafb75c9..0000000000000 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/OwnCertificate.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.deviceregistry.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * Certificate or private key that can be used by the southbound connector connecting to the shop floor/OT device. The - * accepted extensions are .der for certificates and .pfx/.pem for private keys. - */ -@Fluent -public final class OwnCertificate implements JsonSerializable { - /* - * Certificate thumbprint. - */ - private String certThumbprint; - - /* - * Secret Reference name (cert and private key). - */ - private String certSecretReference; - - /* - * Secret Reference Name (Pfx or Pem password). - */ - private String certPasswordReference; - - /** - * Creates an instance of OwnCertificate class. - */ - public OwnCertificate() { - } - - /** - * Get the certThumbprint property: Certificate thumbprint. - * - * @return the certThumbprint value. - */ - public String certThumbprint() { - return this.certThumbprint; - } - - /** - * Set the certThumbprint property: Certificate thumbprint. - * - * @param certThumbprint the certThumbprint value to set. - * @return the OwnCertificate object itself. - */ - public OwnCertificate withCertThumbprint(String certThumbprint) { - this.certThumbprint = certThumbprint; - return this; - } - - /** - * Get the certSecretReference property: Secret Reference name (cert and private key). - * - * @return the certSecretReference value. - */ - public String certSecretReference() { - return this.certSecretReference; - } - - /** - * Set the certSecretReference property: Secret Reference name (cert and private key). - * - * @param certSecretReference the certSecretReference value to set. - * @return the OwnCertificate object itself. - */ - public OwnCertificate withCertSecretReference(String certSecretReference) { - this.certSecretReference = certSecretReference; - return this; - } - - /** - * Get the certPasswordReference property: Secret Reference Name (Pfx or Pem password). - * - * @return the certPasswordReference value. - */ - public String certPasswordReference() { - return this.certPasswordReference; - } - - /** - * Set the certPasswordReference property: Secret Reference Name (Pfx or Pem password). - * - * @param certPasswordReference the certPasswordReference value to set. - * @return the OwnCertificate object itself. - */ - public OwnCertificate withCertPasswordReference(String certPasswordReference) { - this.certPasswordReference = certPasswordReference; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("certThumbprint", this.certThumbprint); - jsonWriter.writeStringField("certSecretReference", this.certSecretReference); - jsonWriter.writeStringField("certPasswordReference", this.certPasswordReference); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of OwnCertificate from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of OwnCertificate if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the OwnCertificate. - */ - public static OwnCertificate fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - OwnCertificate deserializedOwnCertificate = new OwnCertificate(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("certThumbprint".equals(fieldName)) { - deserializedOwnCertificate.certThumbprint = reader.getString(); - } else if ("certSecretReference".equals(fieldName)) { - deserializedOwnCertificate.certSecretReference = reader.getString(); - } else if ("certPasswordReference".equals(fieldName)) { - deserializedOwnCertificate.certPasswordReference = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedOwnCertificate; - }); - } -} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/ProvisioningState.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/ProvisioningState.java index af194be3bd760..07e034ba65644 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/ProvisioningState.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/ProvisioningState.java @@ -31,6 +31,11 @@ public final class ProvisioningState extends ExpandableStringEnum { + /* + * Globally unique, immutable, non-reusable id. + */ + private String uuid; + + /* + * Human-readable display name. + */ + private String displayName; + + /* + * Human-readable description of the schema. + */ + private String description; + + /* + * Format of the schema. + */ + private Format format; + + /* + * Type of the schema. + */ + private SchemaType schemaType; + + /* + * Provisioning state of the resource. + */ + private ProvisioningState provisioningState; + + /* + * Schema tags. + */ + private Map tags; + + /** + * Creates an instance of SchemaProperties class. + */ + public SchemaProperties() { + } + + /** + * Get the uuid property: Globally unique, immutable, non-reusable id. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the displayName property: Human-readable display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Human-readable display name. + * + * @param displayName the displayName value to set. + * @return the SchemaProperties object itself. + */ + public SchemaProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: Human-readable description of the schema. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Human-readable description of the schema. + * + * @param description the description value to set. + * @return the SchemaProperties object itself. + */ + public SchemaProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the format property: Format of the schema. + * + * @return the format value. + */ + public Format format() { + return this.format; + } + + /** + * Set the format property: Format of the schema. + * + * @param format the format value to set. + * @return the SchemaProperties object itself. + */ + public SchemaProperties withFormat(Format format) { + this.format = format; + return this; + } + + /** + * Get the schemaType property: Type of the schema. + * + * @return the schemaType value. + */ + public SchemaType schemaType() { + return this.schemaType; + } + + /** + * Set the schemaType property: Type of the schema. + * + * @param schemaType the schemaType value to set. + * @return the SchemaProperties object itself. + */ + public SchemaProperties withSchemaType(SchemaType schemaType) { + this.schemaType = schemaType; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the tags property: Schema tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Schema tags. + * + * @param tags the tags value to set. + * @return the SchemaProperties object itself. + */ + public SchemaProperties withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (format() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property format in model SchemaProperties")); + } + if (schemaType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property schemaType in model SchemaProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SchemaProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("format", this.format == null ? null : this.format.toString()); + jsonWriter.writeStringField("schemaType", this.schemaType == null ? null : this.schemaType.toString()); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SchemaProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SchemaProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SchemaProperties. + */ + public static SchemaProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SchemaProperties deserializedSchemaProperties = new SchemaProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("format".equals(fieldName)) { + deserializedSchemaProperties.format = Format.fromString(reader.getString()); + } else if ("schemaType".equals(fieldName)) { + deserializedSchemaProperties.schemaType = SchemaType.fromString(reader.getString()); + } else if ("uuid".equals(fieldName)) { + deserializedSchemaProperties.uuid = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedSchemaProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedSchemaProperties.description = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedSchemaProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSchemaProperties.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedSchemaProperties; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistries.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistries.java new file mode 100644 index 0000000000000..c04e14791f503 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistries.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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 SchemaRegistries. + */ +public interface SchemaRegistries { + /** + * Get a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 SchemaRegistry along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String schemaRegistryName, + Context context); + + /** + * Get a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 SchemaRegistry. + */ + SchemaRegistry getByResourceGroup(String resourceGroupName, String schemaRegistryName); + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 schemaRegistryName); + + /** + * Delete a SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 schemaRegistryName, Context context); + + /** + * List SchemaRegistry 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 SchemaRegistry list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List SchemaRegistry 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 SchemaRegistry list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List SchemaRegistry 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 SchemaRegistry list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List SchemaRegistry 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 SchemaRegistry list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a SchemaRegistry. + * + * @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 SchemaRegistry along with {@link Response}. + */ + SchemaRegistry getById(String id); + + /** + * Get a SchemaRegistry. + * + * @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 SchemaRegistry along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a SchemaRegistry. + * + * @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 SchemaRegistry. + * + * @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 SchemaRegistry resource. + * + * @param name resource name. + * @return the first stage of the new SchemaRegistry definition. + */ + SchemaRegistry.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistry.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistry.java new file mode 100644 index 0000000000000..8a0f9ab98e46c --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistry.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaRegistryInner; +import java.util.Map; + +/** + * An immutable client-side representation of SchemaRegistry. + */ +public interface SchemaRegistry { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + SchemaRegistryProperties properties(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + SystemAssignedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.deviceregistry.fluent.models.SchemaRegistryInner object. + * + * @return the inner object. + */ + SchemaRegistryInner innerModel(); + + /** + * The entirety of the SchemaRegistry definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The SchemaRegistry definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SchemaRegistry definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the SchemaRegistry 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 SchemaRegistry 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 SchemaRegistry 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, DefinitionStages.WithProperties, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + SchemaRegistry create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SchemaRegistry create(Context context); + } + + /** + * The stage of the SchemaRegistry definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the SchemaRegistry definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(SchemaRegistryProperties properties); + } + + /** + * The stage of the SchemaRegistry definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(SystemAssignedServiceIdentity identity); + } + } + + /** + * Begins update for the SchemaRegistry resource. + * + * @return the stage of resource update. + */ + SchemaRegistry.Update update(); + + /** + * The template for SchemaRegistry update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SchemaRegistry apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SchemaRegistry apply(Context context); + } + + /** + * The SchemaRegistry update stages. + */ + interface UpdateStages { + /** + * The stage of the SchemaRegistry 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); + } + + /** + * The stage of the SchemaRegistry update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(SystemAssignedServiceIdentity identity); + } + + /** + * The stage of the SchemaRegistry update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(SchemaRegistryUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SchemaRegistry refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SchemaRegistry refresh(Context context); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistryProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistryProperties.java new file mode 100644 index 0000000000000..8b792b0c4f704 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistryProperties.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines the schema registry properties. + */ +@Fluent +public final class SchemaRegistryProperties implements JsonSerializable { + /* + * Globally unique, immutable, non-reusable id. + */ + private String uuid; + + /* + * Schema registry namespace. Uniquely identifies a schema registry within a tenant. + */ + private String namespace; + + /* + * Human-readable display name. + */ + private String displayName; + + /* + * Human-readable description of the schema registry. + */ + private String description; + + /* + * The Storage Account's Container URL where schemas will be stored. + */ + private String storageAccountContainerUrl; + + /* + * Provisioning state of the resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of SchemaRegistryProperties class. + */ + public SchemaRegistryProperties() { + } + + /** + * Get the uuid property: Globally unique, immutable, non-reusable id. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the namespace property: Schema registry namespace. Uniquely identifies a schema registry within a tenant. + * + * @return the namespace value. + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace property: Schema registry namespace. Uniquely identifies a schema registry within a tenant. + * + * @param namespace the namespace value to set. + * @return the SchemaRegistryProperties object itself. + */ + public SchemaRegistryProperties withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the displayName property: Human-readable display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Human-readable display name. + * + * @param displayName the displayName value to set. + * @return the SchemaRegistryProperties object itself. + */ + public SchemaRegistryProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: Human-readable description of the schema registry. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Human-readable description of the schema registry. + * + * @param description the description value to set. + * @return the SchemaRegistryProperties object itself. + */ + public SchemaRegistryProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the storageAccountContainerUrl property: The Storage Account's Container URL where schemas will be stored. + * + * @return the storageAccountContainerUrl value. + */ + public String storageAccountContainerUrl() { + return this.storageAccountContainerUrl; + } + + /** + * Set the storageAccountContainerUrl property: The Storage Account's Container URL where schemas will be stored. + * + * @param storageAccountContainerUrl the storageAccountContainerUrl value to set. + * @return the SchemaRegistryProperties object itself. + */ + public SchemaRegistryProperties withStorageAccountContainerUrl(String storageAccountContainerUrl) { + this.storageAccountContainerUrl = storageAccountContainerUrl; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @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 (namespace() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property namespace in model SchemaRegistryProperties")); + } + if (storageAccountContainerUrl() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property storageAccountContainerUrl in model SchemaRegistryProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SchemaRegistryProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("namespace", this.namespace); + jsonWriter.writeStringField("storageAccountContainerUrl", this.storageAccountContainerUrl); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SchemaRegistryProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SchemaRegistryProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SchemaRegistryProperties. + */ + public static SchemaRegistryProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SchemaRegistryProperties deserializedSchemaRegistryProperties = new SchemaRegistryProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("namespace".equals(fieldName)) { + deserializedSchemaRegistryProperties.namespace = reader.getString(); + } else if ("storageAccountContainerUrl".equals(fieldName)) { + deserializedSchemaRegistryProperties.storageAccountContainerUrl = reader.getString(); + } else if ("uuid".equals(fieldName)) { + deserializedSchemaRegistryProperties.uuid = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedSchemaRegistryProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedSchemaRegistryProperties.description = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedSchemaRegistryProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSchemaRegistryProperties; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistryUpdate.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistryUpdate.java new file mode 100644 index 0000000000000..05f3cfc4a579f --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistryUpdate.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for update operations of the SchemaRegistry. + */ +@Fluent +public final class SchemaRegistryUpdate implements JsonSerializable { + /* + * The managed service identities assigned to this resource. + */ + private SystemAssignedServiceIdentity identity; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The resource-specific properties for this resource. + */ + private SchemaRegistryUpdateProperties properties; + + /** + * Creates an instance of SchemaRegistryUpdate class. + */ + public SchemaRegistryUpdate() { + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public SystemAssignedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the SchemaRegistryUpdate object itself. + */ + public SchemaRegistryUpdate withIdentity(SystemAssignedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * 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 SchemaRegistryUpdate object itself. + */ + public SchemaRegistryUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public SchemaRegistryUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the SchemaRegistryUpdate object itself. + */ + public SchemaRegistryUpdate withProperties(SchemaRegistryUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SchemaRegistryUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SchemaRegistryUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SchemaRegistryUpdate. + */ + public static SchemaRegistryUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SchemaRegistryUpdate deserializedSchemaRegistryUpdate = new SchemaRegistryUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identity".equals(fieldName)) { + deserializedSchemaRegistryUpdate.identity = SystemAssignedServiceIdentity.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSchemaRegistryUpdate.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedSchemaRegistryUpdate.properties = SchemaRegistryUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSchemaRegistryUpdate; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistryUpdateProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistryUpdateProperties.java new file mode 100644 index 0000000000000..9aed811d776f2 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaRegistryUpdateProperties.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The updatable properties of the SchemaRegistry. + */ +@Fluent +public final class SchemaRegistryUpdateProperties implements JsonSerializable { + /* + * Human-readable display name. + */ + private String displayName; + + /* + * Human-readable description of the schema registry. + */ + private String description; + + /** + * Creates an instance of SchemaRegistryUpdateProperties class. + */ + public SchemaRegistryUpdateProperties() { + } + + /** + * Get the displayName property: Human-readable display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Human-readable display name. + * + * @param displayName the displayName value to set. + * @return the SchemaRegistryUpdateProperties object itself. + */ + public SchemaRegistryUpdateProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: Human-readable description of the schema registry. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Human-readable description of the schema registry. + * + * @param description the description value to set. + * @return the SchemaRegistryUpdateProperties object itself. + */ + public SchemaRegistryUpdateProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SchemaRegistryUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SchemaRegistryUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SchemaRegistryUpdateProperties. + */ + public static SchemaRegistryUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SchemaRegistryUpdateProperties deserializedSchemaRegistryUpdateProperties + = new SchemaRegistryUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedSchemaRegistryUpdateProperties.displayName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedSchemaRegistryUpdateProperties.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSchemaRegistryUpdateProperties; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaType.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaType.java new file mode 100644 index 0000000000000..8e48c5748b6c5 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the schema type. + */ +public final class SchemaType extends ExpandableStringEnum { + /** + * Message Schema schema type. + */ + public static final SchemaType MESSAGE_SCHEMA = fromString("MessageSchema"); + + /** + * Creates a new instance of SchemaType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SchemaType() { + } + + /** + * Creates or finds a SchemaType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SchemaType. + */ + public static SchemaType fromString(String name) { + return fromString(name, SchemaType.class); + } + + /** + * Gets known SchemaType values. + * + * @return known SchemaType values. + */ + public static Collection values() { + return values(SchemaType.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaVersion.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaVersion.java new file mode 100644 index 0000000000000..e981d2031fb63 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaVersion.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaVersionInner; + +/** + * An immutable client-side representation of SchemaVersion. + */ +public interface SchemaVersion { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + SchemaVersionProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.deviceregistry.fluent.models.SchemaVersionInner object. + * + * @return the inner object. + */ + SchemaVersionInner innerModel(); + + /** + * The entirety of the SchemaVersion definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The SchemaVersion definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SchemaVersion definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the SchemaVersion definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, schemaRegistryName, schemaName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @return the next definition stage. + */ + WithCreate withExistingSchema(String resourceGroupName, String schemaRegistryName, String schemaName); + } + + /** + * The stage of the SchemaVersion definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + SchemaVersion create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SchemaVersion create(Context context); + } + + /** + * The stage of the SchemaVersion definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(SchemaVersionProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SchemaVersion refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SchemaVersion refresh(Context context); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaVersionProperties.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaVersionProperties.java new file mode 100644 index 0000000000000..ef2cef5c9f23d --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaVersionProperties.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines the schema version properties. + */ +@Fluent +public final class SchemaVersionProperties implements JsonSerializable { + /* + * Globally unique, immutable, non-reusable id. + */ + private String uuid; + + /* + * Human-readable description of the schema. + */ + private String description; + + /* + * Schema content. + */ + private String schemaContent; + + /* + * Hash of the schema content. + */ + private String hash; + + /* + * Provisioning state of the resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of SchemaVersionProperties class. + */ + public SchemaVersionProperties() { + } + + /** + * Get the uuid property: Globally unique, immutable, non-reusable id. + * + * @return the uuid value. + */ + public String uuid() { + return this.uuid; + } + + /** + * Get the description property: Human-readable description of the schema. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Human-readable description of the schema. + * + * @param description the description value to set. + * @return the SchemaVersionProperties object itself. + */ + public SchemaVersionProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the schemaContent property: Schema content. + * + * @return the schemaContent value. + */ + public String schemaContent() { + return this.schemaContent; + } + + /** + * Set the schemaContent property: Schema content. + * + * @param schemaContent the schemaContent value to set. + * @return the SchemaVersionProperties object itself. + */ + public SchemaVersionProperties withSchemaContent(String schemaContent) { + this.schemaContent = schemaContent; + return this; + } + + /** + * Get the hash property: Hash of the schema content. + * + * @return the hash value. + */ + public String hash() { + return this.hash; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @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 (schemaContent() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property schemaContent in model SchemaVersionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SchemaVersionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("schemaContent", this.schemaContent); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SchemaVersionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SchemaVersionProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SchemaVersionProperties. + */ + public static SchemaVersionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SchemaVersionProperties deserializedSchemaVersionProperties = new SchemaVersionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("schemaContent".equals(fieldName)) { + deserializedSchemaVersionProperties.schemaContent = reader.getString(); + } else if ("uuid".equals(fieldName)) { + deserializedSchemaVersionProperties.uuid = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedSchemaVersionProperties.description = reader.getString(); + } else if ("hash".equals(fieldName)) { + deserializedSchemaVersionProperties.hash = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedSchemaVersionProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSchemaVersionProperties; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaVersions.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaVersions.java new file mode 100644 index 0000000000000..5bf06a2dabeed --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SchemaVersions.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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 SchemaVersions. + */ +public interface SchemaVersions { + /** + * Get a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @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 SchemaVersion along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName, Context context); + + /** + * Get a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 SchemaVersion. + */ + SchemaVersion get(String resourceGroupName, String schemaRegistryName, String schemaName, String schemaVersionName); + + /** + * Delete a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @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 Response}. + */ + Response deleteWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + String schemaVersionName, Context context); + + /** + * Delete a SchemaVersion. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @param schemaVersionName Schema version name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 schemaRegistryName, String schemaName, String schemaVersionName); + + /** + * List SchemaVersion resources by Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 SchemaVersion list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySchema(String resourceGroupName, String schemaRegistryName, String schemaName); + + /** + * List SchemaVersion resources by Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 SchemaVersion list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySchema(String resourceGroupName, String schemaRegistryName, String schemaName, + Context context); + + /** + * Get a SchemaVersion. + * + * @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 SchemaVersion along with {@link Response}. + */ + SchemaVersion getById(String id); + + /** + * Get a SchemaVersion. + * + * @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 SchemaVersion along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a SchemaVersion. + * + * @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 SchemaVersion. + * + * @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 the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SchemaVersion resource. + * + * @param name resource name. + * @return the first stage of the new SchemaVersion definition. + */ + SchemaVersion.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Schemas.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Schemas.java new file mode 100644 index 0000000000000..458c2cae223d5 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Schemas.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.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 Schemas. + */ +public interface Schemas { + /** + * Get a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 Schema along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + Context context); + + /** + * Get a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Schema. + */ + Schema get(String resourceGroupName, String schemaRegistryName, String schemaName); + + /** + * Delete a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @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 Response}. + */ + Response deleteWithResponse(String resourceGroupName, String schemaRegistryName, String schemaName, + Context context); + + /** + * Delete a Schema. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @param schemaName Schema name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 schemaRegistryName, String schemaName); + + /** + * List Schema resources by SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 Schema list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySchemaRegistry(String resourceGroupName, String schemaRegistryName); + + /** + * List Schema resources by SchemaRegistry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schemaRegistryName Schema registry name parameter. + * @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 Schema list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySchemaRegistry(String resourceGroupName, String schemaRegistryName, Context context); + + /** + * Get a Schema. + * + * @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 Schema along with {@link Response}. + */ + Schema getById(String id); + + /** + * Get a Schema. + * + * @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 Schema along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Schema. + * + * @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 Schema. + * + * @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 the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Schema resource. + * + * @param name resource name. + * @return the first stage of the new Schema definition. + */ + Schema.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SystemAssignedServiceIdentity.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SystemAssignedServiceIdentity.java new file mode 100644 index 0000000000000..1e29f42eddab0 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SystemAssignedServiceIdentity.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Managed service identity (either system assigned, or none). + */ +@Fluent +public final class SystemAssignedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private String principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private String tenantId; + + /* + * The type of managed identity assigned to this resource. + */ + private SystemAssignedServiceIdentityType type; + + /** + * Creates an instance of SystemAssignedServiceIdentity class. + */ + public SystemAssignedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public SystemAssignedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the SystemAssignedServiceIdentity object itself. + */ + public SystemAssignedServiceIdentity withType(SystemAssignedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property type in model SystemAssignedServiceIdentity")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SystemAssignedServiceIdentity.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SystemAssignedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SystemAssignedServiceIdentity if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SystemAssignedServiceIdentity. + */ + public static SystemAssignedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SystemAssignedServiceIdentity deserializedSystemAssignedServiceIdentity + = new SystemAssignedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedSystemAssignedServiceIdentity.type + = SystemAssignedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedSystemAssignedServiceIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedSystemAssignedServiceIdentity.tenantId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSystemAssignedServiceIdentity; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SystemAssignedServiceIdentityType.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SystemAssignedServiceIdentityType.java new file mode 100644 index 0000000000000..1d08927e99f86 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/SystemAssignedServiceIdentityType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (either system assigned, or none). + */ +public final class SystemAssignedServiceIdentityType extends ExpandableStringEnum { + /** + * No managed system identity. + */ + public static final SystemAssignedServiceIdentityType NONE = fromString("None"); + + /** + * System assigned managed system identity. + */ + public static final SystemAssignedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Creates a new instance of SystemAssignedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SystemAssignedServiceIdentityType() { + } + + /** + * Creates or finds a SystemAssignedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SystemAssignedServiceIdentityType. + */ + public static SystemAssignedServiceIdentityType fromString(String name) { + return fromString(name, SystemAssignedServiceIdentityType.class); + } + + /** + * Gets known SystemAssignedServiceIdentityType values. + * + * @return known SystemAssignedServiceIdentityType values. + */ + public static Collection values() { + return values(SystemAssignedServiceIdentityType.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Topic.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Topic.java new file mode 100644 index 0000000000000..825b2c18598d9 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/Topic.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Object that describes the topic information. + */ +@Fluent +public final class Topic implements JsonSerializable { + /* + * The topic path for messages published to an MQTT broker. + */ + private String path; + + /* + * When set to 'Keep', messages published to an MQTT broker will have the retain flag set. Default: 'Never'. + */ + private TopicRetainType retain; + + /** + * Creates an instance of Topic class. + */ + public Topic() { + } + + /** + * Get the path property: The topic path for messages published to an MQTT broker. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The topic path for messages published to an MQTT broker. + * + * @param path the path value to set. + * @return the Topic object itself. + */ + public Topic withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the retain property: When set to 'Keep', messages published to an MQTT broker will have the retain flag set. + * Default: 'Never'. + * + * @return the retain value. + */ + public TopicRetainType retain() { + return this.retain; + } + + /** + * Set the retain property: When set to 'Keep', messages published to an MQTT broker will have the retain flag set. + * Default: 'Never'. + * + * @param retain the retain value to set. + * @return the Topic object itself. + */ + public Topic withRetain(TopicRetainType retain) { + this.retain = retain; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (path() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property path in model Topic")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Topic.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("path", this.path); + jsonWriter.writeStringField("retain", this.retain == null ? null : this.retain.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Topic from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Topic if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Topic. + */ + public static Topic fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Topic deserializedTopic = new Topic(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("path".equals(fieldName)) { + deserializedTopic.path = reader.getString(); + } else if ("retain".equals(fieldName)) { + deserializedTopic.retain = TopicRetainType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTopic; + }); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/TopicRetainType.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/TopicRetainType.java new file mode 100644 index 0000000000000..3f00facc0bf7a --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/TopicRetainType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Topic retain types. + */ +public final class TopicRetainType extends ExpandableStringEnum { + /** + * Retain the messages. + */ + public static final TopicRetainType KEEP = fromString("Keep"); + + /** + * Never retain messages. + */ + public static final TopicRetainType NEVER = fromString("Never"); + + /** + * Creates a new instance of TopicRetainType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TopicRetainType() { + } + + /** + * Creates or finds a TopicRetainType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TopicRetainType. + */ + public static TopicRetainType fromString(String name) { + return fromString(name, TopicRetainType.class); + } + + /** + * Gets known TopicRetainType values. + * + * @return known TopicRetainType values. + */ + public static Collection values() { + return values(TopicRetainType.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/TransportAuthentication.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/TransportAuthentication.java deleted file mode 100644 index 448b48d1e4af8..0000000000000 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/TransportAuthentication.java +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.deviceregistry.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * Definition of the authentication mechanism for the southbound connector. - */ -@Fluent -public final class TransportAuthentication implements JsonSerializable { - /* - * Defines a reference to a secret which contains all certificates and private keys that can be used by the - * southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates - * and .pfx/.pem for private keys. - */ - private List ownCertificates; - - /** - * Creates an instance of TransportAuthentication class. - */ - public TransportAuthentication() { - } - - /** - * Get the ownCertificates property: Defines a reference to a secret which contains all certificates and private - * keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions - * are .der for certificates and .pfx/.pem for private keys. - * - * @return the ownCertificates value. - */ - public List ownCertificates() { - return this.ownCertificates; - } - - /** - * Set the ownCertificates property: Defines a reference to a secret which contains all certificates and private - * keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions - * are .der for certificates and .pfx/.pem for private keys. - * - * @param ownCertificates the ownCertificates value to set. - * @return the TransportAuthentication object itself. - */ - public TransportAuthentication withOwnCertificates(List ownCertificates) { - this.ownCertificates = ownCertificates; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (ownCertificates() == null) { - throw LOGGER.atError() - .log(new IllegalArgumentException( - "Missing required property ownCertificates in model TransportAuthentication")); - } else { - ownCertificates().forEach(e -> e.validate()); - } - } - - private static final ClientLogger LOGGER = new ClientLogger(TransportAuthentication.class); - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeArrayField("ownCertificates", this.ownCertificates, - (writer, element) -> writer.writeJson(element)); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of TransportAuthentication from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of TransportAuthentication if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IllegalStateException If the deserialized JSON object was missing any required properties. - * @throws IOException If an error occurs while reading the TransportAuthentication. - */ - public static TransportAuthentication fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - TransportAuthentication deserializedTransportAuthentication = new TransportAuthentication(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("ownCertificates".equals(fieldName)) { - List ownCertificates - = reader.readArray(reader1 -> OwnCertificate.fromJson(reader1)); - deserializedTransportAuthentication.ownCertificates = ownCertificates; - } else { - reader.skipChildren(); - } - } - - return deserializedTransportAuthentication; - }); - } -} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/UserAuthenticationMode.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/UserAuthenticationMode.java deleted file mode 100644 index ffe34a9299c71..0000000000000 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/UserAuthenticationMode.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.deviceregistry.models; - -import com.azure.core.util.ExpandableStringEnum; -import java.util.Collection; - -/** - * The mode to authenticate the user of the client at the server. - */ -public final class UserAuthenticationMode extends ExpandableStringEnum { - /** - * The user authentication mode is anonymous. - */ - public static final UserAuthenticationMode ANONYMOUS = fromString("Anonymous"); - - /** - * The user authentication mode is an x509 certificate. - */ - public static final UserAuthenticationMode CERTIFICATE = fromString("Certificate"); - - /** - * The user authentication mode is a username and password. - */ - public static final UserAuthenticationMode USERNAME_PASSWORD = fromString("UsernamePassword"); - - /** - * Creates a new instance of UserAuthenticationMode value. - * - * @deprecated Use the {@link #fromString(String)} factory method. - */ - @Deprecated - public UserAuthenticationMode() { - } - - /** - * Creates or finds a UserAuthenticationMode from its string representation. - * - * @param name a name to look for. - * @return the corresponding UserAuthenticationMode. - */ - public static UserAuthenticationMode fromString(String name) { - return fromString(name, UserAuthenticationMode.class); - } - - /** - * Gets known UserAuthenticationMode values. - * - * @return known UserAuthenticationMode values. - */ - public static Collection values() { - return values(UserAuthenticationMode.class); - } -} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/UsernamePasswordCredentials.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/UsernamePasswordCredentials.java index cba77640f7661..1e5861b2063da 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/UsernamePasswordCredentials.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/UsernamePasswordCredentials.java @@ -18,14 +18,14 @@ @Fluent public final class UsernamePasswordCredentials implements JsonSerializable { /* - * A reference to secret containing the username. + * The name of the secret containing the username. */ - private String usernameReference; + private String usernameSecretName; /* - * A reference to secret containing the password. + * The name of the secret containing the password. */ - private String passwordReference; + private String passwordSecretName; /** * Creates an instance of UsernamePasswordCredentials class. @@ -34,42 +34,42 @@ public UsernamePasswordCredentials() { } /** - * Get the usernameReference property: A reference to secret containing the username. + * Get the usernameSecretName property: The name of the secret containing the username. * - * @return the usernameReference value. + * @return the usernameSecretName value. */ - public String usernameReference() { - return this.usernameReference; + public String usernameSecretName() { + return this.usernameSecretName; } /** - * Set the usernameReference property: A reference to secret containing the username. + * Set the usernameSecretName property: The name of the secret containing the username. * - * @param usernameReference the usernameReference value to set. + * @param usernameSecretName the usernameSecretName value to set. * @return the UsernamePasswordCredentials object itself. */ - public UsernamePasswordCredentials withUsernameReference(String usernameReference) { - this.usernameReference = usernameReference; + public UsernamePasswordCredentials withUsernameSecretName(String usernameSecretName) { + this.usernameSecretName = usernameSecretName; return this; } /** - * Get the passwordReference property: A reference to secret containing the password. + * Get the passwordSecretName property: The name of the secret containing the password. * - * @return the passwordReference value. + * @return the passwordSecretName value. */ - public String passwordReference() { - return this.passwordReference; + public String passwordSecretName() { + return this.passwordSecretName; } /** - * Set the passwordReference property: A reference to secret containing the password. + * Set the passwordSecretName property: The name of the secret containing the password. * - * @param passwordReference the passwordReference value to set. + * @param passwordSecretName the passwordSecretName value to set. * @return the UsernamePasswordCredentials object itself. */ - public UsernamePasswordCredentials withPasswordReference(String passwordReference) { - this.passwordReference = passwordReference; + public UsernamePasswordCredentials withPasswordSecretName(String passwordSecretName) { + this.passwordSecretName = passwordSecretName; return this; } @@ -79,15 +79,15 @@ public UsernamePasswordCredentials withPasswordReference(String passwordReferenc * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (usernameReference() == null) { + if (usernameSecretName() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( - "Missing required property usernameReference in model UsernamePasswordCredentials")); + "Missing required property usernameSecretName in model UsernamePasswordCredentials")); } - if (passwordReference() == null) { + if (passwordSecretName() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( - "Missing required property passwordReference in model UsernamePasswordCredentials")); + "Missing required property passwordSecretName in model UsernamePasswordCredentials")); } } @@ -99,8 +99,8 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("usernameReference", this.usernameReference); - jsonWriter.writeStringField("passwordReference", this.passwordReference); + jsonWriter.writeStringField("usernameSecretName", this.usernameSecretName); + jsonWriter.writeStringField("passwordSecretName", this.passwordSecretName); return jsonWriter.writeEndObject(); } @@ -120,10 +120,10 @@ public static UsernamePasswordCredentials fromJson(JsonReader jsonReader) throws String fieldName = reader.getFieldName(); reader.nextToken(); - if ("usernameReference".equals(fieldName)) { - deserializedUsernamePasswordCredentials.usernameReference = reader.getString(); - } else if ("passwordReference".equals(fieldName)) { - deserializedUsernamePasswordCredentials.passwordReference = reader.getString(); + if ("usernameSecretName".equals(fieldName)) { + deserializedUsernamePasswordCredentials.usernameSecretName = reader.getString(); + } else if ("passwordSecretName".equals(fieldName)) { + deserializedUsernamePasswordCredentials.passwordSecretName = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/X509Credentials.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/X509Credentials.java index 2b5ff973a1682..3a6f0d6ec2782 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/X509Credentials.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/java/com/azure/resourcemanager/deviceregistry/models/X509Credentials.java @@ -18,9 +18,9 @@ @Fluent public final class X509Credentials implements JsonSerializable { /* - * A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). + * The name of the secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). */ - private String certificateReference; + private String certificateSecretName; /** * Creates an instance of X509Credentials class. @@ -29,24 +29,24 @@ public X509Credentials() { } /** - * Get the certificateReference property: A reference to secret containing the certificate and private key (e.g. + * Get the certificateSecretName property: The name of the secret containing the certificate and private key (e.g. * stored as .der/.pem or .der/.pfx). * - * @return the certificateReference value. + * @return the certificateSecretName value. */ - public String certificateReference() { - return this.certificateReference; + public String certificateSecretName() { + return this.certificateSecretName; } /** - * Set the certificateReference property: A reference to secret containing the certificate and private key (e.g. + * Set the certificateSecretName property: The name of the secret containing the certificate and private key (e.g. * stored as .der/.pem or .der/.pfx). * - * @param certificateReference the certificateReference value to set. + * @param certificateSecretName the certificateSecretName value to set. * @return the X509Credentials object itself. */ - public X509Credentials withCertificateReference(String certificateReference) { - this.certificateReference = certificateReference; + public X509Credentials withCertificateSecretName(String certificateSecretName) { + this.certificateSecretName = certificateSecretName; return this; } @@ -56,10 +56,10 @@ public X509Credentials withCertificateReference(String certificateReference) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (certificateReference() == null) { + if (certificateSecretName() == null) { throw LOGGER.atError() .log(new IllegalArgumentException( - "Missing required property certificateReference in model X509Credentials")); + "Missing required property certificateSecretName in model X509Credentials")); } } @@ -71,7 +71,7 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("certificateReference", this.certificateReference); + jsonWriter.writeStringField("certificateSecretName", this.certificateSecretName); return jsonWriter.writeEndObject(); } @@ -91,8 +91,8 @@ public static X509Credentials fromJson(JsonReader jsonReader) throws IOException String fieldName = reader.getFieldName(); reader.nextToken(); - if ("certificateReference".equals(fieldName)) { - deserializedX509Credentials.certificateReference = reader.getString(); + if ("certificateSecretName".equals(fieldName)) { + deserializedX509Credentials.certificateSecretName = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-deviceregistry/proxy-config.json b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-deviceregistry/proxy-config.json index 33236cc87e4d7..3cb6e4ed92935 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-deviceregistry/proxy-config.json +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-deviceregistry/proxy-config.json @@ -1 +1 @@ -[["com.azure.resourcemanager.deviceregistry.implementation.AssetEndpointProfilesClientImpl$AssetEndpointProfilesService"],["com.azure.resourcemanager.deviceregistry.implementation.AssetsClientImpl$AssetsService"],["com.azure.resourcemanager.deviceregistry.implementation.OperationStatusClientImpl$OperationStatusService"],["com.azure.resourcemanager.deviceregistry.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file +[["com.azure.resourcemanager.deviceregistry.implementation.AssetEndpointProfilesClientImpl$AssetEndpointProfilesService"],["com.azure.resourcemanager.deviceregistry.implementation.AssetsClientImpl$AssetsService"],["com.azure.resourcemanager.deviceregistry.implementation.BillingContainersClientImpl$BillingContainersService"],["com.azure.resourcemanager.deviceregistry.implementation.DiscoveredAssetEndpointProfilesClientImpl$DiscoveredAssetEndpointProfilesService"],["com.azure.resourcemanager.deviceregistry.implementation.DiscoveredAssetsClientImpl$DiscoveredAssetsService"],["com.azure.resourcemanager.deviceregistry.implementation.OperationStatusClientImpl$OperationStatusService"],["com.azure.resourcemanager.deviceregistry.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.deviceregistry.implementation.SchemaRegistriesClientImpl$SchemaRegistriesService"],["com.azure.resourcemanager.deviceregistry.implementation.SchemaVersionsClientImpl$SchemaVersionsService"],["com.azure.resourcemanager.deviceregistry.implementation.SchemasClientImpl$SchemasService"]] \ No newline at end of file diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesCreateOrReplaceSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesCreateOrReplaceSamples.java index ae836ae79380a..dc391320bcae4 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesCreateOrReplaceSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesCreateOrReplaceSamples.java @@ -5,9 +5,9 @@ package com.azure.resourcemanager.deviceregistry.generated; import com.azure.resourcemanager.deviceregistry.models.AssetEndpointProfileProperties; +import com.azure.resourcemanager.deviceregistry.models.Authentication; +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; -import com.azure.resourcemanager.deviceregistry.models.UserAuthentication; -import com.azure.resourcemanager.deviceregistry.models.UserAuthenticationMode; import java.util.HashMap; import java.util.Map; @@ -16,7 +16,33 @@ */ public final class AssetEndpointProfilesCreateOrReplaceSamples { /* - * x-ms-original-file: 2023-11-01-preview/Create_AssetEndpointProfile.json + * x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile_With_DiscoveredAepRef.json + */ + /** + * Sample code: Create_AssetEndpointProfile_With_DiscoveredAepRef. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void createAssetEndpointProfileWithDiscoveredAepRef( + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.assetEndpointProfiles() + .define("my-assetendpointprofile") + .withRegion("West Europe") + .withExistingResourceGroup("myResourceGroup") + .withExtendedLocation(new ExtendedLocation().withType("CustomLocation") + .withName( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + .withTags(mapOf("site", "building-1")) + .withProperties( + new AssetEndpointProfileProperties().withTargetAddress("https://www.example.com/myTargetAddress") + .withEndpointProfileType("myEndpointProfileType") + .withAuthentication(new Authentication().withMethod(AuthenticationMethod.ANONYMOUS)) + .withDiscoveredAssetEndpointProfileRef("discoveredAssetEndpointProfile1")) + .create(); + } + + /* + * x-ms-original-file: 2024-09-01-preview/Create_AssetEndpointProfile.json */ /** * Sample code: Create_AssetEndpointProfile. @@ -35,7 +61,8 @@ public final class AssetEndpointProfilesCreateOrReplaceSamples { .withTags(mapOf("site", "building-1")) .withProperties( new AssetEndpointProfileProperties().withTargetAddress("https://www.example.com/myTargetAddress") - .withUserAuthentication(new UserAuthentication().withMode(UserAuthenticationMode.ANONYMOUS))) + .withEndpointProfileType("myEndpointProfileType") + .withAuthentication(new Authentication().withMethod(AuthenticationMethod.ANONYMOUS))) .create(); } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesDeleteSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesDeleteSamples.java index 4e2336722606d..39666bcc05e2b 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesDeleteSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesDeleteSamples.java @@ -9,7 +9,7 @@ */ public final class AssetEndpointProfilesDeleteSamples { /* - * x-ms-original-file: 2023-11-01-preview/Delete_AssetEndpointProfile.json + * x-ms-original-file: 2024-09-01-preview/Delete_AssetEndpointProfile.json */ /** * Sample code: Delete_AssetEndpointProfile. diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesGetByResourceGroupSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesGetByResourceGroupSamples.java index d368f892688fb..b663bea06602b 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesGetByResourceGroupSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesGetByResourceGroupSamples.java @@ -9,7 +9,7 @@ */ public final class AssetEndpointProfilesGetByResourceGroupSamples { /* - * x-ms-original-file: 2023-11-01-preview/Get_AssetEndpointProfile.json + * x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile.json */ /** * Sample code: Get_AssetEndpointProfile. @@ -21,4 +21,19 @@ public static void getAssetEndpointProfile(com.azure.resourcemanager.deviceregis .getByResourceGroupWithResponse("myResourceGroup", "my-assetendpointprofile", com.azure.core.util.Context.NONE); } + + /* + * x-ms-original-file: 2024-09-01-preview/Get_AssetEndpointProfile_With_SyncStatus.json + */ + /** + * Sample code: Get_AssetEndpointProfile_With_SyncStatus. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + getAssetEndpointProfileWithSyncStatus(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.assetEndpointProfiles() + .getByResourceGroupWithResponse("myResourceGroup", "my-assetendpointprofile", + com.azure.core.util.Context.NONE); + } } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesListByResourceGroupSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesListByResourceGroupSamples.java index ff0ea59c900e9..e787068197ae1 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesListByResourceGroupSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesListByResourceGroupSamples.java @@ -9,7 +9,7 @@ */ public final class AssetEndpointProfilesListByResourceGroupSamples { /* - * x-ms-original-file: 2023-11-01-preview/List_AssetEndpointProfiles_ResourceGroup.json + * x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_ResourceGroup.json */ /** * Sample code: List_AssetEndpointProfiles_ResourceGroup. diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesListSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesListSamples.java index bdc3cd5b2a287..ea0d22e16586b 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesListSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesListSamples.java @@ -9,7 +9,7 @@ */ public final class AssetEndpointProfilesListSamples { /* - * x-ms-original-file: 2023-11-01-preview/List_AssetEndpointProfiles_Subscription.json + * x-ms-original-file: 2024-09-01-preview/List_AssetEndpointProfiles_Subscription.json */ /** * Sample code: List_AssetEndpointProfiles_Subscription. diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesUpdateSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesUpdateSamples.java index b17f50f89b865..0b6c02fe658e3 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesUpdateSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetEndpointProfilesUpdateSamples.java @@ -12,7 +12,7 @@ */ public final class AssetEndpointProfilesUpdateSamples { /* - * x-ms-original-file: 2023-11-01-preview/Update_AssetEndpointProfile.json + * x-ms-original-file: 2024-09-01-preview/Update_AssetEndpointProfile.json */ /** * Sample code: Update_AssetEndpointProfile. diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsCreateOrReplaceSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsCreateOrReplaceSamples.java index 79bcdfa6364ca..edd3db1aa956b 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsCreateOrReplaceSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsCreateOrReplaceSamples.java @@ -6,10 +6,13 @@ import com.azure.resourcemanager.deviceregistry.models.AssetProperties; import com.azure.resourcemanager.deviceregistry.models.DataPoint; -import com.azure.resourcemanager.deviceregistry.models.DataPointsObservabilityMode; +import com.azure.resourcemanager.deviceregistry.models.DataPointObservabilityMode; +import com.azure.resourcemanager.deviceregistry.models.Dataset; import com.azure.resourcemanager.deviceregistry.models.Event; -import com.azure.resourcemanager.deviceregistry.models.EventsObservabilityMode; +import com.azure.resourcemanager.deviceregistry.models.EventObservabilityMode; import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; +import com.azure.resourcemanager.deviceregistry.models.Topic; +import com.azure.resourcemanager.deviceregistry.models.TopicRetainType; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -19,7 +22,74 @@ */ public final class AssetsCreateOrReplaceSamples { /* - * x-ms-original-file: 2023-11-01-preview/Create_Asset_Without_ExternalAssetId.json + * x-ms-original-file: 2024-09-01-preview/Create_Asset_With_DiscoveredAssetRef.json + */ + /** + * Sample code: Create_Asset_With_DiscoveredAssetRefs. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + createAssetWithDiscoveredAssetRefs(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.assets() + .define("my-asset") + .withRegion("West Europe") + .withExistingResourceGroup("myResourceGroup") + .withExtendedLocation(new ExtendedLocation().withType("CustomLocation") + .withName( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + .withTags(mapOf("site", "building-1")) + .withProperties(new AssetProperties().withEnabled(true) + .withExternalAssetId("8ZBA6LRHU0A458969") + .withDisplayName("AssetDisplayName") + .withDescription("This is a sample Asset") + .withAssetEndpointProfileRef("myAssetEndpointProfile") + .withManufacturer("Contoso") + .withManufacturerUri("https://www.contoso.com/manufacturerUri") + .withModel("ContosoModel") + .withProductCode("fakeTokenPlaceholder") + .withHardwareRevision("1.0") + .withSoftwareRevision("2.0") + .withDocumentationUri("https://www.example.com/manual") + .withSerialNumber("64-103816-519918-8") + .withDiscoveredAssetRefs(Arrays.asList("discoveredAsset1", "discoveredAsset2")) + .withDefaultDatasetsConfiguration( + "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withDefaultEventsConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withDefaultTopic(new Topic().withPath("/path/defaultTopic").withRetain(TopicRetainType.KEEP)) + .withDatasets(Arrays.asList(new Dataset().withName("dataset1") + .withDatasetConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withTopic(new Topic().withPath("/path/dataset1").withRetain(TopicRetainType.KEEP)) + .withDataPoints(Arrays.asList( + new DataPoint().withName("dataPoint1") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") + .withDataPointConfiguration( + "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(DataPointObservabilityMode.COUNTER), + new DataPoint().withName("dataPoint2") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") + .withDataPointConfiguration( + "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}") + .withObservabilityMode(DataPointObservabilityMode.NONE))))) + .withEvents( + Arrays + .asList( + new Event().withName("event1") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}") + .withTopic(new Topic().withPath("/path/event1").withRetain(TopicRetainType.KEEP)) + .withObservabilityMode(EventObservabilityMode.NONE), + new Event().withName("event2") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(EventObservabilityMode.LOG)))) + .create(); + } + + /* + * x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_ExternalAssetId.json */ /** * Sample code: Create_Asset_Without_ExternalAssetId. @@ -36,11 +106,10 @@ public final class AssetsCreateOrReplaceSamples { .withName( "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) .withTags(mapOf("site", "building-1")) - .withProperties(new AssetProperties().withAssetType("MyAssetType") - .withEnabled(true) + .withProperties(new AssetProperties().withEnabled(true) .withDisplayName("AssetDisplayName") .withDescription("This is a sample Asset") - .withAssetEndpointProfileUri("https://www.example.com/myAssetEndpointProfile") + .withAssetEndpointProfileRef("myAssetEndpointProfile") .withManufacturer("Contoso") .withManufacturerUri("https://www.contoso.com/manufacturerUri") .withModel("ContosoModel") @@ -49,34 +118,43 @@ public final class AssetsCreateOrReplaceSamples { .withSoftwareRevision("2.0") .withDocumentationUri("https://www.example.com/manual") .withSerialNumber("64-103816-519918-8") - .withDefaultDataPointsConfiguration( + .withDefaultDatasetsConfiguration( "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") .withDefaultEventsConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") - .withDataPoints(Arrays.asList( - new DataPoint().withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") - .withCapabilityId("dtmi:com:example:Thermostat:__temperature;1") - .withObservabilityMode(DataPointsObservabilityMode.COUNTER) - .withDataPointConfiguration( - "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - new DataPoint().withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") - .withCapabilityId("dtmi:com:example:Thermostat:__pressure;1") - .withObservabilityMode(DataPointsObservabilityMode.NONE) - .withDataPointConfiguration( - "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"))) - .withEvents(Arrays.asList( - new Event().withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") - .withCapabilityId("dtmi:com:example:Thermostat:__temperature;1") - .withObservabilityMode(EventsObservabilityMode.NONE) - .withEventConfiguration("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - new Event().withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") - .withCapabilityId("dtmi:com:example:Thermostat:__pressure;1") - .withObservabilityMode(EventsObservabilityMode.LOG) - .withEventConfiguration("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}")))) + .withDefaultTopic(new Topic().withPath("/path/defaultTopic").withRetain(TopicRetainType.KEEP)) + .withDatasets(Arrays.asList(new Dataset().withName("dataset1") + .withDatasetConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withTopic(new Topic().withPath("/path/dataset1").withRetain(TopicRetainType.KEEP)) + .withDataPoints(Arrays.asList( + new DataPoint().withName("dataPoint1") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") + .withDataPointConfiguration( + "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(DataPointObservabilityMode.COUNTER), + new DataPoint().withName("dataPoint2") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") + .withDataPointConfiguration( + "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}") + .withObservabilityMode(DataPointObservabilityMode.NONE))))) + .withEvents( + Arrays + .asList( + new Event().withName("event1") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}") + .withTopic(new Topic().withPath("/path/event1").withRetain(TopicRetainType.KEEP)) + .withObservabilityMode(EventObservabilityMode.NONE), + new Event().withName("event2") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(EventObservabilityMode.LOG)))) .create(); } /* - * x-ms-original-file: 2023-11-01-preview/Create_Asset_With_ExternalAssetId.json + * x-ms-original-file: 2024-09-01-preview/Create_Asset_With_ExternalAssetId.json */ /** * Sample code: Create_Asset_With_ExternalAssetId. @@ -93,12 +171,11 @@ public final class AssetsCreateOrReplaceSamples { .withName( "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) .withTags(mapOf("site", "building-1")) - .withProperties(new AssetProperties().withAssetType("MyAssetType") - .withEnabled(true) + .withProperties(new AssetProperties().withEnabled(true) .withExternalAssetId("8ZBA6LRHU0A458969") .withDisplayName("AssetDisplayName") .withDescription("This is a sample Asset") - .withAssetEndpointProfileUri("https://www.example.com/myAssetEndpointProfile") + .withAssetEndpointProfileRef("myAssetEndpointProfile") .withManufacturer("Contoso") .withManufacturerUri("https://www.contoso.com/manufacturerUri") .withModel("ContosoModel") @@ -107,34 +184,43 @@ public final class AssetsCreateOrReplaceSamples { .withSoftwareRevision("2.0") .withDocumentationUri("https://www.example.com/manual") .withSerialNumber("64-103816-519918-8") - .withDefaultDataPointsConfiguration( + .withDefaultDatasetsConfiguration( "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") .withDefaultEventsConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") - .withDataPoints(Arrays.asList( - new DataPoint().withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") - .withCapabilityId("dtmi:com:example:Thermostat:__temperature;1") - .withObservabilityMode(DataPointsObservabilityMode.COUNTER) - .withDataPointConfiguration( - "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - new DataPoint().withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") - .withCapabilityId("dtmi:com:example:Thermostat:__pressure;1") - .withObservabilityMode(DataPointsObservabilityMode.NONE) - .withDataPointConfiguration( - "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"))) - .withEvents(Arrays.asList( - new Event().withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") - .withCapabilityId("dtmi:com:example:Thermostat:__temperature;1") - .withObservabilityMode(EventsObservabilityMode.NONE) - .withEventConfiguration("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - new Event().withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") - .withCapabilityId("dtmi:com:example:Thermostat:__pressure;1") - .withObservabilityMode(EventsObservabilityMode.LOG) - .withEventConfiguration("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}")))) + .withDefaultTopic(new Topic().withPath("/path/defaultTopic").withRetain(TopicRetainType.KEEP)) + .withDatasets(Arrays.asList(new Dataset().withName("dataset1") + .withDatasetConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withTopic(new Topic().withPath("/path/dataset1").withRetain(TopicRetainType.KEEP)) + .withDataPoints(Arrays.asList( + new DataPoint().withName("dataPoint1") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") + .withDataPointConfiguration( + "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(DataPointObservabilityMode.COUNTER), + new DataPoint().withName("dataPoint2") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") + .withDataPointConfiguration( + "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}") + .withObservabilityMode(DataPointObservabilityMode.NONE))))) + .withEvents( + Arrays + .asList( + new Event().withName("event1") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}") + .withTopic(new Topic().withPath("/path/event1").withRetain(TopicRetainType.KEEP)) + .withObservabilityMode(EventObservabilityMode.NONE), + new Event().withName("event2") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(EventObservabilityMode.LOG)))) .create(); } /* - * x-ms-original-file: 2023-11-01-preview/Create_Asset_Without_DisplayName.json + * x-ms-original-file: 2024-09-01-preview/Create_Asset_Without_DisplayName.json */ /** * Sample code: Create_Asset_Without_DisplayName. @@ -151,11 +237,10 @@ public final class AssetsCreateOrReplaceSamples { .withName( "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) .withTags(mapOf("site", "building-1")) - .withProperties(new AssetProperties().withAssetType("MyAssetType") - .withEnabled(true) + .withProperties(new AssetProperties().withEnabled(true) .withExternalAssetId("8ZBA6LRHU0A458969") .withDescription("This is a sample Asset") - .withAssetEndpointProfileUri("https://www.example.com/myAssetEndpointProfile") + .withAssetEndpointProfileRef("myAssetEndpointProfile") .withManufacturer("Contoso") .withManufacturerUri("https://www.contoso.com/manufacturerUri") .withModel("ContosoModel") @@ -164,29 +249,38 @@ public final class AssetsCreateOrReplaceSamples { .withSoftwareRevision("2.0") .withDocumentationUri("https://www.example.com/manual") .withSerialNumber("64-103816-519918-8") - .withDefaultDataPointsConfiguration( + .withDefaultDatasetsConfiguration( "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") .withDefaultEventsConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") - .withDataPoints(Arrays.asList( - new DataPoint().withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") - .withCapabilityId("dtmi:com:example:Thermostat:__temperature;1") - .withObservabilityMode(DataPointsObservabilityMode.COUNTER) - .withDataPointConfiguration( - "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - new DataPoint().withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") - .withCapabilityId("dtmi:com:example:Thermostat:__pressure;1") - .withObservabilityMode(DataPointsObservabilityMode.NONE) - .withDataPointConfiguration( - "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"))) - .withEvents(Arrays.asList( - new Event().withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") - .withCapabilityId("dtmi:com:example:Thermostat:__temperature;1") - .withObservabilityMode(EventsObservabilityMode.NONE) - .withEventConfiguration("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - new Event().withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") - .withCapabilityId("dtmi:com:example:Thermostat:__pressure;1") - .withObservabilityMode(EventsObservabilityMode.LOG) - .withEventConfiguration("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}")))) + .withDefaultTopic(new Topic().withPath("/path/defaultTopic").withRetain(TopicRetainType.KEEP)) + .withDatasets(Arrays.asList(new Dataset().withName("dataset1") + .withDatasetConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withTopic(new Topic().withPath("/path/dataset1").withRetain(TopicRetainType.KEEP)) + .withDataPoints(Arrays.asList( + new DataPoint().withName("dataPoint1") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") + .withDataPointConfiguration( + "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(DataPointObservabilityMode.COUNTER), + new DataPoint().withName("dataPoint2") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") + .withDataPointConfiguration( + "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}") + .withObservabilityMode(DataPointObservabilityMode.NONE))))) + .withEvents( + Arrays + .asList( + new Event().withName("event1") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}") + .withTopic(new Topic().withPath("/path/event1").withRetain(TopicRetainType.KEEP)) + .withObservabilityMode(EventObservabilityMode.NONE), + new Event().withName("event2") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") + .withEventConfiguration( + "{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}") + .withObservabilityMode(EventObservabilityMode.LOG)))) .create(); } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsDeleteSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsDeleteSamples.java index 70cfaccb1bf71..ab590b114b161 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsDeleteSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsDeleteSamples.java @@ -9,7 +9,7 @@ */ public final class AssetsDeleteSamples { /* - * x-ms-original-file: 2023-11-01-preview/Delete_Asset.json + * x-ms-original-file: 2024-09-01-preview/Delete_Asset.json */ /** * Sample code: Delete_Asset. diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsGetByResourceGroupSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsGetByResourceGroupSamples.java index c731ac32bf413..6d2718dfa05d0 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsGetByResourceGroupSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsGetByResourceGroupSamples.java @@ -9,7 +9,7 @@ */ public final class AssetsGetByResourceGroupSamples { /* - * x-ms-original-file: 2023-11-01-preview/Get_Asset_With_SyncStatus.json + * x-ms-original-file: 2024-09-01-preview/Get_Asset_With_SyncStatus.json */ /** * Sample code: Get_Asset_With_SyncStatus. @@ -22,7 +22,7 @@ public static void getAssetWithSyncStatus(com.azure.resourcemanager.deviceregist } /* - * x-ms-original-file: 2023-11-01-preview/Get_Asset.json + * x-ms-original-file: 2024-09-01-preview/Get_Asset.json */ /** * Sample code: Get_Asset. diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsListByResourceGroupSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsListByResourceGroupSamples.java index 8b174d5e66b8b..7181801b9f46e 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsListByResourceGroupSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsListByResourceGroupSamples.java @@ -9,7 +9,7 @@ */ public final class AssetsListByResourceGroupSamples { /* - * x-ms-original-file: 2023-11-01-preview/List_Assets_ResourceGroup.json + * x-ms-original-file: 2024-09-01-preview/List_Assets_ResourceGroup.json */ /** * Sample code: List_Assets_ResourceGroup. diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsListSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsListSamples.java index 7dd988b7f8db1..053425992e966 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsListSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsListSamples.java @@ -9,7 +9,7 @@ */ public final class AssetsListSamples { /* - * x-ms-original-file: 2023-11-01-preview/List_Assets_Subscription.json + * x-ms-original-file: 2024-09-01-preview/List_Assets_Subscription.json */ /** * Sample code: List_Assets_Subscription. diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsUpdateSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsUpdateSamples.java index 91a1293023976..d9aab729ee3ba 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsUpdateSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/AssetsUpdateSamples.java @@ -12,7 +12,7 @@ */ public final class AssetsUpdateSamples { /* - * x-ms-original-file: 2023-11-01-preview/Update_Asset.json + * x-ms-original-file: 2024-09-01-preview/Update_Asset.json */ /** * Sample code: Update_Asset. diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersGetSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersGetSamples.java new file mode 100644 index 0000000000000..59d3ddaea2983 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for BillingContainers Get. + */ +public final class BillingContainersGetSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Get_BillingContainer.json + */ + /** + * Sample code: Get_BillingContainer. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void getBillingContainer(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.billingContainers().getWithResponse("my-billingContainer", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersListSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersListSamples.java new file mode 100644 index 0000000000000..91c0c29f8adab --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for BillingContainers List. + */ +public final class BillingContainersListSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_BillingContainers_Subscription.json + */ + /** + * Sample code: List_BillingContainers_Subscription. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listBillingContainersSubscription(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.billingContainers().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesCreateOrReplaceSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesCreateOrReplaceSamples.java new file mode 100644 index 0000000000000..980379745ac56 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesCreateOrReplaceSamples.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileProperties; +import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DiscoveredAssetEndpointProfiles CreateOrReplace. + */ +public final class DiscoveredAssetEndpointProfilesCreateOrReplaceSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAssetEndpointProfile.json + */ + /** + * Sample code: Create_DiscoveredAssetEndpointProfile. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + createDiscoveredAssetEndpointProfile(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssetEndpointProfiles() + .define("my-discoveredassetendpointprofile") + .withRegion("West Europe") + .withExistingResourceGroup("myResourceGroup") + .withExtendedLocation(new ExtendedLocation().withType("CustomLocation") + .withName( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + .withTags(mapOf("site", "building-1")) + .withProperties(new DiscoveredAssetEndpointProfileProperties() + .withTargetAddress("https://www.example.com/myTargetAddress") + .withAdditionalConfiguration("{\"foo\": \"bar\"}") + .withSupportedAuthenticationMethods(Arrays.asList(AuthenticationMethod.ANONYMOUS, + AuthenticationMethod.CERTIFICATE, AuthenticationMethod.USERNAME_PASSWORD)) + .withEndpointProfileType("myEndpointProfileType") + .withDiscoveryId("11111111-1111-1111-1111-111111111111") + .withVersion(73766L)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesDeleteSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesDeleteSamples.java new file mode 100644 index 0000000000000..66932617ea709 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for DiscoveredAssetEndpointProfiles Delete. + */ +public final class DiscoveredAssetEndpointProfilesDeleteSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAssetEndpointProfile.json + */ + /** + * Sample code: Delete_DiscoveredAssetEndpointProfile. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + deleteDiscoveredAssetEndpointProfile(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssetEndpointProfiles() + .delete("myResourceGroup", "my-discoveredassetendpointprofile", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesGetByResourceGroupSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..902d001083129 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesGetByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for DiscoveredAssetEndpointProfiles GetByResourceGroup. + */ +public final class DiscoveredAssetEndpointProfilesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAssetEndpointProfile.json + */ + /** + * Sample code: Get_DiscoveredAssetEndpointProfile. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + getDiscoveredAssetEndpointProfile(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssetEndpointProfiles() + .getByResourceGroupWithResponse("myResourceGroup", "my-discoveredassetendpointprofile", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListByResourceGroupSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..e5ba678362171 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for DiscoveredAssetEndpointProfiles ListByResourceGroup. + */ +public final class DiscoveredAssetEndpointProfilesListByResourceGroupSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_ResourceGroup.json + */ + /** + * Sample code: List_DiscoveredAssetEndpointProfiles_ResourceGroup. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void listDiscoveredAssetEndpointProfilesResourceGroup( + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssetEndpointProfiles() + .listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListSamples.java new file mode 100644 index 0000000000000..3e70c95f7add0 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for DiscoveredAssetEndpointProfiles List. + */ +public final class DiscoveredAssetEndpointProfilesListSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssetEndpointProfiles_Subscription.json + */ + /** + * Sample code: List_DiscoveredAssetEndpointProfiles_Subscription. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void listDiscoveredAssetEndpointProfilesSubscription( + com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssetEndpointProfiles().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesUpdateSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesUpdateSamples.java new file mode 100644 index 0000000000000..9f1f74a9c58b5 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfile; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileUpdateProperties; +import java.util.Arrays; + +/** + * Samples for DiscoveredAssetEndpointProfiles Update. + */ +public final class DiscoveredAssetEndpointProfilesUpdateSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAssetEndpointProfile.json + */ + /** + * Sample code: Update_DiscoveredAssetEndpointProfile. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + updateDiscoveredAssetEndpointProfile(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + DiscoveredAssetEndpointProfile resource = manager.discoveredAssetEndpointProfiles() + .getByResourceGroupWithResponse("myResourceGroup", "my-discoveredassetendpointprofile", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new DiscoveredAssetEndpointProfileUpdateProperties() + .withTargetAddress("https://www.example.com/myTargetAddress") + .withAdditionalConfiguration("{\"foo\": \"bar\"}") + .withSupportedAuthenticationMethods( + Arrays.asList(AuthenticationMethod.ANONYMOUS, AuthenticationMethod.CERTIFICATE)) + .withEndpointProfileType("myEndpointProfileType") + .withDiscoveryId("11111111-1111-1111-1111-111111111111") + .withVersion(73766L)) + .apply(); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsCreateOrReplaceSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsCreateOrReplaceSamples.java new file mode 100644 index 0000000000000..7b827e572ffa6 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsCreateOrReplaceSamples.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetProperties; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredDataPoint; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredDataset; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredEvent; +import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; +import com.azure.resourcemanager.deviceregistry.models.Topic; +import com.azure.resourcemanager.deviceregistry.models.TopicRetainType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DiscoveredAssets CreateOrReplace. + */ +public final class DiscoveredAssetsCreateOrReplaceSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Create_DiscoveredAsset.json + */ + /** + * Sample code: Create_DiscoveredAsset. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void createDiscoveredAsset(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssets() + .define("my-discoveredasset") + .withRegion("West Europe") + .withExistingResourceGroup("myResourceGroup") + .withExtendedLocation(new ExtendedLocation().withType("CustomLocation") + .withName( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1")) + .withTags(mapOf("site", "building-1")) + .withProperties(new DiscoveredAssetProperties().withAssetEndpointProfileRef("myAssetEndpointProfile") + .withDiscoveryId("11111111-1111-1111-1111-111111111111") + .withVersion(73766L) + .withManufacturer("Contoso") + .withManufacturerUri("https://www.contoso.com/manufacturerUri") + .withModel("ContosoModel") + .withProductCode("fakeTokenPlaceholder") + .withHardwareRevision("1.0") + .withSoftwareRevision("2.0") + .withDocumentationUri("https://www.example.com/manual") + .withSerialNumber("64-103816-519918-8") + .withDefaultDatasetsConfiguration( + "{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withDefaultEventsConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withDefaultTopic(new Topic().withPath("/path/defaultTopic").withRetain(TopicRetainType.KEEP)) + .withDatasets(Arrays.asList(new DiscoveredDataset().withName("dataset1") + .withDatasetConfiguration("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}") + .withTopic(new Topic().withPath("/path/dataset1").withRetain(TopicRetainType.KEEP)) + .withDataPoints(Arrays.asList( + new DiscoveredDataPoint().withName("dataPoint1") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1") + .withDataPointConfiguration( + "{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), + new DiscoveredDataPoint().withName("dataPoint2") + .withDataSource("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2") + .withDataPointConfiguration( + "{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"))))) + .withEvents(Arrays.asList( + new DiscoveredEvent().withName("event1") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3") + .withEventConfiguration("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}") + .withTopic(new Topic().withPath("/path/event1").withRetain(TopicRetainType.KEEP)), + new DiscoveredEvent().withName("event2") + .withEventNotifier("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4") + .withEventConfiguration("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}")))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsDeleteSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsDeleteSamples.java new file mode 100644 index 0000000000000..0d59bfe0d1a55 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for DiscoveredAssets Delete. + */ +public final class DiscoveredAssetsDeleteSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Delete_DiscoveredAsset.json + */ + /** + * Sample code: Delete_DiscoveredAsset. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void deleteDiscoveredAsset(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssets().delete("myResourceGroup", "my-discoveredasset", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsGetByResourceGroupSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..0023b0ec8197b --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for DiscoveredAssets GetByResourceGroup. + */ +public final class DiscoveredAssetsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Get_DiscoveredAsset.json + */ + /** + * Sample code: Get_DiscoveredAsset. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void getDiscoveredAsset(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssets() + .getByResourceGroupWithResponse("myResourceGroup", "my-discoveredasset", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsListByResourceGroupSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..fd6cea3872ad8 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for DiscoveredAssets ListByResourceGroup. + */ +public final class DiscoveredAssetsListByResourceGroupSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_ResourceGroup.json + */ + /** + * Sample code: List_DiscoveredAssets_ResourceGroup. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listDiscoveredAssetsResourceGroup(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssets().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsListSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsListSamples.java new file mode 100644 index 0000000000000..e8998ccfa8bdb --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for DiscoveredAssets List. + */ +public final class DiscoveredAssetsListSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_DiscoveredAssets_Subscription.json + */ + /** + * Sample code: List_DiscoveredAssets_Subscription. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listDiscoveredAssetsSubscription(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.discoveredAssets().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsUpdateSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsUpdateSamples.java new file mode 100644 index 0000000000000..41de069e6c7e3 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetsUpdateSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAsset; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetUpdateProperties; +import com.azure.resourcemanager.deviceregistry.models.Topic; +import com.azure.resourcemanager.deviceregistry.models.TopicRetainType; + +/** + * Samples for DiscoveredAssets Update. + */ +public final class DiscoveredAssetsUpdateSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Update_DiscoveredAsset.json + */ + /** + * Sample code: Update_DiscoveredAsset. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void updateDiscoveredAsset(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + DiscoveredAsset resource = manager.discoveredAssets() + .getByResourceGroupWithResponse("myResourceGroup", "my-discoveredasset", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties( + new DiscoveredAssetUpdateProperties().withDocumentationUri("https://www.example.com/manual-2") + .withDefaultTopic(new Topic().withPath("/path/defaultTopic").withRetain(TopicRetainType.NEVER))) + .apply(); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/OperationStatusGetSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/OperationStatusGetSamples.java index c1cb56d591479..75ca8405dbfe8 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/OperationStatusGetSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/OperationStatusGetSamples.java @@ -9,7 +9,7 @@ */ public final class OperationStatusGetSamples { /* - * x-ms-original-file: 2023-11-01-preview/Get_OperationStatus.json + * x-ms-original-file: 2024-09-01-preview/Get_OperationStatus.json */ /** * Sample code: Get_OperationStatus. diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/OperationsListSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/OperationsListSamples.java index 6bbe4acb0d33a..675cc123c41f5 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/OperationsListSamples.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/OperationsListSamples.java @@ -9,7 +9,7 @@ */ public final class OperationsListSamples { /* - * x-ms-original-file: 2023-11-01-preview/List_Operations.json + * x-ms-original-file: 2024-09-01-preview/List_Operations.json */ /** * Sample code: List_Operations. diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesCreateOrReplaceSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesCreateOrReplaceSamples.java new file mode 100644 index 0000000000000..aedf0714bcd28 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesCreateOrReplaceSamples.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryProperties; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentityType; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SchemaRegistries CreateOrReplace. + */ +public final class SchemaRegistriesCreateOrReplaceSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Create_SchemaRegistry.json + */ + /** + * Sample code: Create_SchemaRegistry. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void createSchemaRegistry(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaRegistries() + .define("my-schema-registry") + .withRegion("West Europe") + .withExistingResourceGroup("myResourceGroup") + .withTags(mapOf()) + .withProperties(new SchemaRegistryProperties().withNamespace("sr-namespace-001") + .withDisplayName("Schema Registry namespace 001") + .withDescription("This is a sample Schema Registry") + .withStorageAccountContainerUrl("my-blob-storage.blob.core.windows.net/my-container")) + .withIdentity(new SystemAssignedServiceIdentity().withType(SystemAssignedServiceIdentityType.NONE)) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesDeleteSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesDeleteSamples.java new file mode 100644 index 0000000000000..118576c57f94f --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for SchemaRegistries Delete. + */ +public final class SchemaRegistriesDeleteSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Delete_SchemaRegistry.json + */ + /** + * Sample code: Delete_SchemaRegistry. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void deleteSchemaRegistry(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaRegistries().delete("myResourceGroup", "my-schema-registry", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesGetByResourceGroupSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..87c8c6c91764e --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for SchemaRegistries GetByResourceGroup. + */ +public final class SchemaRegistriesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Get_SchemaRegistry.json + */ + /** + * Sample code: Get_SchemaRegistry. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void getSchemaRegistry(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaRegistries() + .getByResourceGroupWithResponse("myResourceGroup", "my-schema-registry", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListByResourceGroupSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..53766e391b4cb --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for SchemaRegistries ListByResourceGroup. + */ +public final class SchemaRegistriesListByResourceGroupSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_ResourceGroup.json + */ + /** + * Sample code: List_SchemaRegistries_ResourceGroup. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listSchemaRegistriesResourceGroup(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaRegistries().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListSamples.java new file mode 100644 index 0000000000000..cda2ad2af26cf --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for SchemaRegistries List. + */ +public final class SchemaRegistriesListSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_SchemaRegistries_Subscription.json + */ + /** + * Sample code: List_SchemaRegistries_Subscription. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listSchemaRegistriesSubscription(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaRegistries().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesUpdateSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesUpdateSamples.java new file mode 100644 index 0000000000000..136bb88fa5502 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistry; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryUpdateProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for SchemaRegistries Update. + */ +public final class SchemaRegistriesUpdateSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Update_SchemaRegistry.json + */ + /** + * Sample code: Update_SchemaRegistry. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void updateSchemaRegistry(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + SchemaRegistry resource = manager.schemaRegistries() + .getByResourceGroupWithResponse("myResourceGroup", "my-schema-registry", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf()) + .withProperties(new SchemaRegistryUpdateProperties().withDisplayName("Schema Registry namespace 001") + .withDescription("This is a sample Schema Registry")) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsCreateOrReplaceSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsCreateOrReplaceSamples.java new file mode 100644 index 0000000000000..6a5824352539b --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsCreateOrReplaceSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.resourcemanager.deviceregistry.models.SchemaVersionProperties; + +/** + * Samples for SchemaVersions CreateOrReplace. + */ +public final class SchemaVersionsCreateOrReplaceSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Create_SchemaVersion.json + */ + /** + * Sample code: Create_SchemaVersion. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void createSchemaVersion(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaVersions() + .define("1") + .withExistingSchema("myResourceGroup", "my-schema-registry", "my-schema") + .withProperties(new SchemaVersionProperties().withDescription("Schema version 1") + .withSchemaContent( + "{\"$schema\": \"http://json-schema.org/draft-07/schema#\",\"type\": \"object\",\"properties\": {\"humidity\": {\"type\": \"string\"},\"temperature\": {\"type\":\"number\"}}}")) + .create(); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsDeleteSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsDeleteSamples.java new file mode 100644 index 0000000000000..6fcc426be6c3a --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for SchemaVersions Delete. + */ +public final class SchemaVersionsDeleteSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Delete_SchemaVersion.json + */ + /** + * Sample code: Delete_SchemaVersion. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void deleteSchemaVersion(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaVersions() + .deleteWithResponse("myResourceGroup", "my-schema-registry", "my-schema", "1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsGetSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsGetSamples.java new file mode 100644 index 0000000000000..138db4a3ba6e3 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for SchemaVersions Get. + */ +public final class SchemaVersionsGetSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Get_SchemaVersion.json + */ + /** + * Sample code: Get_SchemaVersion. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void getSchemaVersion(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaVersions() + .getWithResponse("myResourceGroup", "my-schema-registry", "my-schema", "1", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsListBySchemaSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsListBySchemaSamples.java new file mode 100644 index 0000000000000..da174a8b4672c --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsListBySchemaSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for SchemaVersions ListBySchema. + */ +public final class SchemaVersionsListBySchemaSamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_SchemaVersions_Schema.json + */ + /** + * Sample code: List_SchemaVersions_Schema. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listSchemaVersionsSchema(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemaVersions() + .listBySchema("myResourceGroup", "my-schema-registry", "my-schema", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasCreateOrReplaceSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasCreateOrReplaceSamples.java new file mode 100644 index 0000000000000..d063442e01d63 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasCreateOrReplaceSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.resourcemanager.deviceregistry.models.Format; +import com.azure.resourcemanager.deviceregistry.models.SchemaProperties; +import com.azure.resourcemanager.deviceregistry.models.SchemaType; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Schemas CreateOrReplace. + */ +public final class SchemasCreateOrReplaceSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Create_Schema.json + */ + /** + * Sample code: Create_Schema. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void createSchema(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemas() + .define("my-schema") + .withExistingSchemaRegistry("myResourceGroup", "my-schema-registry") + .withProperties(new SchemaProperties().withDisplayName("My Schema") + .withDescription("This is a sample Schema") + .withFormat(Format.JSON_SCHEMA_DRAFT7) + .withSchemaType(SchemaType.MESSAGE_SCHEMA) + .withTags(mapOf("sampleKey", "fakeTokenPlaceholder"))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasDeleteSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasDeleteSamples.java new file mode 100644 index 0000000000000..a9a7fb3b83db5 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for Schemas Delete. + */ +public final class SchemasDeleteSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Delete_Schema.json + */ + /** + * Sample code: Delete_Schema. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void deleteSchema(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemas() + .deleteWithResponse("myResourceGroup", "my-schema-registry", "my-schema", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasGetSamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasGetSamples.java new file mode 100644 index 0000000000000..52af6cc3fdc2a --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for Schemas Get. + */ +public final class SchemasGetSamples { + /* + * x-ms-original-file: 2024-09-01-preview/Get_Schema.json + */ + /** + * Sample code: Schemas_Get. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void schemasGet(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemas() + .getWithResponse("myResourceGroup", "my-schema-registry", "my-schema", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasListBySchemaRegistrySamples.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasListBySchemaRegistrySamples.java new file mode 100644 index 0000000000000..4fd405c92e5b2 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/samples/java/com/azure/resourcemanager/deviceregistry/generated/SchemasListBySchemaRegistrySamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +/** + * Samples for Schemas ListBySchemaRegistry. + */ +public final class SchemasListBySchemaRegistrySamples { + /* + * x-ms-original-file: 2024-09-01-preview/List_Schemas_SchemaRegistry.json + */ + /** + * Sample code: List_Schemas_SchemaRegistry. + * + * @param manager Entry point to DeviceRegistryManager. + */ + public static void + listSchemasSchemaRegistry(com.azure.resourcemanager.deviceregistry.DeviceRegistryManager manager) { + manager.schemas() + .listBySchemaRegistry("myResourceGroup", "my-schema-registry", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/AssetStatusDatasetTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/AssetStatusDatasetTests.java new file mode 100644 index 0000000000000..4e6338931caec --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/AssetStatusDatasetTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.AssetStatusDataset; + +public final class AssetStatusDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AssetStatusDataset model = BinaryData.fromString( + "{\"name\":\"wyiftyhxhur\",\"messageSchemaReference\":{\"schemaRegistryNamespace\":\"ftyxolniw\",\"schemaName\":\"wcukjfkgiawxk\",\"schemaVersion\":\"ryplwckbasyypn\"}}") + .toObject(AssetStatusDataset.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/AssetStatusEventTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/AssetStatusEventTests.java new file mode 100644 index 0000000000000..4472dbd0570a6 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/AssetStatusEventTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.AssetStatusEvent; + +public final class AssetStatusEventTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AssetStatusEvent model = BinaryData.fromString( + "{\"name\":\"gakeqsr\",\"messageSchemaReference\":{\"schemaRegistryNamespace\":\"bzqqedqytbciq\",\"schemaName\":\"ouf\",\"schemaVersion\":\"mmnkzsmodmgl\"}}") + .toObject(AssetStatusEvent.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainerInnerTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainerInnerTests.java new file mode 100644 index 0000000000000..8122365ed8830 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainerInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.fluent.models.BillingContainerInner; + +public final class BillingContainerInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BillingContainerInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Canceled\"},\"etag\":\"jpgd\",\"id\":\"ocjjxhvpmouexh\",\"name\":\"zxibqeoj\",\"type\":\"xqbzvddntwnd\"}") + .toObject(BillingContainerInner.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainerListResultTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainerListResultTests.java new file mode 100644 index 0000000000000..d7b01712bfe45 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainerListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.implementation.models.BillingContainerListResult; +import org.junit.jupiter.api.Assertions; + +public final class BillingContainerListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BillingContainerListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Accepted\"},\"etag\":\"zao\",\"id\":\"uhrhcffcyddgl\",\"name\":\"jthjqkwpyei\",\"type\":\"xmqci\"},{\"properties\":{\"provisioningState\":\"Failed\"},\"etag\":\"hix\",\"id\":\"gdtopbobjogh\",\"name\":\"e\",\"type\":\"u\"},{\"properties\":{\"provisioningState\":\"Accepted\"},\"etag\":\"rzayv\",\"id\":\"pgvdf\",\"name\":\"iotkftutqxl\",\"type\":\"gxlefgugnxkrxd\"},{\"properties\":{\"provisioningState\":\"Succeeded\"},\"etag\":\"thz\",\"id\":\"qdrabhjybigehoqf\",\"name\":\"owskanyktz\",\"type\":\"cuiywgqyw\"}],\"nextLink\":\"drvyn\"}") + .toObject(BillingContainerListResult.class); + Assertions.assertEquals("drvyn", model.nextLink()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainerPropertiesTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainerPropertiesTests.java new file mode 100644 index 0000000000000..4166887b4b649 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainerPropertiesTests.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.BillingContainerProperties; + +public final class BillingContainerPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BillingContainerProperties model + = BinaryData.fromString("{\"provisioningState\":\"Succeeded\"}").toObject(BillingContainerProperties.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersGetWithResponseMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersGetWithResponseMockTests.java new file mode 100644 index 0000000000000..8901a275a6f6c --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersGetWithResponseMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.BillingContainer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class BillingContainersGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Deleting\"},\"etag\":\"cogjltdtbn\",\"id\":\"adoocrkvc\",\"name\":\"khnvpam\",\"type\":\"gxqquezik\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + BillingContainer response + = manager.billingContainers().getWithResponse("xdy", com.azure.core.util.Context.NONE).getValue(); + + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersListMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersListMockTests.java new file mode 100644 index 0000000000000..d6bfd0372c2c8 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/BillingContainersListMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.BillingContainer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class BillingContainersListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Deleting\"},\"etag\":\"kallatmel\",\"id\":\"ipicc\",\"name\":\"zkzivgvvcnay\",\"type\":\"hyrnxxmu\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.billingContainers().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DataPointBaseTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DataPointBaseTests.java new file mode 100644 index 0000000000000..d17d63b1179c1 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DataPointBaseTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.DataPointBase; +import org.junit.jupiter.api.Assertions; + +public final class DataPointBaseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DataPointBase model = BinaryData.fromString( + "{\"name\":\"cjdkwtnhxbnjbi\",\"dataSource\":\"sqrglssainq\",\"dataPointConfiguration\":\"wnzlljfmppeeb\"}") + .toObject(DataPointBase.class); + Assertions.assertEquals("cjdkwtnhxbnjbi", model.name()); + Assertions.assertEquals("sqrglssainq", model.dataSource()); + Assertions.assertEquals("wnzlljfmppeeb", model.dataPointConfiguration()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DataPointBase model = new DataPointBase().withName("cjdkwtnhxbnjbi") + .withDataSource("sqrglssainq") + .withDataPointConfiguration("wnzlljfmppeeb"); + model = BinaryData.fromObject(model).toObject(DataPointBase.class); + Assertions.assertEquals("cjdkwtnhxbnjbi", model.name()); + Assertions.assertEquals("sqrglssainq", model.dataSource()); + Assertions.assertEquals("wnzlljfmppeeb", model.dataPointConfiguration()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DataPointTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DataPointTests.java index 551911da36c3d..992d9fffb72d8 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DataPointTests.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DataPointTests.java @@ -6,34 +6,31 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.deviceregistry.models.DataPoint; -import com.azure.resourcemanager.deviceregistry.models.DataPointsObservabilityMode; +import com.azure.resourcemanager.deviceregistry.models.DataPointObservabilityMode; import org.junit.jupiter.api.Assertions; public final class DataPointTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { DataPoint model = BinaryData.fromString( - "{\"name\":\"zidnsezcxtbzsgfy\",\"dataSource\":\"cs\",\"capabilityId\":\"wmdwzjeiachboo\",\"observabilityMode\":\"gauge\",\"dataPointConfiguration\":\"ro\"}") + "{\"observabilityMode\":\"Log\",\"name\":\"xxwr\",\"dataSource\":\"jdous\",\"dataPointConfiguration\":\"qvkoc\"}") .toObject(DataPoint.class); - Assertions.assertEquals("zidnsezcxtbzsgfy", model.name()); - Assertions.assertEquals("cs", model.dataSource()); - Assertions.assertEquals("wmdwzjeiachboo", model.capabilityId()); - Assertions.assertEquals(DataPointsObservabilityMode.GAUGE, model.observabilityMode()); - Assertions.assertEquals("ro", model.dataPointConfiguration()); + Assertions.assertEquals("xxwr", model.name()); + Assertions.assertEquals("jdous", model.dataSource()); + Assertions.assertEquals("qvkoc", model.dataPointConfiguration()); + Assertions.assertEquals(DataPointObservabilityMode.LOG, model.observabilityMode()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - DataPoint model = new DataPoint().withName("zidnsezcxtbzsgfy") - .withDataSource("cs") - .withCapabilityId("wmdwzjeiachboo") - .withObservabilityMode(DataPointsObservabilityMode.GAUGE) - .withDataPointConfiguration("ro"); + DataPoint model = new DataPoint().withName("xxwr") + .withDataSource("jdous") + .withDataPointConfiguration("qvkoc") + .withObservabilityMode(DataPointObservabilityMode.LOG); model = BinaryData.fromObject(model).toObject(DataPoint.class); - Assertions.assertEquals("zidnsezcxtbzsgfy", model.name()); - Assertions.assertEquals("cs", model.dataSource()); - Assertions.assertEquals("wmdwzjeiachboo", model.capabilityId()); - Assertions.assertEquals(DataPointsObservabilityMode.GAUGE, model.observabilityMode()); - Assertions.assertEquals("ro", model.dataPointConfiguration()); + Assertions.assertEquals("xxwr", model.name()); + Assertions.assertEquals("jdous", model.dataSource()); + Assertions.assertEquals("qvkoc", model.dataPointConfiguration()); + Assertions.assertEquals(DataPointObservabilityMode.LOG, model.observabilityMode()); } } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DatasetTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DatasetTests.java new file mode 100644 index 0000000000000..5e82aa5532ee1 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DatasetTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.DataPoint; +import com.azure.resourcemanager.deviceregistry.models.DataPointObservabilityMode; +import com.azure.resourcemanager.deviceregistry.models.Dataset; +import com.azure.resourcemanager.deviceregistry.models.Topic; +import com.azure.resourcemanager.deviceregistry.models.TopicRetainType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Dataset model = BinaryData.fromString( + "{\"name\":\"narxzxtheotus\",\"datasetConfiguration\":\"yevc\",\"topic\":{\"path\":\"qi\",\"retain\":\"Never\"},\"dataPoints\":[{\"observabilityMode\":\"Gauge\",\"name\":\"wjzrnfygxgisp\",\"dataSource\":\"mvtzfkufub\",\"dataPointConfiguration\":\"ofx\"},{\"observabilityMode\":\"None\",\"name\":\"fjaeq\",\"dataSource\":\"hqjbasvmsmj\",\"dataPointConfiguration\":\"lngsntnbybkzgcwr\"}]}") + .toObject(Dataset.class); + Assertions.assertEquals("narxzxtheotus", model.name()); + Assertions.assertEquals("yevc", model.datasetConfiguration()); + Assertions.assertEquals("qi", model.topic().path()); + Assertions.assertEquals(TopicRetainType.NEVER, model.topic().retain()); + Assertions.assertEquals("wjzrnfygxgisp", model.dataPoints().get(0).name()); + Assertions.assertEquals("mvtzfkufub", model.dataPoints().get(0).dataSource()); + Assertions.assertEquals("ofx", model.dataPoints().get(0).dataPointConfiguration()); + Assertions.assertEquals(DataPointObservabilityMode.GAUGE, model.dataPoints().get(0).observabilityMode()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Dataset model = new Dataset().withName("narxzxtheotus") + .withDatasetConfiguration("yevc") + .withTopic(new Topic().withPath("qi").withRetain(TopicRetainType.NEVER)) + .withDataPoints(Arrays.asList( + new DataPoint().withName("wjzrnfygxgisp") + .withDataSource("mvtzfkufub") + .withDataPointConfiguration("ofx") + .withObservabilityMode(DataPointObservabilityMode.GAUGE), + new DataPoint().withName("fjaeq") + .withDataSource("hqjbasvmsmj") + .withDataPointConfiguration("lngsntnbybkzgcwr") + .withObservabilityMode(DataPointObservabilityMode.NONE))); + model = BinaryData.fromObject(model).toObject(Dataset.class); + Assertions.assertEquals("narxzxtheotus", model.name()); + Assertions.assertEquals("yevc", model.datasetConfiguration()); + Assertions.assertEquals("qi", model.topic().path()); + Assertions.assertEquals(TopicRetainType.NEVER, model.topic().retain()); + Assertions.assertEquals("wjzrnfygxgisp", model.dataPoints().get(0).name()); + Assertions.assertEquals("mvtzfkufub", model.dataPoints().get(0).dataSource()); + Assertions.assertEquals("ofx", model.dataPoints().get(0).dataPointConfiguration()); + Assertions.assertEquals(DataPointObservabilityMode.GAUGE, model.dataPoints().get(0).observabilityMode()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileInnerTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileInnerTests.java new file mode 100644 index 0000000000000..8d5b39b78b327 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileInnerTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.fluent.models.DiscoveredAssetEndpointProfileInner; +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileProperties; +import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DiscoveredAssetEndpointProfileInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoveredAssetEndpointProfileInner model = BinaryData.fromString( + "{\"properties\":{\"targetAddress\":\"xbczwtruwiqz\",\"additionalConfiguration\":\"j\",\"supportedAuthenticationMethods\":[\"Certificate\"],\"endpointProfileType\":\"myokacspkwlh\",\"discoveryId\":\"dobpxjmflbvvn\",\"version\":2925444529354115235,\"provisioningState\":\"Canceled\"},\"extendedLocation\":{\"type\":\"ciwwzjuqkhr\",\"name\":\"ajiwkuo\"},\"location\":\"skghsauuimj\",\"tags\":{\"ugidyjrr\":\"ied\",\"v\":\"byao\",\"onpc\":\"xc\",\"eggzfb\":\"hocohslkev\"},\"id\":\"hfmvfaxkffe\",\"name\":\"ithlvmezyvshxm\",\"type\":\"sbbzo\"}") + .toObject(DiscoveredAssetEndpointProfileInner.class); + Assertions.assertEquals("skghsauuimj", model.location()); + Assertions.assertEquals("ied", model.tags().get("ugidyjrr")); + Assertions.assertEquals("xbczwtruwiqz", model.properties().targetAddress()); + Assertions.assertEquals("j", model.properties().additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.CERTIFICATE, + model.properties().supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("myokacspkwlh", model.properties().endpointProfileType()); + Assertions.assertEquals("dobpxjmflbvvn", model.properties().discoveryId()); + Assertions.assertEquals(2925444529354115235L, model.properties().version()); + Assertions.assertEquals("ciwwzjuqkhr", model.extendedLocation().type()); + Assertions.assertEquals("ajiwkuo", model.extendedLocation().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoveredAssetEndpointProfileInner model + = new DiscoveredAssetEndpointProfileInner().withLocation("skghsauuimj") + .withTags(mapOf("ugidyjrr", "ied", "v", "byao", "onpc", "xc", "eggzfb", "hocohslkev")) + .withProperties(new DiscoveredAssetEndpointProfileProperties().withTargetAddress("xbczwtruwiqz") + .withAdditionalConfiguration("j") + .withSupportedAuthenticationMethods(Arrays.asList(AuthenticationMethod.CERTIFICATE)) + .withEndpointProfileType("myokacspkwlh") + .withDiscoveryId("dobpxjmflbvvn") + .withVersion(2925444529354115235L)) + .withExtendedLocation(new ExtendedLocation().withType("ciwwzjuqkhr").withName("ajiwkuo")); + model = BinaryData.fromObject(model).toObject(DiscoveredAssetEndpointProfileInner.class); + Assertions.assertEquals("skghsauuimj", model.location()); + Assertions.assertEquals("ied", model.tags().get("ugidyjrr")); + Assertions.assertEquals("xbczwtruwiqz", model.properties().targetAddress()); + Assertions.assertEquals("j", model.properties().additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.CERTIFICATE, + model.properties().supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("myokacspkwlh", model.properties().endpointProfileType()); + Assertions.assertEquals("dobpxjmflbvvn", model.properties().discoveryId()); + Assertions.assertEquals(2925444529354115235L, model.properties().version()); + Assertions.assertEquals("ciwwzjuqkhr", model.extendedLocation().type()); + Assertions.assertEquals("ajiwkuo", model.extendedLocation().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileListResultTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileListResultTests.java new file mode 100644 index 0000000000000..2b5be14f640d7 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileListResultTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.implementation.models.DiscoveredAssetEndpointProfileListResult; +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import org.junit.jupiter.api.Assertions; + +public final class DiscoveredAssetEndpointProfileListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoveredAssetEndpointProfileListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"targetAddress\":\"konocu\",\"additionalConfiguration\":\"klyaxuconu\",\"supportedAuthenticationMethods\":[\"Certificate\"],\"endpointProfileType\":\"kbeype\",\"discoveryId\":\"rmjmwvvjektc\",\"version\":9050422304173328061,\"provisioningState\":\"Failed\"},\"extendedLocation\":{\"type\":\"wlrsffrzpwv\",\"name\":\"qdqgbi\"},\"location\":\"lihkaetcktvfc\",\"tags\":{\"jf\":\"snkymuctq\",\"fuwutttxf\":\"ebrjcxe\",\"hfnljkyq\":\"jrbirphxepcyv\"},\"id\":\"j\",\"name\":\"uujqgidokgjljyo\",\"type\":\"gvcl\"}],\"nextLink\":\"gsncghkjeszz\"}") + .toObject(DiscoveredAssetEndpointProfileListResult.class); + Assertions.assertEquals("lihkaetcktvfc", model.value().get(0).location()); + Assertions.assertEquals("snkymuctq", model.value().get(0).tags().get("jf")); + Assertions.assertEquals("konocu", model.value().get(0).properties().targetAddress()); + Assertions.assertEquals("klyaxuconu", model.value().get(0).properties().additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.CERTIFICATE, + model.value().get(0).properties().supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("kbeype", model.value().get(0).properties().endpointProfileType()); + Assertions.assertEquals("rmjmwvvjektc", model.value().get(0).properties().discoveryId()); + Assertions.assertEquals(9050422304173328061L, model.value().get(0).properties().version()); + Assertions.assertEquals("wlrsffrzpwv", model.value().get(0).extendedLocation().type()); + Assertions.assertEquals("qdqgbi", model.value().get(0).extendedLocation().name()); + Assertions.assertEquals("gsncghkjeszz", model.nextLink()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilePropertiesTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilePropertiesTests.java new file mode 100644 index 0000000000000..065da1e60d854 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilePropertiesTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DiscoveredAssetEndpointProfilePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoveredAssetEndpointProfileProperties model = BinaryData.fromString( + "{\"targetAddress\":\"gigr\",\"additionalConfiguration\":\"burvjxxjnspy\",\"supportedAuthenticationMethods\":[\"Anonymous\"],\"endpointProfileType\":\"oenkouknvudwti\",\"discoveryId\":\"kbldngkpocipa\",\"version\":2857636660248584289,\"provisioningState\":\"Failed\"}") + .toObject(DiscoveredAssetEndpointProfileProperties.class); + Assertions.assertEquals("gigr", model.targetAddress()); + Assertions.assertEquals("burvjxxjnspy", model.additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.ANONYMOUS, model.supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("oenkouknvudwti", model.endpointProfileType()); + Assertions.assertEquals("kbldngkpocipa", model.discoveryId()); + Assertions.assertEquals(2857636660248584289L, model.version()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoveredAssetEndpointProfileProperties model + = new DiscoveredAssetEndpointProfileProperties().withTargetAddress("gigr") + .withAdditionalConfiguration("burvjxxjnspy") + .withSupportedAuthenticationMethods(Arrays.asList(AuthenticationMethod.ANONYMOUS)) + .withEndpointProfileType("oenkouknvudwti") + .withDiscoveryId("kbldngkpocipa") + .withVersion(2857636660248584289L); + model = BinaryData.fromObject(model).toObject(DiscoveredAssetEndpointProfileProperties.class); + Assertions.assertEquals("gigr", model.targetAddress()); + Assertions.assertEquals("burvjxxjnspy", model.additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.ANONYMOUS, model.supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("oenkouknvudwti", model.endpointProfileType()); + Assertions.assertEquals("kbldngkpocipa", model.discoveryId()); + Assertions.assertEquals(2857636660248584289L, model.version()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileUpdatePropertiesTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileUpdatePropertiesTests.java new file mode 100644 index 0000000000000..ad5806ce2d45f --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileUpdatePropertiesTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileUpdateProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DiscoveredAssetEndpointProfileUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoveredAssetEndpointProfileUpdateProperties model = BinaryData.fromString( + "{\"targetAddress\":\"nkixzbinj\",\"additionalConfiguration\":\"uttmrywnuzoqft\",\"supportedAuthenticationMethods\":[\"UsernamePassword\",\"Certificate\",\"Certificate\",\"Certificate\"],\"endpointProfileType\":\"qvyxlwhzlsicoho\",\"discoveryId\":\"nwvlryavwhheunmm\",\"version\":5242913098058290048}") + .toObject(DiscoveredAssetEndpointProfileUpdateProperties.class); + Assertions.assertEquals("nkixzbinj", model.targetAddress()); + Assertions.assertEquals("uttmrywnuzoqft", model.additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.USERNAME_PASSWORD, model.supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("qvyxlwhzlsicoho", model.endpointProfileType()); + Assertions.assertEquals("nwvlryavwhheunmm", model.discoveryId()); + Assertions.assertEquals(5242913098058290048L, model.version()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoveredAssetEndpointProfileUpdateProperties model = new DiscoveredAssetEndpointProfileUpdateProperties() + .withTargetAddress("nkixzbinj") + .withAdditionalConfiguration("uttmrywnuzoqft") + .withSupportedAuthenticationMethods(Arrays.asList(AuthenticationMethod.USERNAME_PASSWORD, + AuthenticationMethod.CERTIFICATE, AuthenticationMethod.CERTIFICATE, AuthenticationMethod.CERTIFICATE)) + .withEndpointProfileType("qvyxlwhzlsicoho") + .withDiscoveryId("nwvlryavwhheunmm") + .withVersion(5242913098058290048L); + model = BinaryData.fromObject(model).toObject(DiscoveredAssetEndpointProfileUpdateProperties.class); + Assertions.assertEquals("nkixzbinj", model.targetAddress()); + Assertions.assertEquals("uttmrywnuzoqft", model.additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.USERNAME_PASSWORD, model.supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("qvyxlwhzlsicoho", model.endpointProfileType()); + Assertions.assertEquals("nwvlryavwhheunmm", model.discoveryId()); + Assertions.assertEquals(5242913098058290048L, model.version()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileUpdateTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileUpdateTests.java new file mode 100644 index 0000000000000..78735aeca2b90 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfileUpdateTests.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileUpdate; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileUpdateProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DiscoveredAssetEndpointProfileUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoveredAssetEndpointProfileUpdate model = BinaryData.fromString( + "{\"tags\":{\"iucgygevqzn\":\"kgjn\",\"rbpizc\":\"yp\",\"j\":\"r\",\"yhxdeoejzicwi\":\"dpydn\"},\"properties\":{\"targetAddress\":\"ttgzfbis\",\"additionalConfiguration\":\"bkh\",\"supportedAuthenticationMethods\":[\"UsernamePassword\",\"Certificate\",\"UsernamePassword\",\"Anonymous\"],\"endpointProfileType\":\"dphagalpbuxwgip\",\"discoveryId\":\"onowk\",\"version\":7362184502931754827}}") + .toObject(DiscoveredAssetEndpointProfileUpdate.class); + Assertions.assertEquals("kgjn", model.tags().get("iucgygevqzn")); + Assertions.assertEquals("ttgzfbis", model.properties().targetAddress()); + Assertions.assertEquals("bkh", model.properties().additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.USERNAME_PASSWORD, + model.properties().supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("dphagalpbuxwgip", model.properties().endpointProfileType()); + Assertions.assertEquals("onowk", model.properties().discoveryId()); + Assertions.assertEquals(7362184502931754827L, model.properties().version()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoveredAssetEndpointProfileUpdate model = new DiscoveredAssetEndpointProfileUpdate() + .withTags(mapOf("iucgygevqzn", "kgjn", "rbpizc", "yp", "j", "r", "yhxdeoejzicwi", "dpydn")) + .withProperties(new DiscoveredAssetEndpointProfileUpdateProperties().withTargetAddress("ttgzfbis") + .withAdditionalConfiguration("bkh") + .withSupportedAuthenticationMethods( + Arrays.asList(AuthenticationMethod.USERNAME_PASSWORD, AuthenticationMethod.CERTIFICATE, + AuthenticationMethod.USERNAME_PASSWORD, AuthenticationMethod.ANONYMOUS)) + .withEndpointProfileType("dphagalpbuxwgip") + .withDiscoveryId("onowk") + .withVersion(7362184502931754827L)); + model = BinaryData.fromObject(model).toObject(DiscoveredAssetEndpointProfileUpdate.class); + Assertions.assertEquals("kgjn", model.tags().get("iucgygevqzn")); + Assertions.assertEquals("ttgzfbis", model.properties().targetAddress()); + Assertions.assertEquals("bkh", model.properties().additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.USERNAME_PASSWORD, + model.properties().supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("dphagalpbuxwgip", model.properties().endpointProfileType()); + Assertions.assertEquals("onowk", model.properties().discoveryId()); + Assertions.assertEquals(7362184502931754827L, model.properties().version()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesCreateOrReplaceMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesCreateOrReplaceMockTests.java new file mode 100644 index 0000000000000..c8cae6f552c2a --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesCreateOrReplaceMockTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfile; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfileProperties; +import com.azure.resourcemanager.deviceregistry.models.ExtendedLocation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class DiscoveredAssetEndpointProfilesCreateOrReplaceMockTests { + @Test + public void testCreateOrReplace() throws Exception { + String responseStr + = "{\"properties\":{\"targetAddress\":\"szufoxciqopidoa\",\"additionalConfiguration\":\"iodhkhazxkhnz\",\"supportedAuthenticationMethods\":[\"Anonymous\",\"Certificate\"],\"endpointProfileType\":\"ntoe\",\"discoveryId\":\"okdwb\",\"version\":4169571464200013299,\"provisioningState\":\"Succeeded\"},\"extendedLocation\":{\"type\":\"zcmrvexztvb\",\"name\":\"qgsfraoyzkoow\"},\"location\":\"mnguxawqaldsyu\",\"tags\":{\"kutwpf\":\"merqfobwyznkb\",\"sd\":\"pagmhrskdsnf\",\"wpusdsttwvogv\":\"akgtdlmkkzevdlh\",\"qqmoaku\":\"bejdcn\"},\"id\":\"gm\",\"name\":\"zr\",\"type\":\"rdgrtw\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + DiscoveredAssetEndpointProfile response = manager.discoveredAssetEndpointProfiles() + .define("vkg") + .withRegion("ab") + .withExistingResourceGroup("f") + .withExtendedLocation(new ExtendedLocation().withType("ovsm").withName("l")) + .withTags(mapOf("tpuqujmq", "efkifr", "jcntuj", "gkfbtndoaong")) + .withProperties(new DiscoveredAssetEndpointProfileProperties().withTargetAddress("bgdknnqv") + .withAdditionalConfiguration("znqntoru") + .withSupportedAuthenticationMethods(Arrays.asList(AuthenticationMethod.USERNAME_PASSWORD, + AuthenticationMethod.ANONYMOUS, AuthenticationMethod.CERTIFICATE, AuthenticationMethod.ANONYMOUS)) + .withEndpointProfileType("kycgrauwj") + .withDiscoveryId("etaebu") + .withVersion(602178268406598897L)) + .create(); + + Assertions.assertEquals("mnguxawqaldsyu", response.location()); + Assertions.assertEquals("merqfobwyznkb", response.tags().get("kutwpf")); + Assertions.assertEquals("szufoxciqopidoa", response.properties().targetAddress()); + Assertions.assertEquals("iodhkhazxkhnz", response.properties().additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.ANONYMOUS, + response.properties().supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("ntoe", response.properties().endpointProfileType()); + Assertions.assertEquals("okdwb", response.properties().discoveryId()); + Assertions.assertEquals(4169571464200013299L, response.properties().version()); + Assertions.assertEquals("zcmrvexztvb", response.extendedLocation().type()); + Assertions.assertEquals("qgsfraoyzkoow", response.extendedLocation().name()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesGetByResourceGroupWithResponseMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 0000000000000..dca02d5d02c34 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfile; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class DiscoveredAssetEndpointProfilesGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"targetAddress\":\"xkgymareqnajxqu\",\"additionalConfiguration\":\"hky\",\"supportedAuthenticationMethods\":[\"Anonymous\",\"UsernamePassword\",\"Anonymous\"],\"endpointProfileType\":\"gssofwq\",\"discoveryId\":\"zqalkrmnjijpx\",\"version\":6013226485484313004,\"provisioningState\":\"Succeeded\"},\"extendedLocation\":{\"type\":\"dfnbyxbaaabjyv\",\"name\":\"yffimrzrtuzqogs\"},\"location\":\"nevfdnw\",\"tags\":{\"ud\":\"ewzsyyceuzsoib\",\"brqubp\":\"frxtrthzvaytdwk\"},\"id\":\"xhexiilivpdti\",\"name\":\"r\",\"type\":\"tdqoaxoruzfgsq\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + DiscoveredAssetEndpointProfile response = manager.discoveredAssetEndpointProfiles() + .getByResourceGroupWithResponse("ywdmjsjqbjh", "yxxrwlycoduh", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("nevfdnw", response.location()); + Assertions.assertEquals("ewzsyyceuzsoib", response.tags().get("ud")); + Assertions.assertEquals("xkgymareqnajxqu", response.properties().targetAddress()); + Assertions.assertEquals("hky", response.properties().additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.ANONYMOUS, + response.properties().supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("gssofwq", response.properties().endpointProfileType()); + Assertions.assertEquals("zqalkrmnjijpx", response.properties().discoveryId()); + Assertions.assertEquals(6013226485484313004L, response.properties().version()); + Assertions.assertEquals("dfnbyxbaaabjyv", response.extendedLocation().type()); + Assertions.assertEquals("yffimrzrtuzqogs", response.extendedLocation().name()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListByResourceGroupMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListByResourceGroupMockTests.java new file mode 100644 index 0000000000000..c3db890c33396 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListByResourceGroupMockTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfile; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class DiscoveredAssetEndpointProfilesListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"targetAddress\":\"eptra\",\"additionalConfiguration\":\"jezwlwnw\",\"supportedAuthenticationMethods\":[\"Certificate\",\"Certificate\"],\"endpointProfileType\":\"vydypatdoo\",\"discoveryId\":\"ojknio\",\"version\":8422661722393224797,\"provisioningState\":\"Accepted\"},\"extendedLocation\":{\"type\":\"bw\",\"name\":\"ujhemmsbvdkcrodt\"},\"location\":\"nfwjlfltkacjvefk\",\"tags\":{\"owpulpq\":\"oakggkfpag\",\"xkqjnsjervt\":\"lyls\"},\"id\":\"agxsdszuemps\",\"name\":\"zkfzbeyv\",\"type\":\"nqicvinvkjjxdxrb\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.discoveredAssetEndpointProfiles().listByResourceGroup("yfxrx", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("nfwjlfltkacjvefk", response.iterator().next().location()); + Assertions.assertEquals("oakggkfpag", response.iterator().next().tags().get("owpulpq")); + Assertions.assertEquals("eptra", response.iterator().next().properties().targetAddress()); + Assertions.assertEquals("jezwlwnw", response.iterator().next().properties().additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.CERTIFICATE, + response.iterator().next().properties().supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("vydypatdoo", response.iterator().next().properties().endpointProfileType()); + Assertions.assertEquals("ojknio", response.iterator().next().properties().discoveryId()); + Assertions.assertEquals(8422661722393224797L, response.iterator().next().properties().version()); + Assertions.assertEquals("bw", response.iterator().next().extendedLocation().type()); + Assertions.assertEquals("ujhemmsbvdkcrodt", response.iterator().next().extendedLocation().name()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListMockTests.java new file mode 100644 index 0000000000000..165ef44f280ae --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredAssetEndpointProfilesListMockTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.AuthenticationMethod; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredAssetEndpointProfile; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class DiscoveredAssetEndpointProfilesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"targetAddress\":\"kzclewyh\",\"additionalConfiguration\":\"wp\",\"supportedAuthenticationMethods\":[\"Certificate\",\"Anonymous\",\"UsernamePassword\",\"Anonymous\"],\"endpointProfileType\":\"ncckw\",\"discoveryId\":\"fz\",\"version\":1751290787011310749,\"provisioningState\":\"Accepted\"},\"extendedLocation\":{\"type\":\"buy\",\"name\":\"a\"},\"location\":\"feqztppriol\",\"tags\":{\"sobqw\":\"jaltolmnc\",\"vglsbjjca\":\"sdbnwdcfhucqdpf\",\"t\":\"vxb\"},\"id\":\"udutnco\",\"name\":\"mr\",\"type\":\"xqtvcofu\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.discoveredAssetEndpointProfiles().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("feqztppriol", response.iterator().next().location()); + Assertions.assertEquals("jaltolmnc", response.iterator().next().tags().get("sobqw")); + Assertions.assertEquals("kzclewyh", response.iterator().next().properties().targetAddress()); + Assertions.assertEquals("wp", response.iterator().next().properties().additionalConfiguration()); + Assertions.assertEquals(AuthenticationMethod.CERTIFICATE, + response.iterator().next().properties().supportedAuthenticationMethods().get(0)); + Assertions.assertEquals("ncckw", response.iterator().next().properties().endpointProfileType()); + Assertions.assertEquals("fz", response.iterator().next().properties().discoveryId()); + Assertions.assertEquals(1751290787011310749L, response.iterator().next().properties().version()); + Assertions.assertEquals("buy", response.iterator().next().extendedLocation().type()); + Assertions.assertEquals("a", response.iterator().next().extendedLocation().name()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredDataPointTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredDataPointTests.java new file mode 100644 index 0000000000000..25a3aae3a889b --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredDataPointTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredDataPoint; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class DiscoveredDataPointTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoveredDataPoint model = BinaryData.fromString( + "{\"name\":\"ggd\",\"dataSource\":\"jixhbk\",\"dataPointConfiguration\":\"fqweykhmene\",\"lastUpdatedOn\":\"2021-09-26T05:32:17Z\"}") + .toObject(DiscoveredDataPoint.class); + Assertions.assertEquals("ggd", model.name()); + Assertions.assertEquals("jixhbk", model.dataSource()); + Assertions.assertEquals("fqweykhmene", model.dataPointConfiguration()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-26T05:32:17Z"), model.lastUpdatedOn()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoveredDataPoint model = new DiscoveredDataPoint().withName("ggd") + .withDataSource("jixhbk") + .withDataPointConfiguration("fqweykhmene") + .withLastUpdatedOn(OffsetDateTime.parse("2021-09-26T05:32:17Z")); + model = BinaryData.fromObject(model).toObject(DiscoveredDataPoint.class); + Assertions.assertEquals("ggd", model.name()); + Assertions.assertEquals("jixhbk", model.dataSource()); + Assertions.assertEquals("fqweykhmene", model.dataPointConfiguration()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-26T05:32:17Z"), model.lastUpdatedOn()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredDatasetTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredDatasetTests.java new file mode 100644 index 0000000000000..6324d0b4341b8 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredDatasetTests.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredDataPoint; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredDataset; +import com.azure.resourcemanager.deviceregistry.models.Topic; +import com.azure.resourcemanager.deviceregistry.models.TopicRetainType; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DiscoveredDatasetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoveredDataset model = BinaryData.fromString( + "{\"name\":\"bonqvpkvlrxnjeas\",\"datasetConfiguration\":\"pheoflokeyy\",\"topic\":{\"path\":\"nj\",\"retain\":\"Never\"},\"dataPoints\":[{\"name\":\"grhpdjpju\",\"dataSource\":\"asxazjpqyegualhb\",\"dataPointConfiguration\":\"hejjz\",\"lastUpdatedOn\":\"2021-01-27T02:51:11Z\"},{\"name\":\"udgwdslfho\",\"dataSource\":\"wmc\",\"dataPointConfiguration\":\"pwlbjnpg\",\"lastUpdatedOn\":\"2021-06-30T18:10:14Z\"},{\"name\":\"tadehxnltyfsopp\",\"dataSource\":\"suesnzw\",\"dataPointConfiguration\":\"jbavorxzdm\",\"lastUpdatedOn\":\"2021-07-20T12:25:55Z\"},{\"name\":\"tbqvudw\",\"dataSource\":\"dndnvow\",\"dataPointConfiguration\":\"jjugwdkcglhslaz\",\"lastUpdatedOn\":\"2021-04-05T17:23:15Z\"}]}") + .toObject(DiscoveredDataset.class); + Assertions.assertEquals("bonqvpkvlrxnjeas", model.name()); + Assertions.assertEquals("pheoflokeyy", model.datasetConfiguration()); + Assertions.assertEquals("nj", model.topic().path()); + Assertions.assertEquals(TopicRetainType.NEVER, model.topic().retain()); + Assertions.assertEquals("grhpdjpju", model.dataPoints().get(0).name()); + Assertions.assertEquals("asxazjpqyegualhb", model.dataPoints().get(0).dataSource()); + Assertions.assertEquals("hejjz", model.dataPoints().get(0).dataPointConfiguration()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-27T02:51:11Z"), + model.dataPoints().get(0).lastUpdatedOn()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoveredDataset model = new DiscoveredDataset().withName("bonqvpkvlrxnjeas") + .withDatasetConfiguration("pheoflokeyy") + .withTopic(new Topic().withPath("nj").withRetain(TopicRetainType.NEVER)) + .withDataPoints(Arrays.asList( + new DiscoveredDataPoint().withName("grhpdjpju") + .withDataSource("asxazjpqyegualhb") + .withDataPointConfiguration("hejjz") + .withLastUpdatedOn(OffsetDateTime.parse("2021-01-27T02:51:11Z")), + new DiscoveredDataPoint().withName("udgwdslfho") + .withDataSource("wmc") + .withDataPointConfiguration("pwlbjnpg") + .withLastUpdatedOn(OffsetDateTime.parse("2021-06-30T18:10:14Z")), + new DiscoveredDataPoint().withName("tadehxnltyfsopp") + .withDataSource("suesnzw") + .withDataPointConfiguration("jbavorxzdm") + .withLastUpdatedOn(OffsetDateTime.parse("2021-07-20T12:25:55Z")), + new DiscoveredDataPoint().withName("tbqvudw") + .withDataSource("dndnvow") + .withDataPointConfiguration("jjugwdkcglhslaz") + .withLastUpdatedOn(OffsetDateTime.parse("2021-04-05T17:23:15Z")))); + model = BinaryData.fromObject(model).toObject(DiscoveredDataset.class); + Assertions.assertEquals("bonqvpkvlrxnjeas", model.name()); + Assertions.assertEquals("pheoflokeyy", model.datasetConfiguration()); + Assertions.assertEquals("nj", model.topic().path()); + Assertions.assertEquals(TopicRetainType.NEVER, model.topic().retain()); + Assertions.assertEquals("grhpdjpju", model.dataPoints().get(0).name()); + Assertions.assertEquals("asxazjpqyegualhb", model.dataPoints().get(0).dataSource()); + Assertions.assertEquals("hejjz", model.dataPoints().get(0).dataPointConfiguration()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-27T02:51:11Z"), + model.dataPoints().get(0).lastUpdatedOn()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredEventTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredEventTests.java new file mode 100644 index 0000000000000..dc19ac3d0a827 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/DiscoveredEventTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.DiscoveredEvent; +import com.azure.resourcemanager.deviceregistry.models.Topic; +import com.azure.resourcemanager.deviceregistry.models.TopicRetainType; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class DiscoveredEventTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoveredEvent model = BinaryData.fromString( + "{\"name\":\"exfwhy\",\"eventNotifier\":\"cibvyvdcsitynn\",\"eventConfiguration\":\"mdectehfiqscjey\",\"topic\":{\"path\":\"hezrkgq\",\"retain\":\"Never\"},\"lastUpdatedOn\":\"2021-06-04T03:18:37Z\"}") + .toObject(DiscoveredEvent.class); + Assertions.assertEquals("exfwhy", model.name()); + Assertions.assertEquals("cibvyvdcsitynn", model.eventNotifier()); + Assertions.assertEquals("mdectehfiqscjey", model.eventConfiguration()); + Assertions.assertEquals("hezrkgq", model.topic().path()); + Assertions.assertEquals(TopicRetainType.NEVER, model.topic().retain()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-04T03:18:37Z"), model.lastUpdatedOn()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoveredEvent model = new DiscoveredEvent().withName("exfwhy") + .withEventNotifier("cibvyvdcsitynn") + .withEventConfiguration("mdectehfiqscjey") + .withTopic(new Topic().withPath("hezrkgq").withRetain(TopicRetainType.NEVER)) + .withLastUpdatedOn(OffsetDateTime.parse("2021-06-04T03:18:37Z")); + model = BinaryData.fromObject(model).toObject(DiscoveredEvent.class); + Assertions.assertEquals("exfwhy", model.name()); + Assertions.assertEquals("cibvyvdcsitynn", model.eventNotifier()); + Assertions.assertEquals("mdectehfiqscjey", model.eventConfiguration()); + Assertions.assertEquals("hezrkgq", model.topic().path()); + Assertions.assertEquals(TopicRetainType.NEVER, model.topic().retain()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-04T03:18:37Z"), model.lastUpdatedOn()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/EventBaseTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/EventBaseTests.java new file mode 100644 index 0000000000000..64fdf50dfbde4 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/EventBaseTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.EventBase; +import com.azure.resourcemanager.deviceregistry.models.Topic; +import com.azure.resourcemanager.deviceregistry.models.TopicRetainType; +import org.junit.jupiter.api.Assertions; + +public final class EventBaseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EventBase model = BinaryData.fromString( + "{\"name\":\"eusnhutj\",\"eventNotifier\":\"ltmrldh\",\"eventConfiguration\":\"jzzd\",\"topic\":{\"path\":\"qxhocdgeablgphut\",\"retain\":\"Keep\"}}") + .toObject(EventBase.class); + Assertions.assertEquals("eusnhutj", model.name()); + Assertions.assertEquals("ltmrldh", model.eventNotifier()); + Assertions.assertEquals("jzzd", model.eventConfiguration()); + Assertions.assertEquals("qxhocdgeablgphut", model.topic().path()); + Assertions.assertEquals(TopicRetainType.KEEP, model.topic().retain()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EventBase model = new EventBase().withName("eusnhutj") + .withEventNotifier("ltmrldh") + .withEventConfiguration("jzzd") + .withTopic(new Topic().withPath("qxhocdgeablgphut").withRetain(TopicRetainType.KEEP)); + model = BinaryData.fromObject(model).toObject(EventBase.class); + Assertions.assertEquals("eusnhutj", model.name()); + Assertions.assertEquals("ltmrldh", model.eventNotifier()); + Assertions.assertEquals("jzzd", model.eventConfiguration()); + Assertions.assertEquals("qxhocdgeablgphut", model.topic().path()); + Assertions.assertEquals(TopicRetainType.KEEP, model.topic().retain()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/EventTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/EventTests.java index f22735a043ca1..9e72f02d41abd 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/EventTests.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/EventTests.java @@ -6,34 +6,38 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.deviceregistry.models.Event; -import com.azure.resourcemanager.deviceregistry.models.EventsObservabilityMode; +import com.azure.resourcemanager.deviceregistry.models.EventObservabilityMode; +import com.azure.resourcemanager.deviceregistry.models.Topic; +import com.azure.resourcemanager.deviceregistry.models.TopicRetainType; import org.junit.jupiter.api.Assertions; public final class EventTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { Event model = BinaryData.fromString( - "{\"name\":\"qpteeh\",\"eventNotifier\":\"zvypyqrimzinp\",\"capabilityId\":\"wjdk\",\"observabilityMode\":\"log\",\"eventConfiguration\":\"od\"}") + "{\"observabilityMode\":\"None\",\"name\":\"xsabkyqdu\",\"eventNotifier\":\"jitcjczdzevn\",\"eventConfiguration\":\"krwpdap\",\"topic\":{\"path\":\"sbdkvwr\",\"retain\":\"Keep\"}}") .toObject(Event.class); - Assertions.assertEquals("qpteeh", model.name()); - Assertions.assertEquals("zvypyqrimzinp", model.eventNotifier()); - Assertions.assertEquals("wjdk", model.capabilityId()); - Assertions.assertEquals(EventsObservabilityMode.LOG, model.observabilityMode()); - Assertions.assertEquals("od", model.eventConfiguration()); + Assertions.assertEquals("xsabkyqdu", model.name()); + Assertions.assertEquals("jitcjczdzevn", model.eventNotifier()); + Assertions.assertEquals("krwpdap", model.eventConfiguration()); + Assertions.assertEquals("sbdkvwr", model.topic().path()); + Assertions.assertEquals(TopicRetainType.KEEP, model.topic().retain()); + Assertions.assertEquals(EventObservabilityMode.NONE, model.observabilityMode()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - Event model = new Event().withName("qpteeh") - .withEventNotifier("zvypyqrimzinp") - .withCapabilityId("wjdk") - .withObservabilityMode(EventsObservabilityMode.LOG) - .withEventConfiguration("od"); + Event model = new Event().withName("xsabkyqdu") + .withEventNotifier("jitcjczdzevn") + .withEventConfiguration("krwpdap") + .withTopic(new Topic().withPath("sbdkvwr").withRetain(TopicRetainType.KEEP)) + .withObservabilityMode(EventObservabilityMode.NONE); model = BinaryData.fromObject(model).toObject(Event.class); - Assertions.assertEquals("qpteeh", model.name()); - Assertions.assertEquals("zvypyqrimzinp", model.eventNotifier()); - Assertions.assertEquals("wjdk", model.capabilityId()); - Assertions.assertEquals(EventsObservabilityMode.LOG, model.observabilityMode()); - Assertions.assertEquals("od", model.eventConfiguration()); + Assertions.assertEquals("xsabkyqdu", model.name()); + Assertions.assertEquals("jitcjczdzevn", model.eventNotifier()); + Assertions.assertEquals("krwpdap", model.eventConfiguration()); + Assertions.assertEquals("sbdkvwr", model.topic().path()); + Assertions.assertEquals(TopicRetainType.KEEP, model.topic().retain()); + Assertions.assertEquals(EventObservabilityMode.NONE, model.observabilityMode()); } } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/ExtendedLocationTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/ExtendedLocationTests.java index 3131736a22974..94fc7ece8836b 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/ExtendedLocationTests.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/ExtendedLocationTests.java @@ -12,16 +12,16 @@ public final class ExtendedLocationTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ExtendedLocation model - = BinaryData.fromString("{\"type\":\"ohjtckw\",\"name\":\"dsoifiyipj\"}").toObject(ExtendedLocation.class); - Assertions.assertEquals("ohjtckw", model.type()); - Assertions.assertEquals("dsoifiyipj", model.name()); + = BinaryData.fromString("{\"type\":\"ugpbkw\",\"name\":\"mutduqktaps\"}").toObject(ExtendedLocation.class); + Assertions.assertEquals("ugpbkw", model.type()); + Assertions.assertEquals("mutduqktaps", model.name()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ExtendedLocation model = new ExtendedLocation().withType("ohjtckw").withName("dsoifiyipj"); + ExtendedLocation model = new ExtendedLocation().withType("ugpbkw").withName("mutduqktaps"); model = BinaryData.fromObject(model).toObject(ExtendedLocation.class); - Assertions.assertEquals("ohjtckw", model.type()); - Assertions.assertEquals("dsoifiyipj", model.name()); + Assertions.assertEquals("ugpbkw", model.type()); + Assertions.assertEquals("mutduqktaps", model.name()); } } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/MessageSchemaReferenceTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/MessageSchemaReferenceTests.java new file mode 100644 index 0000000000000..e51bbdd08d63f --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/MessageSchemaReferenceTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.MessageSchemaReference; + +public final class MessageSchemaReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MessageSchemaReference model = BinaryData.fromString( + "{\"schemaRegistryNamespace\":\"dhsgcba\",\"schemaName\":\"phejkotynqgoulz\",\"schemaVersion\":\"dlikwyqkgfgibma\"}") + .toObject(MessageSchemaReference.class); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationDisplayTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationDisplayTests.java index 9d57124ea4de2..21ef107349f97 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationDisplayTests.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationDisplayTests.java @@ -6,7 +6,6 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.deviceregistry.models.OperationDisplay; -import org.junit.jupiter.api.Assertions; public final class OperationDisplayTests { @org.junit.jupiter.api.Test @@ -14,9 +13,5 @@ public void testDeserialize() throws Exception { OperationDisplay model = BinaryData.fromString( "{\"provider\":\"cdm\",\"resource\":\"rcryuanzwuxzdxta\",\"operation\":\"lhmwhfpmrqobm\",\"description\":\"kknryrtihf\"}") .toObject(OperationDisplay.class); - Assertions.assertEquals("cdm", model.provider()); - Assertions.assertEquals("rcryuanzwuxzdxta", model.resource()); - Assertions.assertEquals("lhmwhfpmrqobm", model.operation()); - Assertions.assertEquals("kknryrtihf", model.description()); } } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationInnerTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationInnerTests.java index ae5c93d9cd8ee..2fb37d148f7d4 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationInnerTests.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationInnerTests.java @@ -6,8 +6,6 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.deviceregistry.fluent.models.OperationInner; -import com.azure.resourcemanager.deviceregistry.models.ActionType; -import org.junit.jupiter.api.Assertions; public final class OperationInnerTests { @org.junit.jupiter.api.Test @@ -15,10 +13,5 @@ public void testDeserialize() throws Exception { OperationInner model = BinaryData.fromString( "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") .toObject(OperationInner.class); - Assertions.assertEquals("eqsrdeupewnwreit", model.display().provider()); - Assertions.assertEquals("yflusarhmofc", model.display().resource()); - Assertions.assertEquals("smy", model.display().operation()); - Assertions.assertEquals("kdtmlxhekuk", model.display().description()); - Assertions.assertEquals(ActionType.INTERNAL, model.actionType()); } } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationListResultTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationListResultTests.java index 0c2308b230b98..0dcf672c01bdb 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationListResultTests.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationListResultTests.java @@ -6,7 +6,6 @@ import com.azure.core.util.BinaryData; import com.azure.resourcemanager.deviceregistry.implementation.models.OperationListResult; -import com.azure.resourcemanager.deviceregistry.models.ActionType; import org.junit.jupiter.api.Assertions; public final class OperationListResultTests { @@ -15,11 +14,6 @@ public void testDeserialize() throws Exception { OperationListResult model = BinaryData.fromString( "{\"value\":[{\"name\":\"hq\",\"isDataAction\":true,\"display\":{\"provider\":\"pybczmehmtzopb\",\"resource\":\"h\",\"operation\":\"pidgsybbejhphoyc\",\"description\":\"xaobhdxbmtqioqjz\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"fpownoizhwlr\",\"isDataAction\":false,\"display\":{\"provider\":\"oqijgkdmbpaz\",\"resource\":\"bc\",\"operation\":\"pdznrbtcqqjnqgl\",\"description\":\"gnufoooj\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"kfo\"}") .toObject(OperationListResult.class); - Assertions.assertEquals("pybczmehmtzopb", model.value().get(0).display().provider()); - Assertions.assertEquals("h", model.value().get(0).display().resource()); - Assertions.assertEquals("pidgsybbejhphoyc", model.value().get(0).display().operation()); - Assertions.assertEquals("xaobhdxbmtqioqjz", model.value().get(0).display().description()); - Assertions.assertEquals(ActionType.INTERNAL, model.value().get(0).actionType()); Assertions.assertEquals("kfo", model.nextLink()); } } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationStatusGetWithResponseMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationStatusGetWithResponseMockTests.java deleted file mode 100644 index 01bdf418c5e2d..0000000000000 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationStatusGetWithResponseMockTests.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.deviceregistry.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; -import com.azure.resourcemanager.deviceregistry.models.OperationStatusResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class OperationStatusGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"id\":\"fqweykhmene\",\"name\":\"yexfwh\",\"status\":\"bcibvyvdcsitynn\",\"percentComplete\":87.51548324733915,\"startTime\":\"2021-01-19T03:02:26Z\",\"endTime\":\"2021-07-20T06:26:03Z\",\"operations\":[{\"id\":\"qsc\",\"name\":\"ypvhezrkg\",\"status\":\"hcjrefovgmk\",\"percentComplete\":33.12551044707579,\"startTime\":\"2021-08-20T18:32:02Z\",\"endTime\":\"2021-05-05T15:09:29Z\",\"operations\":[{\"id\":\"pkc\",\"name\":\"tpngjcrcczsqpjh\",\"status\":\"mdajv\",\"percentComplete\":78.49014482173136,\"startTime\":\"2021-08-31T06:22:10Z\",\"endTime\":\"2021-08-25T21:25:46Z\",\"operations\":[{\"status\":\"noae\"}]},{\"id\":\"hy\",\"name\":\"trpmo\",\"status\":\"jmcmatuokthfu\",\"percentComplete\":52.19850235581607,\"startTime\":\"2021-10-17T19:18:45Z\",\"endTime\":\"2021-03-11T15:37:41Z\",\"operations\":[{\"status\":\"vxodpu\"},{\"status\":\"zmyzydagf\"}]},{\"id\":\"bezy\",\"name\":\"okktwhrdxw\",\"status\":\"ywqsmbsurexim\",\"percentComplete\":23.237426929745652,\"startTime\":\"2021-01-18T04:02:20Z\",\"endTime\":\"2021-08-16T18:23:02Z\",\"operations\":[{\"status\":\"ymddys\"}]},{\"id\":\"iuxhqyudxorr\",\"name\":\"b\",\"status\":\"oczvy\",\"percentComplete\":33.69249352848709,\"startTime\":\"2020-12-25T17:33:53Z\",\"endTime\":\"2021-11-06T12:54:53Z\",\"operations\":[{\"status\":\"llr\"}]}]}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - DeviceRegistryManager manager = DeviceRegistryManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - OperationStatusResult response = manager.operationStatus() - .getWithResponse("gujjugwdkcglh", "lazjdyggdtjixhbk", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("fqweykhmene", response.id()); - Assertions.assertEquals("yexfwh", response.name()); - Assertions.assertEquals("bcibvyvdcsitynn", response.status()); - Assertions.assertEquals(87.51548324733915D, response.percentComplete()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-19T03:02:26Z"), response.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-20T06:26:03Z"), response.endTime()); - Assertions.assertEquals("qsc", response.operations().get(0).id()); - Assertions.assertEquals("ypvhezrkg", response.operations().get(0).name()); - Assertions.assertEquals("hcjrefovgmk", response.operations().get(0).status()); - Assertions.assertEquals(33.12551044707579D, response.operations().get(0).percentComplete()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-20T18:32:02Z"), response.operations().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-05T15:09:29Z"), response.operations().get(0).endTime()); - Assertions.assertEquals("pkc", response.operations().get(0).operations().get(0).id()); - Assertions.assertEquals("tpngjcrcczsqpjh", response.operations().get(0).operations().get(0).name()); - Assertions.assertEquals("mdajv", response.operations().get(0).operations().get(0).status()); - Assertions.assertEquals(78.49014482173136D, response.operations().get(0).operations().get(0).percentComplete()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-31T06:22:10Z"), - response.operations().get(0).operations().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-25T21:25:46Z"), - response.operations().get(0).operations().get(0).endTime()); - Assertions.assertEquals("noae", response.operations().get(0).operations().get(0).operations().get(0).status()); - } -} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationStatusResultInnerTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationStatusResultInnerTests.java deleted file mode 100644 index 2d33b5bb86112..0000000000000 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationStatusResultInnerTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.deviceregistry.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.deviceregistry.fluent.models.OperationStatusResultInner; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class OperationStatusResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationStatusResultInner model = BinaryData.fromString( - "{\"id\":\"ijbpzvgnwzsymgl\",\"name\":\"fcyzkohdbihanufh\",\"status\":\"cbjy\",\"percentComplete\":17.669842734724504,\"startTime\":\"2021-08-11T05:57:13Z\",\"endTime\":\"2021-03-22T18:05:05Z\",\"operations\":[{\"id\":\"ifpikxwczby\",\"name\":\"npqxuh\",\"status\":\"vyq\",\"percentComplete\":15.130435019780164,\"startTime\":\"2021-09-23T11:59:12Z\",\"endTime\":\"2021-04-19T10:59:49Z\",\"operations\":[{\"id\":\"umjgrtfwvuk\",\"name\":\"audccsnhs\",\"status\":\"cnyejhkryhtnapcz\",\"percentComplete\":31.021001091343102,\"startTime\":\"2021-01-02T05:45:31Z\",\"endTime\":\"2021-02-13T10:58:08Z\",\"operations\":[{\"status\":\"vnipjox\"},{\"status\":\"jnchgej\"},{\"status\":\"podmailzydehojwy\"}]}]},{\"id\":\"inpm\",\"name\":\"jaqwixjsp\",\"status\":\"ozvcput\",\"percentComplete\":40.087762783830804,\"startTime\":\"2021-03-22T16:44:16Z\",\"endTime\":\"2021-10-18T16:43:09Z\",\"operations\":[{\"id\":\"cmdv\",\"name\":\"hulsuuvmkjozkrwf\",\"status\":\"dio\",\"percentComplete\":59.75135945335241,\"startTime\":\"2021-01-15T11:02:51Z\",\"endTime\":\"2021-12-01T09:09:34Z\",\"operations\":[{\"status\":\"vwryoqpso\"},{\"status\":\"cctazakljlahbc\"},{\"status\":\"yffdfdos\"},{\"status\":\"gexpaojakhmsbz\"}]}]},{\"id\":\"zevdphlx\",\"name\":\"lthqtrgqjbp\",\"status\":\"zfsinzgvf\",\"percentComplete\":93.3282109723622,\"startTime\":\"2021-11-02T15:47:25Z\",\"endTime\":\"2021-08-01T19:04:33Z\",\"operations\":[{\"id\":\"elluwfziton\",\"name\":\"qfpjk\",\"status\":\"lxofpdvhpfxxypin\",\"percentComplete\":99.97950835952206,\"startTime\":\"2020-12-20T00:37:56Z\",\"endTime\":\"2021-10-31T20:57:40Z\",\"operations\":[{\"status\":\"kpode\"},{\"status\":\"ooginuvamih\"},{\"status\":\"ognarxzxtheotus\"},{\"status\":\"vyevcciqi\"}]},{\"id\":\"un\",\"name\":\"wjzrnfygxgisp\",\"status\":\"mvtzfkufub\",\"percentComplete\":16.258836308803303,\"startTime\":\"2021-07-07T00:34:51Z\",\"endTime\":\"2021-11-23T03:14:50Z\",\"operations\":[{\"status\":\"aeqjhqjbasvms\"}]}]},{\"id\":\"lngsntnbybkzgcwr\",\"name\":\"lxxwrljdouskc\",\"status\":\"vkocrcjdkwtn\",\"percentComplete\":98.36213425160699,\"startTime\":\"2021-08-22T09:01:35Z\",\"endTime\":\"2021-05-23T21:52:10Z\",\"operations\":[{\"id\":\"gls\",\"name\":\"inqpjwnzll\",\"status\":\"fmppe\",\"percentComplete\":43.36704068838252,\"startTime\":\"2021-08-08T05:23:22Z\",\"endTime\":\"2021-07-04T23:44:32Z\",\"operations\":[{\"status\":\"yqduujit\"},{\"status\":\"jczdzevndh\"},{\"status\":\"rwpdappdsbdkvwrw\"}]},{\"id\":\"usnhutje\",\"name\":\"mrldhu\",\"status\":\"jzzd\",\"percentComplete\":94.72452696725438,\"startTime\":\"2021-11-19T10:20:29Z\",\"endTime\":\"2021-09-07T21:28:24Z\",\"operations\":[{\"status\":\"ablgphuticndvk\"},{\"status\":\"ozwyiftyhxhuro\"}]},{\"id\":\"yxolniwp\",\"name\":\"ukjfkgiawxklr\",\"status\":\"plwckbas\",\"percentComplete\":94.59322503623605,\"startTime\":\"2021-07-26T02:42:45Z\",\"endTime\":\"2021-01-22T11:53:13Z\",\"operations\":[{\"status\":\"bacphejko\"},{\"status\":\"ynqgoulzndlikwyq\"},{\"status\":\"gfgibm\"},{\"status\":\"dgak\"}]},{\"id\":\"rxybz\",\"name\":\"e\",\"status\":\"qytbciq\",\"percentComplete\":28.991778696201052,\"startTime\":\"2021-02-10T20:24:35Z\",\"endTime\":\"2021-03-13T18:03:58Z\",\"operations\":[{\"status\":\"smodmgloug\"}]}]}]}") - .toObject(OperationStatusResultInner.class); - Assertions.assertEquals("ijbpzvgnwzsymgl", model.id()); - Assertions.assertEquals("fcyzkohdbihanufh", model.name()); - Assertions.assertEquals("cbjy", model.status()); - Assertions.assertEquals(17.669842734724504D, model.percentComplete()); - Assertions.assertEquals(OffsetDateTime.parse("2021-08-11T05:57:13Z"), model.startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-22T18:05:05Z"), model.endTime()); - Assertions.assertEquals("ifpikxwczby", model.operations().get(0).id()); - Assertions.assertEquals("npqxuh", model.operations().get(0).name()); - Assertions.assertEquals("vyq", model.operations().get(0).status()); - Assertions.assertEquals(15.130435019780164D, model.operations().get(0).percentComplete()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-23T11:59:12Z"), model.operations().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-04-19T10:59:49Z"), model.operations().get(0).endTime()); - Assertions.assertEquals("umjgrtfwvuk", model.operations().get(0).operations().get(0).id()); - Assertions.assertEquals("audccsnhs", model.operations().get(0).operations().get(0).name()); - Assertions.assertEquals("cnyejhkryhtnapcz", model.operations().get(0).operations().get(0).status()); - Assertions.assertEquals(31.021001091343102D, model.operations().get(0).operations().get(0).percentComplete()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-02T05:45:31Z"), - model.operations().get(0).operations().get(0).startTime()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-13T10:58:08Z"), - model.operations().get(0).operations().get(0).endTime()); - Assertions.assertEquals("vnipjox", model.operations().get(0).operations().get(0).operations().get(0).status()); - } -} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationsListMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationsListMockTests.java index 2478f5fb98421..2ec8855d72897 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationsListMockTests.java +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/OperationsListMockTests.java @@ -11,11 +11,9 @@ import com.azure.core.management.profile.AzureProfile; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; -import com.azure.resourcemanager.deviceregistry.models.ActionType; import com.azure.resourcemanager.deviceregistry.models.Operation; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; @@ -23,7 +21,7 @@ public final class OperationsListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"name\":\"ltyfsop\",\"isDataAction\":false,\"display\":{\"provider\":\"snzwd\",\"resource\":\"bavo\",\"operation\":\"zdmohctbqvu\",\"description\":\"xdn\"},\"origin\":\"user\",\"actionType\":\"Internal\"}]}"; + = "{\"value\":[{\"name\":\"umaq\",\"isDataAction\":true,\"display\":{\"provider\":\"cdui\",\"resource\":\"tgccymvaolpss\",\"operation\":\"lfmmdnbbglzpswi\",\"description\":\"mcwyhzdxssadb\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -34,10 +32,5 @@ public void testList() throws Exception { PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("snzwd", response.iterator().next().display().provider()); - Assertions.assertEquals("bavo", response.iterator().next().display().resource()); - Assertions.assertEquals("zdmohctbqvu", response.iterator().next().display().operation()); - Assertions.assertEquals("xdn", response.iterator().next().display().description()); - Assertions.assertEquals(ActionType.INTERNAL, response.iterator().next().actionType()); } } diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaInnerTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaInnerTests.java new file mode 100644 index 0000000000000..2c308e7586f94 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaInnerTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaInner; +import com.azure.resourcemanager.deviceregistry.models.Format; +import com.azure.resourcemanager.deviceregistry.models.SchemaProperties; +import com.azure.resourcemanager.deviceregistry.models.SchemaType; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SchemaInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SchemaInner model = BinaryData.fromString( + "{\"properties\":{\"uuid\":\"ngmtsavjcb\",\"displayName\":\"xqpsrknftguv\",\"description\":\"uhprwmdyvxqt\",\"format\":\"Delta/1.0\",\"schemaType\":\"MessageSchema\",\"provisioningState\":\"Failed\",\"tags\":{\"exrmcqibycnojvk\":\"oyq\"}},\"id\":\"e\",\"name\":\"qsgzvahapj\",\"type\":\"zhpvgqzcjrvxd\"}") + .toObject(SchemaInner.class); + Assertions.assertEquals("xqpsrknftguv", model.properties().displayName()); + Assertions.assertEquals("uhprwmdyvxqt", model.properties().description()); + Assertions.assertEquals(Format.DELTA_1_0, model.properties().format()); + Assertions.assertEquals(SchemaType.MESSAGE_SCHEMA, model.properties().schemaType()); + Assertions.assertEquals("oyq", model.properties().tags().get("exrmcqibycnojvk")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SchemaInner model = new SchemaInner().withProperties(new SchemaProperties().withDisplayName("xqpsrknftguv") + .withDescription("uhprwmdyvxqt") + .withFormat(Format.DELTA_1_0) + .withSchemaType(SchemaType.MESSAGE_SCHEMA) + .withTags(mapOf("exrmcqibycnojvk", "oyq"))); + model = BinaryData.fromObject(model).toObject(SchemaInner.class); + Assertions.assertEquals("xqpsrknftguv", model.properties().displayName()); + Assertions.assertEquals("uhprwmdyvxqt", model.properties().description()); + Assertions.assertEquals(Format.DELTA_1_0, model.properties().format()); + Assertions.assertEquals(SchemaType.MESSAGE_SCHEMA, model.properties().schemaType()); + Assertions.assertEquals("oyq", model.properties().tags().get("exrmcqibycnojvk")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaListResultTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaListResultTests.java new file mode 100644 index 0000000000000..8e08baab5861c --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaListResultTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.implementation.models.SchemaListResult; +import com.azure.resourcemanager.deviceregistry.models.Format; +import com.azure.resourcemanager.deviceregistry.models.SchemaType; +import org.junit.jupiter.api.Assertions; + +public final class SchemaListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SchemaListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"uuid\":\"n\",\"displayName\":\"xisxyawjoyaqcsl\",\"description\":\"pkii\",\"format\":\"JsonSchema/draft-07\",\"schemaType\":\"MessageSchema\",\"provisioningState\":\"Accepted\",\"tags\":{\"hnrztfol\":\"eli\",\"dtpnapnyiropuhp\":\"bnxknalaulppg\",\"gqgitxmedjvcsl\":\"gvpgy\"}},\"id\":\"qwwncw\",\"name\":\"zhxgktrmgucn\",\"type\":\"pkteo\"},{\"properties\":{\"uuid\":\"wptfdy\",\"displayName\":\"fqbuaceopzf\",\"description\":\"hhuao\",\"format\":\"Delta/1.0\",\"schemaType\":\"MessageSchema\",\"provisioningState\":\"Canceled\",\"tags\":{\"t\":\"xolzdahzx\",\"grcfb\":\"bgbkdmoizpost\",\"bpvjymjhx\":\"nrmfqjhhk\"}},\"id\":\"yngudivk\",\"name\":\"tswb\",\"type\":\"qzvszjf\"}],\"nextLink\":\"vjfdx\"}") + .toObject(SchemaListResult.class); + Assertions.assertEquals("xisxyawjoyaqcsl", model.value().get(0).properties().displayName()); + Assertions.assertEquals("pkii", model.value().get(0).properties().description()); + Assertions.assertEquals(Format.JSON_SCHEMA_DRAFT7, model.value().get(0).properties().format()); + Assertions.assertEquals(SchemaType.MESSAGE_SCHEMA, model.value().get(0).properties().schemaType()); + Assertions.assertEquals("eli", model.value().get(0).properties().tags().get("hnrztfol")); + Assertions.assertEquals("vjfdx", model.nextLink()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaPropertiesTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaPropertiesTests.java new file mode 100644 index 0000000000000..7f948e306a47d --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaPropertiesTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.Format; +import com.azure.resourcemanager.deviceregistry.models.SchemaProperties; +import com.azure.resourcemanager.deviceregistry.models.SchemaType; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SchemaPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SchemaProperties model = BinaryData.fromString( + "{\"uuid\":\"lmwlxkvugfhzo\",\"displayName\":\"wjvzunluthnn\",\"description\":\"nxipeil\",\"format\":\"Delta/1.0\",\"schemaType\":\"MessageSchema\",\"provisioningState\":\"Failed\",\"tags\":{\"kzbbtd\":\"xdult\",\"bsjyofdx\":\"umveekgpwozuhkf\",\"oekqvk\":\"uusdttouwa\",\"vbxwyjsflhh\":\"lns\"}}") + .toObject(SchemaProperties.class); + Assertions.assertEquals("wjvzunluthnn", model.displayName()); + Assertions.assertEquals("nxipeil", model.description()); + Assertions.assertEquals(Format.DELTA_1_0, model.format()); + Assertions.assertEquals(SchemaType.MESSAGE_SCHEMA, model.schemaType()); + Assertions.assertEquals("xdult", model.tags().get("kzbbtd")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SchemaProperties model = new SchemaProperties().withDisplayName("wjvzunluthnn") + .withDescription("nxipeil") + .withFormat(Format.DELTA_1_0) + .withSchemaType(SchemaType.MESSAGE_SCHEMA) + .withTags( + mapOf("kzbbtd", "xdult", "bsjyofdx", "umveekgpwozuhkf", "oekqvk", "uusdttouwa", "vbxwyjsflhh", "lns")); + model = BinaryData.fromObject(model).toObject(SchemaProperties.class); + Assertions.assertEquals("wjvzunluthnn", model.displayName()); + Assertions.assertEquals("nxipeil", model.description()); + Assertions.assertEquals(Format.DELTA_1_0, model.format()); + Assertions.assertEquals(SchemaType.MESSAGE_SCHEMA, model.schemaType()); + Assertions.assertEquals("xdult", model.tags().get("kzbbtd")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesCreateOrReplaceMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesCreateOrReplaceMockTests.java new file mode 100644 index 0000000000000..02b457021dc61 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesCreateOrReplaceMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistry; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryProperties; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentityType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SchemaRegistriesCreateOrReplaceMockTests { + @Test + public void testCreateOrReplace() throws Exception { + String responseStr + = "{\"properties\":{\"uuid\":\"qhl\",\"namespace\":\"vriiio\",\"displayName\":\"al\",\"description\":\"fk\",\"storageAccountContainerUrl\":\"tvsexsowuel\",\"provisioningState\":\"Succeeded\"},\"identity\":{\"principalId\":\"hhxvrhmzkwpj\",\"tenantId\":\"wspughftqsxhqx\",\"type\":\"None\"},\"location\":\"ukndxdigrjgu\",\"tags\":{\"z\":\"dmsyqtfihwhbo\",\"zudphqamvdkfw\":\"ngamvpphosz\",\"qiatkzwpcnp\":\"nwcvtbvkayhmtnv\"},\"id\":\"zcjaesgvvsccy\",\"name\":\"jguq\",\"type\":\"hwyg\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + SchemaRegistry response = manager.schemaRegistries() + .define("x") + .withRegion("frl") + .withExistingResourceGroup("slthaq") + .withTags(mapOf("iin", "zrnw", "h", "fpwpjylwbt")) + .withProperties(new SchemaRegistryProperties().withNamespace("pdrhne") + .withDisplayName("owqkdwytisi") + .withDescription("rcgp") + .withStorageAccountContainerUrl("kpzi")) + .withIdentity(new SystemAssignedServiceIdentity().withType(SystemAssignedServiceIdentityType.NONE)) + .create(); + + Assertions.assertEquals("ukndxdigrjgu", response.location()); + Assertions.assertEquals("dmsyqtfihwhbo", response.tags().get("z")); + Assertions.assertEquals("vriiio", response.properties().namespace()); + Assertions.assertEquals("al", response.properties().displayName()); + Assertions.assertEquals("fk", response.properties().description()); + Assertions.assertEquals("tvsexsowuel", response.properties().storageAccountContainerUrl()); + Assertions.assertEquals(SystemAssignedServiceIdentityType.NONE, response.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesGetByResourceGroupWithResponseMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 0000000000000..fed1b9d56e0f6 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistry; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentityType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SchemaRegistriesGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"uuid\":\"hhziuief\",\"namespace\":\"zbhd\",\"displayName\":\"mlmz\",\"description\":\"oftrmaequia\",\"storageAccountContainerUrl\":\"xicslfao\",\"provisioningState\":\"Deleting\"},\"identity\":{\"principalId\":\"ylhalnswhcc\",\"tenantId\":\"hka\",\"type\":\"SystemAssigned\"},\"location\":\"itqscywuggwoluhc\",\"tags\":{\"i\":\"emh\"},\"id\":\"sbrgz\",\"name\":\"wmsweypqwd\",\"type\":\"ggicccnxqhue\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + SchemaRegistry response = manager.schemaRegistries() + .getByResourceGroupWithResponse("enuuzkopbm", "nrfdw", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("itqscywuggwoluhc", response.location()); + Assertions.assertEquals("emh", response.tags().get("i")); + Assertions.assertEquals("zbhd", response.properties().namespace()); + Assertions.assertEquals("mlmz", response.properties().displayName()); + Assertions.assertEquals("oftrmaequia", response.properties().description()); + Assertions.assertEquals("xicslfao", response.properties().storageAccountContainerUrl()); + Assertions.assertEquals(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListByResourceGroupMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListByResourceGroupMockTests.java new file mode 100644 index 0000000000000..0883b28b3ca44 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListByResourceGroupMockTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistry; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentityType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SchemaRegistriesListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"uuid\":\"ncsdtclusiyp\",\"namespace\":\"sfgytguslfead\",\"displayName\":\"gq\",\"description\":\"yhejhzisxgfp\",\"storageAccountContainerUrl\":\"lolp\",\"provisioningState\":\"Canceled\"},\"identity\":{\"principalId\":\"pqvujzraehtwdwrf\",\"tenantId\":\"wib\",\"type\":\"SystemAssigned\"},\"location\":\"dl\",\"tags\":{\"khevxccedc\":\"hfwpracstwit\",\"jc\":\"nmdyodnwzxl\",\"vvwxqi\":\"nhltiugcxn\",\"unyowxwl\":\"y\"},\"id\":\"djrkvfgbvfvpd\",\"name\":\"odacizs\",\"type\":\"q\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.schemaRegistries().listByResourceGroup("mkttlstvlzywem", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("dl", response.iterator().next().location()); + Assertions.assertEquals("hfwpracstwit", response.iterator().next().tags().get("khevxccedc")); + Assertions.assertEquals("sfgytguslfead", response.iterator().next().properties().namespace()); + Assertions.assertEquals("gq", response.iterator().next().properties().displayName()); + Assertions.assertEquals("yhejhzisxgfp", response.iterator().next().properties().description()); + Assertions.assertEquals("lolp", response.iterator().next().properties().storageAccountContainerUrl()); + Assertions.assertEquals(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED, + response.iterator().next().identity().type()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListMockTests.java new file mode 100644 index 0000000000000..ce224492e587e --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistriesListMockTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistry; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentityType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SchemaRegistriesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"uuid\":\"rribd\",\"namespace\":\"ibqipqkg\",\"displayName\":\"xndzwm\",\"description\":\"efajpj\",\"storageAccountContainerUrl\":\"rwkq\",\"provisioningState\":\"Failed\"},\"identity\":{\"principalId\":\"ij\",\"tenantId\":\"ivfxzsjabibsyst\",\"type\":\"SystemAssigned\"},\"location\":\"sdjpvkvp\",\"tags\":{\"ncj\":\"bkzbzkd\",\"zhjjklffhmouwq\":\"budurgkakmo\",\"eeyebi\":\"gzrf\"},\"id\":\"ikayuhqlbjbsybb\",\"name\":\"wrv\",\"type\":\"ldgmfpgvmpip\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.schemaRegistries().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("sdjpvkvp", response.iterator().next().location()); + Assertions.assertEquals("bkzbzkd", response.iterator().next().tags().get("ncj")); + Assertions.assertEquals("ibqipqkg", response.iterator().next().properties().namespace()); + Assertions.assertEquals("xndzwm", response.iterator().next().properties().displayName()); + Assertions.assertEquals("efajpj", response.iterator().next().properties().description()); + Assertions.assertEquals("rwkq", response.iterator().next().properties().storageAccountContainerUrl()); + Assertions.assertEquals(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED, + response.iterator().next().identity().type()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryInnerTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryInnerTests.java new file mode 100644 index 0000000000000..1a737e1e9dd59 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryInnerTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaRegistryInner; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryProperties; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentityType; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SchemaRegistryInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SchemaRegistryInner model = BinaryData.fromString( + "{\"properties\":{\"uuid\":\"jhtxfvgxbfsmxne\",\"namespace\":\"mpvecxgodebfqk\",\"displayName\":\"bmpukgriwflz\",\"description\":\"bxzpuzycisp\",\"storageAccountContainerUrl\":\"qzahmgkbrp\",\"provisioningState\":\"Canceled\"},\"identity\":{\"principalId\":\"bnuqqkpik\",\"tenantId\":\"rgvtqag\",\"type\":\"SystemAssigned\"},\"location\":\"ynhijggme\",\"tags\":{\"zmhjrunmp\":\"iarbutrcvpna\",\"nkxmyskpbhenbtk\":\"ttdbhrbnl\",\"yxczfclh\":\"xywnytnrsynlqidy\"},\"id\":\"axdbabph\",\"name\":\"wrqlfktsthsuco\",\"type\":\"mnyyazt\"}") + .toObject(SchemaRegistryInner.class); + Assertions.assertEquals("ynhijggme", model.location()); + Assertions.assertEquals("iarbutrcvpna", model.tags().get("zmhjrunmp")); + Assertions.assertEquals("mpvecxgodebfqk", model.properties().namespace()); + Assertions.assertEquals("bmpukgriwflz", model.properties().displayName()); + Assertions.assertEquals("bxzpuzycisp", model.properties().description()); + Assertions.assertEquals("qzahmgkbrp", model.properties().storageAccountContainerUrl()); + Assertions.assertEquals(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SchemaRegistryInner model = new SchemaRegistryInner().withLocation("ynhijggme") + .withTags( + mapOf("zmhjrunmp", "iarbutrcvpna", "nkxmyskpbhenbtk", "ttdbhrbnl", "yxczfclh", "xywnytnrsynlqidy")) + .withProperties(new SchemaRegistryProperties().withNamespace("mpvecxgodebfqk") + .withDisplayName("bmpukgriwflz") + .withDescription("bxzpuzycisp") + .withStorageAccountContainerUrl("qzahmgkbrp")) + .withIdentity( + new SystemAssignedServiceIdentity().withType(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED)); + model = BinaryData.fromObject(model).toObject(SchemaRegistryInner.class); + Assertions.assertEquals("ynhijggme", model.location()); + Assertions.assertEquals("iarbutrcvpna", model.tags().get("zmhjrunmp")); + Assertions.assertEquals("mpvecxgodebfqk", model.properties().namespace()); + Assertions.assertEquals("bmpukgriwflz", model.properties().displayName()); + Assertions.assertEquals("bxzpuzycisp", model.properties().description()); + Assertions.assertEquals("qzahmgkbrp", model.properties().storageAccountContainerUrl()); + Assertions.assertEquals(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryListResultTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryListResultTests.java new file mode 100644 index 0000000000000..3b5048ec4d283 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryListResultTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.implementation.models.SchemaRegistryListResult; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentityType; +import org.junit.jupiter.api.Assertions; + +public final class SchemaRegistryListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SchemaRegistryListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"uuid\":\"lxotogtwrupq\",\"namespace\":\"xvnmicykvceov\",\"displayName\":\"lo\",\"description\":\"oty\",\"storageAccountContainerUrl\":\"jfcn\",\"provisioningState\":\"Accepted\"},\"identity\":{\"principalId\":\"x\",\"tenantId\":\"bttk\",\"type\":\"None\"},\"location\":\"wpn\",\"tags\":{\"hoxus\":\"oqnermclfpl\"},\"id\":\"rpabg\",\"name\":\"epsbjtazqu\",\"type\":\"xywpmueefjzwfqkq\"},{\"properties\":{\"uuid\":\"dsuyonobgla\",\"namespace\":\"cq\",\"displayName\":\"ccm\",\"description\":\"udxytlmoyrx\",\"storageAccountContainerUrl\":\"wfudwpzntxhdzhl\",\"provisioningState\":\"Deleting\"},\"identity\":{\"principalId\":\"ck\",\"tenantId\":\"lhrxsbkyvpyc\",\"type\":\"None\"},\"location\":\"z\",\"tags\":{\"hhseyv\":\"kafkuwbcrnwbm\"},\"id\":\"us\",\"name\":\"tslhspkdeem\",\"type\":\"ofmxagkvtmelmqkr\"},{\"properties\":{\"uuid\":\"vljua\",\"namespace\":\"aquhcdhm\",\"displayName\":\"alaexqpvfadmwsrc\",\"description\":\"vxpvgomz\",\"storageAccountContainerUrl\":\"fmisg\",\"provisioningState\":\"Deleting\"},\"identity\":{\"principalId\":\"e\",\"tenantId\":\"awkz\",\"type\":\"None\"},\"location\":\"io\",\"tags\":{\"xosow\":\"hakauhashsf\",\"cjooxdjebwpucwwf\":\"xcug\",\"hzceuojgjrwjue\":\"ovbvmeueciv\"},\"id\":\"otwmcdyt\",\"name\":\"x\",\"type\":\"it\"},{\"properties\":{\"uuid\":\"jawgqwg\",\"namespace\":\"hniskxfbkpyc\",\"displayName\":\"lwn\",\"description\":\"hjdauwhvylwz\",\"storageAccountContainerUrl\":\"tdhxujznbmpowuwp\",\"provisioningState\":\"Accepted\"},\"identity\":{\"principalId\":\"eualupjmkhf\",\"tenantId\":\"bbcswsrtjri\",\"type\":\"SystemAssigned\"},\"location\":\"bpbewtghfgb\",\"tags\":{\"gibtnm\":\"wxzvlvqhjkb\"},\"id\":\"iebwwaloayqcgwrt\",\"name\":\"j\",\"type\":\"zg\"}],\"nextLink\":\"zmh\"}") + .toObject(SchemaRegistryListResult.class); + Assertions.assertEquals("wpn", model.value().get(0).location()); + Assertions.assertEquals("oqnermclfpl", model.value().get(0).tags().get("hoxus")); + Assertions.assertEquals("xvnmicykvceov", model.value().get(0).properties().namespace()); + Assertions.assertEquals("lo", model.value().get(0).properties().displayName()); + Assertions.assertEquals("oty", model.value().get(0).properties().description()); + Assertions.assertEquals("jfcn", model.value().get(0).properties().storageAccountContainerUrl()); + Assertions.assertEquals(SystemAssignedServiceIdentityType.NONE, model.value().get(0).identity().type()); + Assertions.assertEquals("zmh", model.nextLink()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryPropertiesTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryPropertiesTests.java new file mode 100644 index 0000000000000..735b2f64b29cb --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryPropertiesTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryProperties; +import org.junit.jupiter.api.Assertions; + +public final class SchemaRegistryPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SchemaRegistryProperties model = BinaryData.fromString( + "{\"uuid\":\"twwrqp\",\"namespace\":\"edckzywbiexzfey\",\"displayName\":\"axibxujw\",\"description\":\"qwalmuzyoxaepd\",\"storageAccountContainerUrl\":\"zjancuxr\",\"provisioningState\":\"Canceled\"}") + .toObject(SchemaRegistryProperties.class); + Assertions.assertEquals("edckzywbiexzfey", model.namespace()); + Assertions.assertEquals("axibxujw", model.displayName()); + Assertions.assertEquals("qwalmuzyoxaepd", model.description()); + Assertions.assertEquals("zjancuxr", model.storageAccountContainerUrl()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SchemaRegistryProperties model = new SchemaRegistryProperties().withNamespace("edckzywbiexzfey") + .withDisplayName("axibxujw") + .withDescription("qwalmuzyoxaepd") + .withStorageAccountContainerUrl("zjancuxr"); + model = BinaryData.fromObject(model).toObject(SchemaRegistryProperties.class); + Assertions.assertEquals("edckzywbiexzfey", model.namespace()); + Assertions.assertEquals("axibxujw", model.displayName()); + Assertions.assertEquals("qwalmuzyoxaepd", model.description()); + Assertions.assertEquals("zjancuxr", model.storageAccountContainerUrl()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryUpdatePropertiesTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryUpdatePropertiesTests.java new file mode 100644 index 0000000000000..a15054ded0600 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryUpdatePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryUpdateProperties; +import org.junit.jupiter.api.Assertions; + +public final class SchemaRegistryUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SchemaRegistryUpdateProperties model + = BinaryData.fromString("{\"displayName\":\"tldwkyzxuutk\",\"description\":\"ws\"}") + .toObject(SchemaRegistryUpdateProperties.class); + Assertions.assertEquals("tldwkyzxuutk", model.displayName()); + Assertions.assertEquals("ws", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SchemaRegistryUpdateProperties model + = new SchemaRegistryUpdateProperties().withDisplayName("tldwkyzxuutk").withDescription("ws"); + model = BinaryData.fromObject(model).toObject(SchemaRegistryUpdateProperties.class); + Assertions.assertEquals("tldwkyzxuutk", model.displayName()); + Assertions.assertEquals("ws", model.description()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryUpdateTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryUpdateTests.java new file mode 100644 index 0000000000000..958d084383da1 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaRegistryUpdateTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryUpdate; +import com.azure.resourcemanager.deviceregistry.models.SchemaRegistryUpdateProperties; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentityType; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SchemaRegistryUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SchemaRegistryUpdate model = BinaryData.fromString( + "{\"identity\":{\"principalId\":\"zpfzabglc\",\"tenantId\":\"xwtctyqiklbbovpl\",\"type\":\"SystemAssigned\"},\"tags\":{\"mkfssxqukkfplgm\":\"vgyuguos\",\"wiyighxpkdw\":\"sxnkjzkdeslpvlo\",\"upedeojnabckhs\":\"baiuebbaumny\"},\"properties\":{\"displayName\":\"psiebtfhvpes\",\"description\":\"skrdqmhjj\"}}") + .toObject(SchemaRegistryUpdate.class); + Assertions.assertEquals(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("vgyuguos", model.tags().get("mkfssxqukkfplgm")); + Assertions.assertEquals("psiebtfhvpes", model.properties().displayName()); + Assertions.assertEquals("skrdqmhjj", model.properties().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SchemaRegistryUpdate model = new SchemaRegistryUpdate() + .withIdentity( + new SystemAssignedServiceIdentity().withType(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED)) + .withTags(mapOf("mkfssxqukkfplgm", "vgyuguos", "wiyighxpkdw", "sxnkjzkdeslpvlo", "upedeojnabckhs", + "baiuebbaumny")) + .withProperties( + new SchemaRegistryUpdateProperties().withDisplayName("psiebtfhvpes").withDescription("skrdqmhjj")); + model = BinaryData.fromObject(model).toObject(SchemaRegistryUpdate.class); + Assertions.assertEquals(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("vgyuguos", model.tags().get("mkfssxqukkfplgm")); + Assertions.assertEquals("psiebtfhvpes", model.properties().displayName()); + Assertions.assertEquals("skrdqmhjj", model.properties().description()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionInnerTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionInnerTests.java new file mode 100644 index 0000000000000..12dabcc154787 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionInnerTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.fluent.models.SchemaVersionInner; +import com.azure.resourcemanager.deviceregistry.models.SchemaVersionProperties; +import org.junit.jupiter.api.Assertions; + +public final class SchemaVersionInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SchemaVersionInner model = BinaryData.fromString( + "{\"properties\":{\"uuid\":\"e\",\"description\":\"t\",\"schemaContent\":\"qaqtdoqmcbxvwvxy\",\"hash\":\"qbhsfxobl\",\"provisioningState\":\"Canceled\"},\"id\":\"lmpewwwfbkr\",\"name\":\"rn\",\"type\":\"vshqjohxcr\"}") + .toObject(SchemaVersionInner.class); + Assertions.assertEquals("t", model.properties().description()); + Assertions.assertEquals("qaqtdoqmcbxvwvxy", model.properties().schemaContent()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SchemaVersionInner model = new SchemaVersionInner() + .withProperties(new SchemaVersionProperties().withDescription("t").withSchemaContent("qaqtdoqmcbxvwvxy")); + model = BinaryData.fromObject(model).toObject(SchemaVersionInner.class); + Assertions.assertEquals("t", model.properties().description()); + Assertions.assertEquals("qaqtdoqmcbxvwvxy", model.properties().schemaContent()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionListResultTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionListResultTests.java new file mode 100644 index 0000000000000..1ae95b9de94ea --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionListResultTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.implementation.models.SchemaVersionListResult; +import org.junit.jupiter.api.Assertions; + +public final class SchemaVersionListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SchemaVersionListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"uuid\":\"otftpvjzbexilz\",\"description\":\"fqqnvwpmqtaruo\",\"schemaContent\":\"jmkcjhwqytj\",\"hash\":\"bnw\",\"provisioningState\":\"Deleting\"},\"id\":\"drjervnaenqpehin\",\"name\":\"oygmift\",\"type\":\"nzdndslgna\"}],\"nextLink\":\"igynduhavhqlk\"}") + .toObject(SchemaVersionListResult.class); + Assertions.assertEquals("fqqnvwpmqtaruo", model.value().get(0).properties().description()); + Assertions.assertEquals("jmkcjhwqytj", model.value().get(0).properties().schemaContent()); + Assertions.assertEquals("igynduhavhqlk", model.nextLink()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionPropertiesTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionPropertiesTests.java new file mode 100644 index 0000000000000..c7e2d60e48af2 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionPropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.SchemaVersionProperties; +import org.junit.jupiter.api.Assertions; + +public final class SchemaVersionPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SchemaVersionProperties model = BinaryData.fromString( + "{\"uuid\":\"fovasr\",\"description\":\"v\",\"schemaContent\":\"bhsqfsubcgjbirxb\",\"hash\":\"bsrfbj\",\"provisioningState\":\"Deleting\"}") + .toObject(SchemaVersionProperties.class); + Assertions.assertEquals("v", model.description()); + Assertions.assertEquals("bhsqfsubcgjbirxb", model.schemaContent()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SchemaVersionProperties model + = new SchemaVersionProperties().withDescription("v").withSchemaContent("bhsqfsubcgjbirxb"); + model = BinaryData.fromObject(model).toObject(SchemaVersionProperties.class); + Assertions.assertEquals("v", model.description()); + Assertions.assertEquals("bhsqfsubcgjbirxb", model.schemaContent()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsCreateOrReplaceWithResponseMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsCreateOrReplaceWithResponseMockTests.java new file mode 100644 index 0000000000000..0aa5c64f3ff64 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsCreateOrReplaceWithResponseMockTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.SchemaVersion; +import com.azure.resourcemanager.deviceregistry.models.SchemaVersionProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SchemaVersionsCreateOrReplaceWithResponseMockTests { + @Test + public void testCreateOrReplaceWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"uuid\":\"hfssnrb\",\"description\":\"efr\",\"schemaContent\":\"msgaoj\",\"hash\":\"wncot\",\"provisioningState\":\"Accepted\"},\"id\":\"irctymoxoftpipiw\",\"name\":\"czuhxacpqjlihh\",\"type\":\"usps\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + SchemaVersion response = manager.schemaVersions() + .define("ieoxorggufhyaomt") + .withExistingSchema("awnopqgikyzirtxd", "uxzejntpsew", "ioilqukrydxtq") + .withProperties(new SchemaVersionProperties().withDescription("ovjzhpjbibgjmfx").withSchemaContent("mv")) + .create(); + + Assertions.assertEquals("efr", response.properties().description()); + Assertions.assertEquals("msgaoj", response.properties().schemaContent()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsDeleteWithResponseMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsDeleteWithResponseMockTests.java new file mode 100644 index 0000000000000..1bff9a8eb8b7c --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsDeleteWithResponseMockTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SchemaVersionsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.schemaVersions() + .deleteWithResponse("wtovvtgsein", "fiufx", "knpirgnepttwq", "sniffc", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsGetWithResponseMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsGetWithResponseMockTests.java new file mode 100644 index 0000000000000..1eeb0250aab20 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsGetWithResponseMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.SchemaVersion; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SchemaVersionsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"uuid\":\"bfpncurdo\",\"description\":\"iithtywu\",\"schemaContent\":\"xcbihw\",\"hash\":\"nfdn\",\"provisioningState\":\"Deleting\"},\"id\":\"hrdgoihxumwcto\",\"name\":\"dzjlu\",\"type\":\"dfdlwggyts\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + SchemaVersion response = manager.schemaVersions() + .getWithResponse("stotxh", "jujbypelmcuvhixb", "xyfwnylrcool", "ttpkiwkkbnujrywv", + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("iithtywu", response.properties().description()); + Assertions.assertEquals("xcbihw", response.properties().schemaContent()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsListBySchemaMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsListBySchemaMockTests.java new file mode 100644 index 0000000000000..310798aeee941 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemaVersionsListBySchemaMockTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.SchemaVersion; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SchemaVersionsListBySchemaMockTests { + @Test + public void testListBySchema() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"uuid\":\"yzhftwesgogczh\",\"description\":\"nxkrlgnyhmossxkk\",\"schemaContent\":\"thrrgh\",\"hash\":\"bdhqxvcxgf\",\"provisioningState\":\"Canceled\"},\"id\":\"ofbshr\",\"name\":\"svbuswdvzyy\",\"type\":\"ycnunvjsrtk\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.schemaVersions() + .listBySchema("mqnrojlpijnkr", "frddhcrati", "zronasxift", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("nxkrlgnyhmossxkk", response.iterator().next().properties().description()); + Assertions.assertEquals("thrrgh", response.iterator().next().properties().schemaContent()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasCreateOrReplaceWithResponseMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasCreateOrReplaceWithResponseMockTests.java new file mode 100644 index 0000000000000..3bf3c1d7afd7b --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasCreateOrReplaceWithResponseMockTests.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.Format; +import com.azure.resourcemanager.deviceregistry.models.Schema; +import com.azure.resourcemanager.deviceregistry.models.SchemaProperties; +import com.azure.resourcemanager.deviceregistry.models.SchemaType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SchemasCreateOrReplaceWithResponseMockTests { + @Test + public void testCreateOrReplaceWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"uuid\":\"zejjoqk\",\"displayName\":\"fhsxttaugz\",\"description\":\"faazpxdtnkdmkqjj\",\"format\":\"JsonSchema/draft-07\",\"schemaType\":\"MessageSchema\",\"provisioningState\":\"Accepted\",\"tags\":{\"j\":\"kpyouaibrebqaay\",\"ttezlw\":\"ixqtn\",\"pqqmted\":\"ffiakp\",\"wau\":\"tmmjihyeozph\"}},\"id\":\"ncyg\",\"name\":\"p\",\"type\":\"vipmdscwxqupevzh\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Schema response = manager.schemas() + .define("on") + .withExistingSchemaRegistry("ycxzbfvoo", "vrvmtgjqppyost") + .withProperties(new SchemaProperties().withDisplayName("krrjrea") + .withDescription("tsgumhj") + .withFormat(Format.JSON_SCHEMA_DRAFT7) + .withSchemaType(SchemaType.MESSAGE_SCHEMA) + .withTags(mapOf("qpvuzlmvfelf", "slol", "crpw", "tgp"))) + .create(); + + Assertions.assertEquals("fhsxttaugz", response.properties().displayName()); + Assertions.assertEquals("faazpxdtnkdmkqjj", response.properties().description()); + Assertions.assertEquals(Format.JSON_SCHEMA_DRAFT7, response.properties().format()); + Assertions.assertEquals(SchemaType.MESSAGE_SCHEMA, response.properties().schemaType()); + Assertions.assertEquals("kpyouaibrebqaay", response.properties().tags().get("j")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasDeleteWithResponseMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasDeleteWithResponseMockTests.java new file mode 100644 index 0000000000000..7dba3ad0dff0c --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasDeleteWithResponseMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SchemasDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.schemas().deleteWithResponse("gikdgsz", "w", "birryuzhl", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasGetWithResponseMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasGetWithResponseMockTests.java new file mode 100644 index 0000000000000..2eead55996ceb --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasGetWithResponseMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.Format; +import com.azure.resourcemanager.deviceregistry.models.Schema; +import com.azure.resourcemanager.deviceregistry.models.SchemaType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SchemasGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"uuid\":\"psvuoymgc\",\"displayName\":\"lvez\",\"description\":\"pqlmfe\",\"format\":\"JsonSchema/draft-07\",\"schemaType\":\"MessageSchema\",\"provisioningState\":\"Deleting\",\"tags\":{\"opgxedkowepb\":\"yhko\",\"fkbw\":\"pc\",\"khtj\":\"csnjvcdwxlpqekft\"}},\"id\":\"i\",\"name\":\"gwfqatmt\",\"type\":\"htmdvy\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Schema response = manager.schemas() + .getWithResponse("lvdnkfx", "semdwzrmu", "apfcqdpsq", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("lvez", response.properties().displayName()); + Assertions.assertEquals("pqlmfe", response.properties().description()); + Assertions.assertEquals(Format.JSON_SCHEMA_DRAFT7, response.properties().format()); + Assertions.assertEquals(SchemaType.MESSAGE_SCHEMA, response.properties().schemaType()); + Assertions.assertEquals("yhko", response.properties().tags().get("opgxedkowepb")); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasListBySchemaRegistryMockTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasListBySchemaRegistryMockTests.java new file mode 100644 index 0000000000000..a1a436d051f89 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SchemasListBySchemaRegistryMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.deviceregistry.DeviceRegistryManager; +import com.azure.resourcemanager.deviceregistry.models.Format; +import com.azure.resourcemanager.deviceregistry.models.Schema; +import com.azure.resourcemanager.deviceregistry.models.SchemaType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SchemasListBySchemaRegistryMockTests { + @Test + public void testListBySchemaRegistry() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"uuid\":\"jinrvgoupmfiibfg\",\"displayName\":\"ioolvrwxkvtkkgll\",\"description\":\"jygvjayvbl\",\"format\":\"JsonSchema/draft-07\",\"schemaType\":\"MessageSchema\",\"provisioningState\":\"Succeeded\",\"tags\":{\"opbyrqufegxu\":\"bxvvyhg\",\"bnhlmc\":\"wz\",\"dn\":\"l\",\"ijejvegrhbpn\":\"itvgbmhrixkwm\"}},\"id\":\"xexccbdreaxhcexd\",\"name\":\"rvqahqkghtpwi\",\"type\":\"nhyjsv\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DeviceRegistryManager manager = DeviceRegistryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.schemas().listBySchemaRegistry("kj", "qrvqq", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("ioolvrwxkvtkkgll", response.iterator().next().properties().displayName()); + Assertions.assertEquals("jygvjayvbl", response.iterator().next().properties().description()); + Assertions.assertEquals(Format.JSON_SCHEMA_DRAFT7, response.iterator().next().properties().format()); + Assertions.assertEquals(SchemaType.MESSAGE_SCHEMA, response.iterator().next().properties().schemaType()); + Assertions.assertEquals("bxvvyhg", response.iterator().next().properties().tags().get("opbyrqufegxu")); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SystemAssignedServiceIdentityTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SystemAssignedServiceIdentityTests.java new file mode 100644 index 0000000000000..cb67f0006a34c --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/SystemAssignedServiceIdentityTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentity; +import com.azure.resourcemanager.deviceregistry.models.SystemAssignedServiceIdentityType; +import org.junit.jupiter.api.Assertions; + +public final class SystemAssignedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SystemAssignedServiceIdentity model = BinaryData + .fromString("{\"principalId\":\"avxbniwdjswztsdb\",\"tenantId\":\"nxytxh\",\"type\":\"SystemAssigned\"}") + .toObject(SystemAssignedServiceIdentity.class); + Assertions.assertEquals(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SystemAssignedServiceIdentity model + = new SystemAssignedServiceIdentity().withType(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED); + model = BinaryData.fromObject(model).toObject(SystemAssignedServiceIdentity.class); + Assertions.assertEquals(SystemAssignedServiceIdentityType.SYSTEM_ASSIGNED, model.type()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/TopicTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/TopicTests.java new file mode 100644 index 0000000000000..d7f8aad115c06 --- /dev/null +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/TopicTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.deviceregistry.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.deviceregistry.models.Topic; +import com.azure.resourcemanager.deviceregistry.models.TopicRetainType; +import org.junit.jupiter.api.Assertions; + +public final class TopicTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Topic model = BinaryData.fromString("{\"path\":\"vamih\",\"retain\":\"Never\"}").toObject(Topic.class); + Assertions.assertEquals("vamih", model.path()); + Assertions.assertEquals(TopicRetainType.NEVER, model.retain()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Topic model = new Topic().withPath("vamih").withRetain(TopicRetainType.NEVER); + model = BinaryData.fromObject(model).toObject(Topic.class); + Assertions.assertEquals("vamih", model.path()); + Assertions.assertEquals(TopicRetainType.NEVER, model.retain()); + } +} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/X509CredentialsTests.java b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/X509CredentialsTests.java deleted file mode 100644 index 92068b92cc4ad..0000000000000 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/src/test/java/com/azure/resourcemanager/deviceregistry/generated/X509CredentialsTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.deviceregistry.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.deviceregistry.models.X509Credentials; -import org.junit.jupiter.api.Assertions; - -public final class X509CredentialsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - X509Credentials model - = BinaryData.fromString("{\"certificateReference\":\"c\"}").toObject(X509Credentials.class); - Assertions.assertEquals("c", model.certificateReference()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - X509Credentials model = new X509Credentials().withCertificateReference("c"); - model = BinaryData.fromObject(model).toObject(X509Credentials.class); - Assertions.assertEquals("c", model.certificateReference()); - } -} diff --git a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/tsp-location.yaml b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/tsp-location.yaml index 50ea98fcdb28b..a3c794017c7b0 100644 --- a/sdk/deviceregistry/azure-resourcemanager-deviceregistry/tsp-location.yaml +++ b/sdk/deviceregistry/azure-resourcemanager-deviceregistry/tsp-location.yaml @@ -1,4 +1,4 @@ -commit: 7ed015e3dd1b8b1b0e71c9b5e6b6c5ccb8968b3a -repo: Azure/azure-rest-api-specs directory: specification/deviceregistry/DeviceRegistry.Management -additionalDirectories: [] +commit: 58740206b853320974ef5e4864f7be8120b15a27 +repo: Azure/azure-rest-api-specs +additionalDirectories: