From ade79320f3fc6fc4ef9367f2d4c1d74795d69c4d Mon Sep 17 00:00:00 2001 From: Trevor Anderson Date: Thu, 8 Jun 2023 12:41:57 -0400 Subject: [PATCH 1/2] Merging --- .../azure-data-appconfiguration/assets.json | 6 + .../assets.json | 6 + sdk/core/azure-core-test/assets.json | 6 + .../java/com/azure/xml/AzureXmlTestUtils.java | 25 + .../cosmos/CosmosDiagnosticsRequestEvent.java | 59 + .../cosmos/CosmosDiagnosticsRequestInfo.java | 122 ++ .../CosmosDiagnosticsSystemUsageSnapshot.java | 64 + .../cosmos/AsyncContainerCodeSnippets.java | 150 ++ .../fluent/AccessConnectorsClient.java | 290 +++ .../fluent/models/AccessConnectorInner.java | 116 ++ .../implementation/AccessConnectorImpl.java | 204 +++ .../AccessConnectorsClientImpl.java | 1549 ++++++++++++++++ .../implementation/AccessConnectorsImpl.java | 179 ++ .../databricks/models/AccessConnector.java | 254 +++ .../models/AccessConnectorListResult.java | 81 + .../models/AccessConnectorProperties.java | 39 + .../models/AccessConnectorUpdate.java | 82 + .../databricks/models/AccessConnectors.java | 172 ++ .../models/ManagedDiskEncryption.java | 122 ++ ...nagedDiskEncryptionKeyVaultProperties.java | 123 ++ .../models/ManagedServiceIdentity.java | 143 ++ .../models/ManagedServiceIdentityType.java | 54 + .../models/UserAssignedIdentity.java | 55 + ...AccessConnectorsCreateOrUpdateSamples.java | 44 + .../AccessConnectorsDeleteSamples.java | 21 + ...ssConnectorsGetByResourceGroupSamples.java | 23 + ...sConnectorsListByResourceGroupSamples.java | 21 + .../AccessConnectorsListSamples.java | 21 + .../AccessConnectorsUpdateSamples.java | 41 + .../databricks/DatabricksTests.java | 102 ++ .../generated/AccessConnectorInnerTests.java | 73 + .../AccessConnectorListResultTests.java | 81 + .../AccessConnectorPropertiesTests.java | 22 + .../generated/AccessConnectorUpdateTests.java | 68 + ...cessConnectorsCreateOrUpdateMockTests.java | 96 + .../AccessConnectorsDeleteMockTests.java | 61 + ...tByResourceGroupWithResponseMockTests.java | 73 + ...onnectorsListByResourceGroupMockTests.java | 72 + .../AccessConnectorsListMockTests.java | 70 + .../generated/AddressSpaceTests.java | 26 + .../databricks/generated/CreatedByTests.java | 25 + .../generated/EndpointDependencyTests.java | 63 + .../generated/EndpointDetailTests.java | 39 + .../databricks/generated/ErrorInfoTests.java | 21 + .../GroupIdInformationInnerTests.java | 40 + .../GroupIdInformationPropertiesTests.java | 37 + .../ManagedIdentityConfigurationTests.java | 25 + .../ManagedServiceIdentityTests.java | 55 + .../generated/OperationDisplayTests.java | 39 + .../generated/OperationInnerTests.java | 45 + .../generated/OperationListResultTests.java | 62 + .../generated/OperationsListMockTests.java | 71 + ...OutboundEnvironmentEndpointInnerTests.java | 41 + ...iesEndpointsListWithResponseMockTests.java | 72 + .../PrivateEndpointConnectionInnerTests.java | 55 + ...vateEndpointConnectionPropertiesTests.java | 50 + ...ateEndpointConnectionsCreateMockTests.java | 93 + ...ateEndpointConnectionsDeleteMockTests.java | 61 + ...ntConnectionsGetWithResponseMockTests.java | 78 + ...ivateEndpointConnectionsListMockTests.java | 80 + .../PrivateEndpointConnectionsListTests.java | 48 + .../generated/PrivateEndpointTests.java | 21 + ...LinkResourcesGetWithResponseMockTests.java | 72 + .../PrivateLinkResourcesListMockTests.java | 70 + .../PrivateLinkResourcesListTests.java | 50 + ...rivateLinkServiceConnectionStateTests.java | 37 + .../databricks/generated/SkuTests.java | 26 + .../generated/UserAssignedIdentityTests.java | 25 + .../VNetPeeringsCreateOrUpdateMockTests.java | 90 + .../VNetPeeringsDeleteMockTests.java | 61 + .../VNetPeeringsGetWithResponseMockTests.java | 72 + .../VNetPeeringsListByWorkspaceMockTests.java | 73 + .../VirtualNetworkPeeringInnerTests.java | 57 + .../VirtualNetworkPeeringListTests.java | 63 + ...esFormatDatabricksVirtualNetworkTests.java | 29 + ...ertiesFormatRemoteVirtualNetworkTests.java | 28 + ...alNetworkPeeringPropertiesFormatTests.java | 60 + .../WorkspaceCustomBooleanParameterTests.java | 27 + .../WorkspaceCustomObjectParameterTests.java | 24 + .../WorkspaceCustomStringParameterTests.java | 27 + .../generated/WorkspaceInnerTests.java | 105 ++ .../generated/WorkspaceListResultTests.java | 92 + .../generated/WorkspacePropertiesTests.java | 125 ++ .../WorkspaceProviderAuthorizationTests.java | 34 + .../generated/WorkspaceUpdateTests.java | 40 + .../generated/WorkspacesDeleteMockTests.java | 61 + ...tByResourceGroupWithResponseMockTests.java | 79 + ...orkspacesListByResourceGroupMockTests.java | 77 + .../generated/WorkspacesListMockTests.java | 76 + .../org.mockito.plugins.MockMaker | 1 + sdk/databricks/test-resources.bicep | 27 + sdk/databricks/tests.mgmt.yml | 16 + .../jedis/ClientConstants.java | 16 + .../EventProcessorClientCheckpointing.java | 172 ++ .../instrumentation/EventHubsTracerTests.java | 73 + .../azure-ai-formrecognizer/assets.json | 6 + .../DefaultAzureCredentialAuthFlow.png | Bin 0 -> 36482 bytes .../assets.json | 6 + .../assets.json | 6 + .../azure-security-keyvault-keys/assets.json | 6 + .../assets.json | 6 + .../azure-ai-metricsadvisor/assets.json | 6 + ...t.testUploadLogsInBatchesConcurrently.json | 55 + sdk/monitor/azure-monitor-query/assets.json | 6 + sdk/openai/azure-ai-openai/assets.json | 6 + .../azure/ai/openai/OpenAISyncClientTest.java | 178 ++ .../scanning/implementation/package-info.java | 6 + ...zure-analytics-purview-scanning.properties | 2 + .../workflow/generated/TaskRequestUpdate.java | 30 + .../ApprovalRequestReassignTests.java | 25 + .../workflow/ApprovalRequestRejectTests.java | 23 + .../workflow/ApprovalTaskApproveTests.java | 23 + .../PurviewWorkflowClientTestBase.java | 50 + .../workflow/TaskStatusUpdateTests.java | 23 + .../workflow/UserRequestsSubmitTests.java | 24 + .../purview/workflow/WorkTaskGetTests.java | 22 + .../workflow/WorkflowCreateOrUpdateTests.java | 25 + .../purview/workflow/WorkflowDeleteTests.java | 21 + .../purview/workflow/WorkflowGetTests.java | 21 + .../workflow/WorkflowRunCancelTests.java | 23 + .../purview/workflow/WorkflowRunGetTests.java | 22 + .../workflow/WorkflowRunsListTests.java | 24 + .../workflow/WorkflowTasksListTests.java | 25 + .../purview/workflow/WorkflowsListTests.java | 20 + .../generated/TaskRequestUpdateTests.java | 25 + .../ChildAvailabilityStatusesClient.java | 82 + .../fluent/ChildResourcesClient.java | 48 + .../fluent/EmergingIssuesClient.java | 63 + .../fluent/EventOperationsClient.java | 128 ++ .../fluent/EventsOperationsClient.java | 101 ++ .../fluent/ImpactedResourcesClient.java | 127 ++ .../fluent/MetadatasClient.java | 62 + ...curityAdvisoryImpactedResourcesClient.java | 72 + .../fluent/models/EmergingIssue.java | 112 ++ .../models/EmergingIssuesGetResultInner.java | 132 ++ .../models/EventImpactedResourceInner.java | 111 ++ .../EventImpactedResourceProperties.java | 100 ++ .../fluent/models/EventInner.java | 724 ++++++++ .../fluent/models/EventProperties.java | 793 +++++++++ .../fluent/models/MetadataEntityInner.java | 154 ++ .../models/MetadataEntityProperties.java | 134 ++ .../ChildAvailabilityStatusesClientImpl.java | 511 ++++++ .../ChildAvailabilityStatusesImpl.java | 72 + .../ChildResourcesClientImpl.java | 360 ++++ .../implementation/ChildResourcesImpl.java | 46 + .../EmergingIssuesClientImpl.java | 379 ++++ .../EmergingIssuesGetResultImpl.java | 73 + .../implementation/EmergingIssuesImpl.java | 71 + .../EventImpactedResourceImpl.java | 70 + .../implementation/EventImpl.java | 185 ++ .../EventOperationsClientImpl.java | 637 +++++++ .../implementation/EventOperationsImpl.java | 136 ++ .../EventsOperationsClientImpl.java | 915 ++++++++++ .../implementation/EventsOperationsImpl.java | 66 + .../ImpactedResourcesClientImpl.java | 944 ++++++++++ .../implementation/ImpactedResourcesImpl.java | 112 ++ .../implementation/MetadataEntityImpl.java | 81 + .../implementation/MetadatasClientImpl.java | 376 ++++ .../implementation/MetadatasImpl.java | 69 + ...tyAdvisoryImpactedResourcesClientImpl.java | 647 +++++++ ...SecurityAdvisoryImpactedResourcesImpl.java | 62 + .../models/ChildAvailabilityStatuses.java | 75 + .../resourcehealth/models/ChildResources.java | 43 + .../models/EmergingIssueImpact.java | 106 ++ .../models/EmergingIssueListResult.java | 81 + .../resourcehealth/models/EmergingIssues.java | 55 + .../models/EmergingIssuesGetResult.java | 69 + .../resourcehealth/models/Event.java | 248 +++ .../models/EventImpactedResource.java | 75 + .../EventImpactedResourceListResult.java | 92 + .../models/EventLevelValues.java | 53 + .../models/EventOperations.java | 117 ++ .../EventPropertiesAdditionalInformation.java | 50 + .../models/EventPropertiesArticle.java | 102 ++ .../EventPropertiesRecommendedActions.java | 106 ++ ...EventPropertiesRecommendedActionsItem.java | 76 + .../models/EventSourceValues.java | 47 + .../models/EventStatusValues.java | 47 + .../models/EventTypeValues.java | 59 + .../resourcehealth/models/Events.java | 89 + .../models/EventsOperations.java | 92 + .../resourcehealth/models/Faq.java | 102 ++ .../resourcehealth/models/Impact.java | 80 + .../resourcehealth/models/ImpactedRegion.java | 76 + .../models/ImpactedResources.java | 116 ++ .../models/ImpactedServiceRegion.java | 185 ++ .../models/IssueNameParameter.java | 44 + .../resourcehealth/models/KeyValueItem.java | 54 + .../resourcehealth/models/LevelValues.java | 47 + .../resourcehealth/models/Link.java | 164 ++ .../models/LinkDisplayText.java | 76 + .../resourcehealth/models/LinkTypeValues.java | 47 + .../resourcehealth/models/MetadataEntity.java | 75 + .../models/MetadataEntityListResult.java | 81 + .../models/MetadataSupportedValueDetail.java | 103 ++ .../resourcehealth/models/Metadatas.java | 55 + .../resourcehealth/models/Scenario.java | 44 + .../SecurityAdvisoryImpactedResources.java | 63 + .../resourcehealth/models/SeverityValues.java | 50 + .../resourcehealth/models/StageValues.java | 50 + .../models/StatusActiveEvent.java | 289 +++ .../resourcehealth/models/StatusBanner.java | 129 ++ .../resourcehealth/models/Update.java | 77 + ...ilabilityStatusesGetByResourceSamples.java | 27 + .../ChildAvailabilityStatusesListSamples.java | 27 + .../generated/ChildResourcesListSamples.java | 21 + .../generated/EmergingIssuesGetSamples.java | 22 + .../generated/EmergingIssuesListSamples.java | 20 + ...sBySubscriptionIdAndTrackingIdSamples.java | 23 + ...DetailsByTenantIdAndTrackingIdSamples.java | 23 + ...tBySubscriptionIdAndTrackingIdSamples.java | 24 + ...tionGetByTenantIdAndTrackingIdSamples.java | 24 + ...sOperationListBySingleResourceSamples.java | 26 + .../EventsOperationListByTenantIdSamples.java | 23 + .../generated/EventsOperationListSamples.java | 24 + ...ImpactedResourcesGetByTenantIdSamples.java | 22 + .../ImpactedResourcesGetSamples.java | 20 + ...ListBySubscriptionIdAndEventIdSamples.java | 23 + ...ourcesListByTenantIdAndEventIdSamples.java | 22 + .../generated/MetadataGetEntitySamples.java | 20 + .../generated/MetadataListSamples.java | 20 + ...ListBySubscriptionIdAndEventIdSamples.java | 23 + ...ourcesListByTenantIdAndEventIdSamples.java | 23 + ...sesGetByResourceWithResponseMockTests.java | 103 ++ ...hildAvailabilityStatusesListMockTests.java | 112 ++ .../ChildResourcesListMockTests.java | 113 ++ .../generated/EmergingIssueImpactTests.java | 45 + .../EmergingIssueListResultTests.java | 50 + .../generated/EmergingIssueTests.java | 104 ++ .../EmergingIssuesGetResultInnerTests.java | 127 ++ ...mergingIssuesGetWithResponseMockTests.java | 71 + .../EmergingIssuesListMockTests.java | 69 + .../EventImpactedResourceListResultTests.java | 33 + ...tPropertiesAdditionalInformationTests.java | 28 + .../EventPropertiesArticleTests.java | 34 + ...PropertiesRecommendedActionsItemTests.java | 30 + .../resourcehealth/generated/EventsTests.java | 165 ++ .../resourcehealth/generated/ImpactTests.java | 72 + .../generated/ImpactedRegionTests.java | 27 + ...cesGetByTenantIdWithResponseMockTests.java | 67 + ...ctedResourcesGetWithResponseMockTests.java | 64 + ...stBySubscriptionIdAndEventIdMockTests.java | 67 + ...rcesListByTenantIdAndEventIdMockTests.java | 65 + .../generated/ImpactedServiceRegionTests.java | 56 + .../generated/LinkDisplayTextTests.java | 27 + .../resourcehealth/generated/LinkTests.java | 44 + .../generated/MetadataEntityInnerTests.java | 50 + .../MetadataEntityListResultTests.java | 47 + .../MetadataEntityPropertiesTests.java | 52 + .../MetadataSupportedValueDetailTests.java | 37 + ...tadatasGetEntityWithResponseMockTests.java | 70 + .../generated/MetadatasListMockTests.java | 70 + ...stBySubscriptionIdAndEventIdMockTests.java | 67 + ...rcesListByTenantIdAndEventIdMockTests.java | 67 + .../generated/StatusActiveEventTests.java | 74 + .../generated/StatusBannerTests.java | 40 + .../resourcehealth/generated/UpdateTests.java | 30 + ...tryTaskTests.testRegistryNetworkRules.json | 333 ++++ sdk/search/azure-search-documents/assets.json | 6 + .../ServiceBusTracerTests.java | 73 + ...t_2.7.11_managed_external_dependencies.txt | 1555 +++++++++++++++++ sdk/spring/scripts/version_util.py | 40 + .../azure-storage-blob-batch/assets.json | 6 + .../assets.json | 6 + .../azure-storage-blob-nio/assets.json | 6 + .../HttpFaultInjectingTests.groovy | 212 +++ sdk/storage/azure-storage-queue/assets.json | 6 + sdk/tables/azure-data-tables/assets.json | 6 + .../azure-ai-textanalytics/assets.json | 6 + .../AbstractiveSummaryUtilClient.java | 418 +++++ .../ExtractiveSummaryUtilClient.java | 424 +++++ ...veSummaryActionResultPropertiesHelper.java | 40 + ...ractiveSummaryContextPropertiesHelper.java | 42 + ...ummaryOperationDetailPropertiesHelper.java | 60 + ...mmaryResultCollectionPropertiesHelper.java | 46 + ...tractiveSummaryResultPropertiesHelper.java | 46 + ...veSummaryActionResultPropertiesHelper.java | 39 + ...ummaryOperationDetailPropertiesHelper.java | 59 + ...mmaryResultCollectionPropertiesHelper.java | 45 + ...tractiveSummaryResultPropertiesHelper.java | 45 + ...activeSummarySentencePropertiesHelper.java | 50 + .../models/AbstractiveSummaryAction.java | 106 ++ .../AbstractiveSummaryActionResult.java | 38 + .../models/AbstractiveSummaryContext.java | 67 + .../AbstractiveSummaryOperationDetail.java | 121 ++ .../models/AbstractiveSummaryOptions.java | 103 ++ .../models/AbstractiveSummaryResult.java | 75 + .../models/ExtractiveSummaryAction.java | 135 ++ .../models/ExtractiveSummaryActionResult.java | 38 + .../ExtractiveSummaryOperationDetail.java | 121 ++ .../models/ExtractiveSummaryOptions.java | 132 ++ .../models/ExtractiveSummaryResult.java | 75 + .../models/ExtractiveSummarySentence.java | 96 + .../ExtractiveSummarySentencesOrder.java | 40 + .../util/AbstractiveSummaryPagedFlux.java | 30 + .../util/AbstractiveSummaryPagedIterable.java | 36 + .../AbstractiveSummaryResultCollection.java | 73 + .../util/ExtractiveSummaryPagedFlux.java | 30 + .../util/ExtractiveSummaryPagedIterable.java | 36 + .../ExtractiveSummaryResultCollection.java | 73 + 300 files changed, 28609 insertions(+) create mode 100644 sdk/appconfiguration/azure-data-appconfiguration/assets.json create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/assets.json create mode 100644 sdk/core/azure-core-test/assets.json create mode 100644 sdk/core/azure-xml/src/test/java/com/azure/xml/AzureXmlTestUtils.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsRequestEvent.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsRequestInfo.java create mode 100644 sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsSystemUsageSnapshot.java create mode 100644 sdk/cosmos/azure-cosmos/src/samples/java/com/azure/cosmos/AsyncContainerCodeSnippets.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/fluent/AccessConnectorsClient.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/fluent/models/AccessConnectorInner.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AccessConnectorImpl.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AccessConnectorsClientImpl.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AccessConnectorsImpl.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnector.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectorListResult.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectorProperties.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectorUpdate.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectors.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedDiskEncryption.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedDiskEncryptionKeyVaultProperties.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedServiceIdentity.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedServiceIdentityType.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/UserAssignedIdentity.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsCreateOrUpdateSamples.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsDeleteSamples.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsGetByResourceGroupSamples.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListByResourceGroupSamples.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListSamples.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsUpdateSamples.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/DatabricksTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorInnerTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorListResultTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorPropertiesTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorUpdateTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsCreateOrUpdateMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsDeleteMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsGetByResourceGroupWithResponseMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListByResourceGroupMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AddressSpaceTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/CreatedByTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/EndpointDependencyTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/EndpointDetailTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/ErrorInfoTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/GroupIdInformationInnerTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/GroupIdInformationPropertiesTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/ManagedIdentityConfigurationTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/ManagedServiceIdentityTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationDisplayTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationInnerTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationListResultTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationsListMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OutboundEnvironmentEndpointInnerTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OutboundNetworkDependenciesEndpointsListWithResponseMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionInnerTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionPropertiesTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsCreateMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsDeleteMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsListMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsListTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkResourcesGetWithResponseMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkResourcesListMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkResourcesListTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkServiceConnectionStateTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/SkuTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/UserAssignedIdentityTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsCreateOrUpdateMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsDeleteMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsGetWithResponseMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsListByWorkspaceMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringInnerTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringListTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetworkTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetworkTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringPropertiesFormatTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceCustomBooleanParameterTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceCustomObjectParameterTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceCustomStringParameterTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceInnerTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceListResultTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacePropertiesTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceProviderAuthorizationTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceUpdateTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesDeleteMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesGetByResourceGroupWithResponseMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesListByResourceGroupMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesListMockTests.java create mode 100644 sdk/databricks/azure-resourcemanager-databricks/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker create mode 100644 sdk/databricks/test-resources.bicep create mode 100644 sdk/databricks/tests.mgmt.yml create mode 100644 sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/src/main/java/com/azure/messaging/eventhubs/checkpointstore/jedis/ClientConstants.java create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientCheckpointing.java create mode 100644 sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/instrumentation/EventHubsTracerTests.java create mode 100644 sdk/formrecognizer/azure-ai-formrecognizer/assets.json create mode 100644 sdk/identity/azure-identity/src/main/java/com/azure/identity/doc-files/DefaultAzureCredentialAuthFlow.png create mode 100644 sdk/keyvault/azure-security-keyvault-administration/assets.json create mode 100644 sdk/keyvault/azure-security-keyvault-certificates/assets.json create mode 100644 sdk/keyvault/azure-security-keyvault-keys/assets.json create mode 100644 sdk/keyvault/azure-security-keyvault-secrets/assets.json create mode 100644 sdk/metricsadvisor/azure-ai-metricsadvisor/assets.json create mode 100644 sdk/monitor/azure-monitor-ingestion/src/test/resources/session-records/LogsIngestionAsyncClientTest.testUploadLogsInBatchesConcurrently.json create mode 100644 sdk/monitor/azure-monitor-query/assets.json create mode 100644 sdk/openai/azure-ai-openai/assets.json create mode 100644 sdk/openai/azure-ai-openai/src/test/java/com/azure/ai/openai/OpenAISyncClientTest.java create mode 100644 sdk/purview/azure-analytics-purview-scanning/src/main/java/com/azure/analytics/purview/scanning/implementation/package-info.java create mode 100644 sdk/purview/azure-analytics-purview-scanning/src/main/resources/azure-analytics-purview-scanning.properties create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/samples/java/com/azure/analytics/purview/workflow/generated/TaskRequestUpdate.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/ApprovalRequestReassignTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/ApprovalRequestRejectTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/ApprovalTaskApproveTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/PurviewWorkflowClientTestBase.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/TaskStatusUpdateTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/UserRequestsSubmitTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkTaskGetTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowCreateOrUpdateTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowDeleteTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowGetTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowRunCancelTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowRunGetTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowRunsListTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowTasksListTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowsListTests.java create mode 100644 sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/generated/TaskRequestUpdateTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildAvailabilityStatusesClient.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildResourcesClient.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EmergingIssuesClient.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventOperationsClient.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventsOperationsClient.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ImpactedResourcesClient.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/MetadatasClient.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/SecurityAdvisoryImpactedResourcesClient.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssue.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssuesGetResultInner.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceInner.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceProperties.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventInner.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventProperties.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/MetadataEntityInner.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/MetadataEntityProperties.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesClientImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildResourcesClientImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildResourcesImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesClientImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesGetResultImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpactedResourceImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsClientImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsClientImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesClientImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadataEntityImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadatasClientImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadatasImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesClientImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesImpl.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ChildAvailabilityStatuses.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ChildResources.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueImpact.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueListResult.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssues.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssuesGetResult.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Event.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResource.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResourceListResult.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventLevelValues.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventOperations.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesAdditionalInformation.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesArticle.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActions.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActionsItem.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventSourceValues.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventStatusValues.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventTypeValues.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Events.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventsOperations.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Faq.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Impact.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedRegion.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedResources.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedServiceRegion.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/IssueNameParameter.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/KeyValueItem.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LevelValues.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Link.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkDisplayText.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkTypeValues.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntity.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntityListResult.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataSupportedValueDetail.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Metadatas.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Scenario.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SecurityAdvisoryImpactedResources.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SeverityValues.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StageValues.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusActiveEvent.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusBanner.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Update.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesGetByResourceSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesListSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildResourcesListSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesListSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsBySubscriptionIdAndTrackingIdSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsByTenantIdAndTrackingIdSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetBySubscriptionIdAndTrackingIdSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetByTenantIdAndTrackingIdSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListBySingleResourceSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListByTenantIdSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetByTenantIdSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListBySubscriptionIdAndEventIdSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListByTenantIdAndEventIdSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataGetEntitySamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataListSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdSamples.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesGetByResourceWithResponseMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesListMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ChildResourcesListMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssueImpactTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssueListResultTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssueTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetResultInnerTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetWithResponseMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesListMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventImpactedResourceListResultTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventPropertiesAdditionalInformationTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventPropertiesArticleTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventPropertiesRecommendedActionsItemTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventsTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedRegionTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetByTenantIdWithResponseMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetWithResponseMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListBySubscriptionIdAndEventIdMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListByTenantIdAndEventIdMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedServiceRegionTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/LinkDisplayTextTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/LinkTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataEntityInnerTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataEntityListResultTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataEntityPropertiesTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataSupportedValueDetailTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadatasGetEntityWithResponseMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadatasListMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdMockTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/StatusActiveEventTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/StatusBannerTests.java create mode 100644 sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/UpdateTests.java create mode 100644 sdk/resourcemanager/azure-resourcemanager-containerregistry/src/test/resources/session-records/RegistryTaskTests.testRegistryNetworkRules.json create mode 100644 sdk/search/azure-search-documents/assets.json create mode 100644 sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusTracerTests.java create mode 100644 sdk/spring/scripts/spring_boot_2.7.11_managed_external_dependencies.txt create mode 100644 sdk/spring/scripts/version_util.py create mode 100644 sdk/storage/azure-storage-blob-batch/assets.json create mode 100644 sdk/storage/azure-storage-blob-cryptography/assets.json create mode 100644 sdk/storage/azure-storage-blob-nio/assets.json create mode 100644 sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/HttpFaultInjectingTests.groovy create mode 100644 sdk/storage/azure-storage-queue/assets.json create mode 100644 sdk/tables/azure-data-tables/assets.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/assets.json create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AbstractiveSummaryUtilClient.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractiveSummaryUtilClient.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryActionResultPropertiesHelper.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryContextPropertiesHelper.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryOperationDetailPropertiesHelper.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryResultCollectionPropertiesHelper.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryResultPropertiesHelper.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryActionResultPropertiesHelper.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryOperationDetailPropertiesHelper.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryResultCollectionPropertiesHelper.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryResultPropertiesHelper.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummarySentencePropertiesHelper.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryAction.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryActionResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryContext.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryOperationDetail.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryOptions.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryAction.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryActionResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryOperationDetail.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryOptions.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryResult.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummarySentence.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummarySentencesOrder.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AbstractiveSummaryPagedFlux.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AbstractiveSummaryPagedIterable.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AbstractiveSummaryResultCollection.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ExtractiveSummaryPagedFlux.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ExtractiveSummaryPagedIterable.java create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ExtractiveSummaryResultCollection.java diff --git a/sdk/appconfiguration/azure-data-appconfiguration/assets.json b/sdk/appconfiguration/azure-data-appconfiguration/assets.json new file mode 100644 index 000000000000..2f61eb4dc0aa --- /dev/null +++ b/sdk/appconfiguration/azure-data-appconfiguration/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "java", + "TagPrefix": "java/appconfiguration/azure-data-appconfiguration", + "Tag": "java/appconfiguration/azure-data-appconfiguration_e11f5115c6" +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/assets.json b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/assets.json new file mode 100644 index 000000000000..aec8e8a0c250 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "java", + "TagPrefix": "java/confidentialledger/azure-resourcemanager-confidentialledger", + "Tag": "java/confidentialledger/azure-resourcemanager-confidentialledger_d746c472d6" +} diff --git a/sdk/core/azure-core-test/assets.json b/sdk/core/azure-core-test/assets.json new file mode 100644 index 000000000000..c2998453c839 --- /dev/null +++ b/sdk/core/azure-core-test/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "java", + "TagPrefix": "java/core/azure-core-test", + "Tag": "java/core/azure-core-test_9e498ae101" +} diff --git a/sdk/core/azure-xml/src/test/java/com/azure/xml/AzureXmlTestUtils.java b/sdk/core/azure-xml/src/test/java/com/azure/xml/AzureXmlTestUtils.java new file mode 100644 index 000000000000..6f551a507df4 --- /dev/null +++ b/sdk/core/azure-xml/src/test/java/com/azure/xml/AzureXmlTestUtils.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.xml; + +/** + * Test utilities. + */ +public final class AzureXmlTestUtils { + /** + * Gets the XML root element name that should be used. + * + * @param rootElementName The XML root element name passed to {@link XmlSerializable#toXml(XmlWriter, String)} + * or {@link XmlSerializable#fromXml(XmlReader, String)} implementations. + * @param defaultRootElementName The XML root element name defined by Swagger to TypeSpec. + * @return The root element name that should be used. {@code rootElementName} is used if it isn't null or empty, + * otherwise {@code defaultRootElementName} is used. + */ + public static String getRootElementName(String rootElementName, String defaultRootElementName) { + return (rootElementName == null || rootElementName.isEmpty()) ? defaultRootElementName : rootElementName; + } + + private AzureXmlTestUtils() { + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsRequestEvent.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsRequestEvent.java new file mode 100644 index 000000000000..9fbcba693b22 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsRequestEvent.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.cosmos; + +import java.time.Duration; +import java.time.Instant; + +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; + +/** + * This class represents diagnostic information for different steps in the request pipeline when + * processing a data plane request (for example to issue a point operation against a certain replica). This information + * can be useful to identify where in the request pipeline an error happened or latency was spent - for example whether + * high latency was due to the fact that a new channel (TCP connection with SSL handshake) needed to be created + * or because the transport took a long time due to network issues etc. + */ +public final class CosmosDiagnosticsRequestEvent { + + private final Instant startTime; + private final Duration duration; + private final String name; + + CosmosDiagnosticsRequestEvent( + Instant startTime, + Duration duration, + String name) { + + checkNotNull(startTime, "Argument 'startTime' must not be null."); + checkNotNull(name, "Argument 'name' must not be null."); + this.startTime = startTime; + this.duration = duration; + this.name = name; + } + + /** + * Gets the start time of the request pipeline event + * @return the start time of the request pipeline event + */ + public Instant getStartTime() { + return this.startTime; + } + + /** + * Gets the duration for the request pipeline event - or null when the pipeline event hasn't finished (yet). + * @return the duration for the request pipeline event or null when the pipeline event hasn't finished (yet). + */ + public Duration getDuration() { + return this.duration; + } + + /** + * Gets the name of the request pipeline event. + * @return the name of the request pipeline event. + */ + public String getEventName() { + return this.name; + } + +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsRequestInfo.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsRequestInfo.java new file mode 100644 index 000000000000..2a3ca73730f9 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsRequestInfo.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.cosmos; + +import java.time.Duration; +import java.time.Instant; +import java.util.Collection; + +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; + +/** + * This class represents diagnostic information for transport requests (calls to a replica in direct mode, calls to + * the Gateway for example to get metadata like physical addresses of replica for a partition. + */ +public final class CosmosDiagnosticsRequestInfo { + + private final String activityId; + private final String partitionId; + private final String partitionKeyRangeId; + private final String requestType; + private final Instant startTime; + private final Duration duration; + private final Duration backendLatency; + private final Collection events; + + CosmosDiagnosticsRequestInfo( + String activityId, + String partitionId, // nullable + String partitionKeyRangeId, // nullable + String requestType, + Instant startTime, + Duration duration, // nullable + Duration backendLatency, // nullable + double requestCharge, + int responsePayloadSizeInBytes, + int statusCode, + int subStatusCode, + Collection events) { + + checkNotNull(activityId, "Argument 'activityId' must not be null."); + checkNotNull(requestType, "Argument 'requestType' must not be null."); + checkNotNull(startTime, "Argument 'startTime' must not be null."); + checkNotNull(events, "Argument 'events' must not be null."); + + this.activityId = activityId; + this.partitionId = partitionId; + this.partitionKeyRangeId = partitionKeyRangeId; + this.requestType = requestType; + this.startTime = startTime; + this.duration = duration; + this.events = events; + this.backendLatency = backendLatency; + } + + /** + * Gets the Activity used to track this request in the Cosmos DB service. + * @return the Activity used to track this request in the Cosmos DB service. + */ + public String getActivityId() { + return this.activityId; + } + + /** + * Gets the identifier for the physical partition/shard this request was processed in or null when the request + * was not targeting a replica/partition directly. + * @return the identifier for the physical partition/shard this request was processed in or null when the request + * was not targeting a replica/partition directly. + */ + public String getPartitionId() { + return this.partitionId; + } + + /** + * Gets the PartitionKeyRangeId for the physical partition/shard this request was processed in or null when the request + * was not targeting a replica/partition directly. + * @return the PartitionKeyRangeId for the physical partition/shard this request was processed in or null when the request + * was not targeting a replica/partition directly. + */ + public String getPartitionKeyRangeId() { + return this.partitionKeyRangeId; + } + + /** + * Gets the type of request + * @return the type of the request + */ + public String getRequestType() { + return this.requestType; + } + + /** + * Gets the start time of the request. + * @return the start time of the request. + */ + public Instant getStartTime() { + return this.startTime; + } + + /** + * Gets the total duration for processing this request. + * @return the total duration for processing this request. + */ + public Duration getDuration() { + return this.duration; + } + + /** + * Gets the backend latency if available or null when backend latency isn't available for a request + * @return the backend latency if available or null when backend latency isn't available for a request + */ + public Duration getBackendLatency() { + return this.backendLatency; + } + + /** + * Gets more granular information about different stages of the request pipeline. + * @return more granular information about different stages of the request pipeline. + */ + public Collection getRequestPipelineEvents() { + return this.events; + } +} diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsSystemUsageSnapshot.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsSystemUsageSnapshot.java new file mode 100644 index 000000000000..423303a6fd86 --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosDiagnosticsSystemUsageSnapshot.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.cosmos; + +import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull; + +/** + * This class represents a snapshot of the system usage when processing the operation. It can be useful to investigate + * whether client resource exhaustion caused high latency etc. + */ +public final class CosmosDiagnosticsSystemUsageSnapshot { + private final String usedMemory; + private final String availableMemory; + private final String systemCpuLoad; + private final int availableProcessors; + + CosmosDiagnosticsSystemUsageSnapshot( + String systemCpuLoad, + String usedMemory, + String availableMemory, + int availableProcessors) { + + checkNotNull(systemCpuLoad, "Argument 'systemCpuLoad' must not be null."); + checkNotNull(usedMemory, "Argument 'usedMemory' must not be null."); + checkNotNull(availableMemory, "Argument 'availableMemory' must not be null."); + + this.systemCpuLoad = systemCpuLoad; + this.usedMemory = usedMemory; + this.availableMemory = availableMemory; + this.availableProcessors = availableProcessors; + } + + /** + * Gets the current memory usage (JVM-wide) + * @return the current memory usage (JVM-wide) + */ + public String getUsedMemory() { + return usedMemory; + } + + /** + * Gets the available memory (JVM-wide) + * @return the available memory (JVM-wide) + */ + public String getAvailableMemory() { + return availableMemory; + } + + /** + * Gets the system-wide CPU usage for the last 60 seconds (in 5 second intervals) + * @return the system-wide CPU usage for the last 60 seconds (in 5 second intervals) + */ + public String getSystemCpuLoad() { + return systemCpuLoad; + } + + /** + * Gets the number of processors available in the JVM + * @return the number of processors available in the JVM + */ + public int getAvailableProcessors() { + return availableProcessors; + } +} diff --git a/sdk/cosmos/azure-cosmos/src/samples/java/com/azure/cosmos/AsyncContainerCodeSnippets.java b/sdk/cosmos/azure-cosmos/src/samples/java/com/azure/cosmos/AsyncContainerCodeSnippets.java new file mode 100644 index 000000000000..13d8a84a6d0f --- /dev/null +++ b/sdk/cosmos/azure-cosmos/src/samples/java/com/azure/cosmos/AsyncContainerCodeSnippets.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.cosmos; + +import com.azure.cosmos.models.*; +import reactor.core.publisher.Mono; + +import java.util.Collections; +import java.util.List; + +public class AsyncContainerCodeSnippets { + private final CosmosAsyncClient cosmosAsyncClient = new CosmosClientBuilder() + .endpoint("") + .key("") + .buildAsyncClient(); + + private final CosmosClient cosmosClient = new CosmosClientBuilder() + .endpoint("") + .key("") + .buildClient(); + + private final CosmosAsyncContainer cosmosAsyncContainer = cosmosAsyncClient + .getDatabase("") + .getContainer(""); + + private final CosmosContainer cosmosContainer = cosmosClient + .getDatabase("") + .getContainer(""); + + public void getFeedRangesAsyncSample() { + // BEGIN: com.azure.cosmos.CosmosAsyncContainer.getFeedRanges + cosmosAsyncContainer.getFeedRanges() + .subscribe(feedRanges -> { + for (FeedRange feedRange : feedRanges) { + System.out.println("Feed range: " + feedRange); + } + }); + // END: com.azure.cosmos.CosmosAsyncContainer.getFeedRanges + } + + public void getFeedRangesSample() { + // BEGIN: com.azure.cosmos.CosmosContainer.getFeedRanges + List feedRanges = cosmosContainer.getFeedRanges(); + for (FeedRange feedRange : feedRanges) { + System.out.println("Feed range: " + feedRange); + } + // END: com.azure.cosmos.CosmosContainer.getFeedRanges + } + + public void readThroughputAsyncSample() { + // BEGIN: com.azure.cosmos.CosmosAsyncContainer.readThroughput + Mono throughputResponseMono = cosmosAsyncContainer.readThroughput(); + throughputResponseMono.subscribe(throughputResponse -> { + System.out.println(throughputResponse); + }, throwable -> { + throwable.printStackTrace(); + }); + // END: com.azure.cosmos.CosmosAsyncContainer.readThroughput + } + + public void readThroughputSample() { + // BEGIN: com.azure.cosmos.CosmosContainer.readThroughput + try { + ThroughputResponse throughputResponse = cosmosContainer.readThroughput(); + System.out.println(throughputResponse); + } catch (CosmosException ce) { + ce.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + // END: com.azure.cosmos.CosmosContainer.readThroughput + } + + public void replaceThroughputAsyncSample() { + // BEGIN: com.azure.cosmos.CosmosAsyncContainer.replaceThroughput + ThroughputProperties throughputProperties = + ThroughputProperties.createAutoscaledThroughput(1000); + + cosmosAsyncContainer.replaceThroughput(throughputProperties) + .subscribe(throughputResponse -> { + System.out.println(throughputResponse); + }, + throwable -> { + throwable.printStackTrace(); + }); + // END: com.azure.cosmos.CosmosAsyncContainer.replaceThroughput + } + + public void replaceThroughputSample() { + // BEGIN: com.azure.cosmos.CosmosContainer.replaceThroughput + ThroughputProperties throughputProperties = + ThroughputProperties.createAutoscaledThroughput(1000); + try { + ThroughputResponse throughputResponse = + cosmosContainer.replaceThroughput(throughputProperties); + System.out.println(throughputResponse); + } catch (CosmosException ce) { + ce.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + // END: com.azure.cosmos.CosmosContainer.replaceThroughput + } + + public void queryConflictsAsyncSample() { + List conflictIds = Collections.emptyList(); + String query = "SELECT * from c where c.id in (%s)"; + // BEGIN: com.azure.cosmos.CosmosAsyncContainer.queryConflicts + try { + cosmosAsyncContainer.queryConflicts(query). + byPage(100) + .subscribe(response -> { + for (CosmosConflictProperties conflictProperties : response.getResults()) { + System.out.println(conflictProperties); + } + }, throwable -> { + throwable.printStackTrace(); + }); + } catch (CosmosException ce) { + ce.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + // END: com.azure.cosmos.CosmosAsyncContainer.queryConflicts + } + + public void readAllConflictsAsyncSample() { + List conflictIds = Collections.emptyList(); + CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); + // BEGIN: com.azure.cosmos.CosmosAsyncContainer.readAllConflicts + try { + cosmosAsyncContainer.readAllConflicts(options). + byPage(100) + .subscribe(response -> { + for (CosmosConflictProperties conflictProperties : response.getResults()) { + System.out.println(conflictProperties); + } + }, throwable -> { + throwable.printStackTrace(); + }); + } catch (CosmosException ce) { + ce.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + // END: com.azure.cosmos.CosmosAsyncContainer.readAllConflicts + } + +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/fluent/AccessConnectorsClient.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/fluent/AccessConnectorsClient.java new file mode 100644 index 000000000000..2adc4e497b9c --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/fluent/AccessConnectorsClient.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.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.databricks.fluent.models.AccessConnectorInner; +import com.azure.resourcemanager.databricks.models.AccessConnectorUpdate; + +/** An instance of this class provides access to all the operations defined in AccessConnectorsClient. */ +public interface AccessConnectorsClient { + /** + * Gets an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an azure databricks accessConnector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String connectorName, Context context); + + /** + * Gets an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessConnectorInner getByResourceGroup(String resourceGroupName, String connectorName); + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException 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 connectorName); + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException 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 connectorName, Context context); + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException 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 connectorName); + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException 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 connectorName, Context context); + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException 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 information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccessConnectorInner> beginCreateOrUpdate( + String resourceGroupName, String connectorName, AccessConnectorInner parameters); + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException 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 information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccessConnectorInner> beginCreateOrUpdate( + String resourceGroupName, String connectorName, AccessConnectorInner parameters, Context context); + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessConnectorInner createOrUpdate( + String resourceGroupName, String connectorName, AccessConnectorInner parameters); + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessConnectorInner createOrUpdate( + String resourceGroupName, String connectorName, AccessConnectorInner parameters, Context context); + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException 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 information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccessConnectorInner> beginUpdate( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters); + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException 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 information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccessConnectorInner> beginUpdate( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters, Context context); + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessConnectorInner update(String resourceGroupName, String connectorName, AccessConnectorUpdate parameters); + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccessConnectorInner update( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters, Context context); + + /** + * Gets all the azure databricks accessConnectors within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all the azure databricks accessConnectors within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all the azure databricks accessConnectors within a subscription. + * + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all the azure databricks accessConnectors within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/fluent/models/AccessConnectorInner.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/fluent/models/AccessConnectorInner.java new file mode 100644 index 000000000000..f916e71fadf0 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/fluent/models/AccessConnectorInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.databricks.models.AccessConnectorProperties; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentity; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Information about azure databricks accessConnector. */ +@Fluent +public final class AccessConnectorInner extends Resource { + /* + * Managed service identity (system assigned and/or user assigned identities) + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Azure Databricks accessConnector properties + */ + @JsonProperty(value = "properties") + private AccessConnectorProperties properties; + + /** Creates an instance of AccessConnectorInner class. */ + public AccessConnectorInner() { + } + + /** + * Get the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @param identity the identity value to set. + * @return the AccessConnectorInner object itself. + */ + public AccessConnectorInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the properties property: Azure Databricks accessConnector properties. + * + * @return the properties value. + */ + public AccessConnectorProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Azure Databricks accessConnector properties. + * + * @param properties the properties value to set. + * @return the AccessConnectorInner object itself. + */ + public AccessConnectorInner withProperties(AccessConnectorProperties properties) { + this.properties = properties; + return this; + } + + /** {@inheritDoc} */ + @Override + public AccessConnectorInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AccessConnectorInner withTags(Map tags) { + super.withTags(tags); + 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(); + } + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AccessConnectorImpl.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AccessConnectorImpl.java new file mode 100644 index 000000000000..4f5d8dc2904f --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AccessConnectorImpl.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.databricks.fluent.models.AccessConnectorInner; +import com.azure.resourcemanager.databricks.models.AccessConnector; +import com.azure.resourcemanager.databricks.models.AccessConnectorProperties; +import com.azure.resourcemanager.databricks.models.AccessConnectorUpdate; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentity; +import java.util.Collections; +import java.util.Map; + +public final class AccessConnectorImpl implements AccessConnector, AccessConnector.Definition, AccessConnector.Update { + private AccessConnectorInner innerObject; + + private final com.azure.resourcemanager.databricks.AzureDatabricksManager 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 ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public AccessConnectorProperties properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AccessConnectorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.databricks.AzureDatabricksManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String connectorName; + + private AccessConnectorUpdate updateParameters; + + public AccessConnectorImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public AccessConnector create() { + this.innerObject = + serviceManager + .serviceClient() + .getAccessConnectors() + .createOrUpdate(resourceGroupName, connectorName, this.innerModel(), Context.NONE); + return this; + } + + public AccessConnector create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccessConnectors() + .createOrUpdate(resourceGroupName, connectorName, this.innerModel(), context); + return this; + } + + AccessConnectorImpl(String name, com.azure.resourcemanager.databricks.AzureDatabricksManager serviceManager) { + this.innerObject = new AccessConnectorInner(); + this.serviceManager = serviceManager; + this.connectorName = name; + } + + public AccessConnectorImpl update() { + this.updateParameters = new AccessConnectorUpdate(); + return this; + } + + public AccessConnector apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAccessConnectors() + .update(resourceGroupName, connectorName, updateParameters, Context.NONE); + return this; + } + + public AccessConnector apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccessConnectors() + .update(resourceGroupName, connectorName, updateParameters, context); + return this; + } + + AccessConnectorImpl( + AccessConnectorInner innerObject, com.azure.resourcemanager.databricks.AzureDatabricksManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.connectorName = Utils.getValueFromIdByName(innerObject.id(), "accessConnectors"); + } + + public AccessConnector refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAccessConnectors() + .getByResourceGroupWithResponse(resourceGroupName, connectorName, Context.NONE) + .getValue(); + return this; + } + + public AccessConnector refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAccessConnectors() + .getByResourceGroupWithResponse(resourceGroupName, connectorName, context) + .getValue(); + return this; + } + + public AccessConnectorImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AccessConnectorImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AccessConnectorImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public AccessConnectorImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public AccessConnectorImpl withProperties(AccessConnectorProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AccessConnectorsClientImpl.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AccessConnectorsClientImpl.java new file mode 100644 index 000000000000..3df208ba0158 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AccessConnectorsClientImpl.java @@ -0,0 +1,1549 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.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.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.databricks.fluent.AccessConnectorsClient; +import com.azure.resourcemanager.databricks.fluent.models.AccessConnectorInner; +import com.azure.resourcemanager.databricks.models.AccessConnectorListResult; +import com.azure.resourcemanager.databricks.models.AccessConnectorUpdate; +import com.azure.resourcemanager.databricks.models.ErrorInfoException; +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 AccessConnectorsClient. */ +public final class AccessConnectorsClientImpl implements AccessConnectorsClient { + /** The proxy service used to perform REST calls. */ + private final AccessConnectorsService service; + + /** The service client containing this operation class. */ + private final AzureDatabricksManagementClientImpl client; + + /** + * Initializes an instance of AccessConnectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AccessConnectorsClientImpl(AzureDatabricksManagementClientImpl client) { + this.service = + RestProxy.create(AccessConnectorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDatabricksManagementClientAccessConnectors to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDatabricksManag") + public interface AccessConnectorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/accessConnectors/{connectorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorInfoException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("connectorName") String connectorName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/accessConnectors/{connectorName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ErrorInfoException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("connectorName") String connectorName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/accessConnectors/{connectorName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ErrorInfoException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("connectorName") String connectorName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") AccessConnectorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/accessConnectors/{connectorName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ErrorInfoException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("connectorName") String connectorName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") AccessConnectorUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/accessConnectors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorInfoException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Databricks/accessConnectors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorInfoException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorInfoException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorInfoException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an azure databricks accessConnector along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String connectorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName 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 apiVersion = "2023-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + connectorName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an azure databricks accessConnector along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String connectorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName 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 apiVersion = "2023-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + connectorName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an azure databricks accessConnector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String connectorName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, connectorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an azure databricks accessConnector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String connectorName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, connectorName, context).block(); + } + + /** + * Gets an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessConnectorInner getByResourceGroup(String resourceGroupName, String connectorName) { + return getByResourceGroupWithResponse(resourceGroupName, connectorName, Context.NONE).getValue(); + } + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 connectorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName 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 apiVersion = "2023-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + connectorName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 connectorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName 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 apiVersion = "2023-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + connectorName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 connectorName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, connectorName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 connectorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, connectorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 connectorName) { + return this.beginDeleteAsync(resourceGroupName, connectorName).getSyncPoller(); + } + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 connectorName, Context context) { + return this.beginDeleteAsync(resourceGroupName, connectorName, context).getSyncPoller(); + } + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 connectorName) { + return beginDeleteAsync(resourceGroupName, connectorName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 connectorName, Context context) { + return beginDeleteAsync(resourceGroupName, connectorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 connectorName) { + deleteAsync(resourceGroupName, connectorName).block(); + } + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 connectorName, Context context) { + deleteAsync(resourceGroupName, connectorName, context).block(); + } + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String connectorName, AccessConnectorInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2023-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + connectorName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String connectorName, AccessConnectorInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2023-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + connectorName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccessConnectorInner> beginCreateOrUpdateAsync( + String resourceGroupName, String connectorName, AccessConnectorInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, connectorName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AccessConnectorInner.class, + AccessConnectorInner.class, + this.client.getContext()); + } + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccessConnectorInner> beginCreateOrUpdateAsync( + String resourceGroupName, String connectorName, AccessConnectorInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, connectorName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AccessConnectorInner.class, AccessConnectorInner.class, context); + } + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccessConnectorInner> beginCreateOrUpdate( + String resourceGroupName, String connectorName, AccessConnectorInner parameters) { + return this.beginCreateOrUpdateAsync(resourceGroupName, connectorName, parameters).getSyncPoller(); + } + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccessConnectorInner> beginCreateOrUpdate( + String resourceGroupName, String connectorName, AccessConnectorInner parameters, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, connectorName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String connectorName, AccessConnectorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, connectorName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String connectorName, AccessConnectorInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, connectorName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessConnectorInner createOrUpdate( + String resourceGroupName, String connectorName, AccessConnectorInner parameters) { + return createOrUpdateAsync(resourceGroupName, connectorName, parameters).block(); + } + + /** + * Creates or updates azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters Parameters supplied to the create or update an azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessConnectorInner createOrUpdate( + String resourceGroupName, String connectorName, AccessConnectorInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, connectorName, parameters, context).block(); + } + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2023-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + connectorName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (connectorName == null) { + return Mono.error(new IllegalArgumentException("Parameter connectorName 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 (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2023-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + connectorName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccessConnectorInner> beginUpdateAsync( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, connectorName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AccessConnectorInner.class, + AccessConnectorInner.class, + this.client.getContext()); + } + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccessConnectorInner> beginUpdateAsync( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, connectorName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AccessConnectorInner.class, AccessConnectorInner.class, context); + } + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccessConnectorInner> beginUpdate( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters) { + return this.beginUpdateAsync(resourceGroupName, connectorName, parameters).getSyncPoller(); + } + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException 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 information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccessConnectorInner> beginUpdate( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters, Context context) { + return this.beginUpdateAsync(resourceGroupName, connectorName, parameters, context).getSyncPoller(); + } + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters) { + return beginUpdateAsync(resourceGroupName, connectorName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, connectorName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessConnectorInner update( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters) { + return updateAsync(resourceGroupName, connectorName, parameters).block(); + } + + /** + * Updates an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param parameters The update to the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about azure databricks accessConnector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccessConnectorInner update( + String resourceGroupName, String connectorName, AccessConnectorUpdate parameters, Context context) { + return updateAsync(resourceGroupName, connectorName, parameters, context).block(); + } + + /** + * Gets all the azure databricks accessConnectors within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a resource group 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2023-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + 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())); + } + + /** + * Gets all the azure databricks accessConnectors within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a resource group 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 apiVersion = "2023-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all the azure databricks accessConnectors within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the azure databricks accessConnectors within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a resource group 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)); + } + + /** + * Gets all the azure databricks accessConnectors within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets all the azure databricks accessConnectors within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets all the azure databricks accessConnectors within a subscription. + * + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a subscription 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 apiVersion = "2023-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, 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())); + } + + /** + * Gets all the azure databricks accessConnectors within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a subscription 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 apiVersion = "2023-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all the azure databricks accessConnectors within a subscription. + * + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a subscription as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the azure databricks accessConnectors within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a subscription as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all the azure databricks accessConnectors within a subscription. + * + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets all the azure databricks accessConnectors within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of azure databricks accessConnector along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of azure databricks accessConnector along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of azure databricks accessConnector along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorInfoException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of azure databricks accessConnector 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/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AccessConnectorsImpl.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AccessConnectorsImpl.java new file mode 100644 index 000000000000..2880d20d903f --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AccessConnectorsImpl.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.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.databricks.fluent.AccessConnectorsClient; +import com.azure.resourcemanager.databricks.fluent.models.AccessConnectorInner; +import com.azure.resourcemanager.databricks.models.AccessConnector; +import com.azure.resourcemanager.databricks.models.AccessConnectors; + +public final class AccessConnectorsImpl implements AccessConnectors { + private static final ClientLogger LOGGER = new ClientLogger(AccessConnectorsImpl.class); + + private final AccessConnectorsClient innerClient; + + private final com.azure.resourcemanager.databricks.AzureDatabricksManager serviceManager; + + public AccessConnectorsImpl( + AccessConnectorsClient innerClient, + com.azure.resourcemanager.databricks.AzureDatabricksManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String connectorName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, connectorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AccessConnectorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AccessConnector getByResourceGroup(String resourceGroupName, String connectorName) { + AccessConnectorInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, connectorName); + if (inner != null) { + return new AccessConnectorImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String connectorName) { + this.serviceClient().delete(resourceGroupName, connectorName); + } + + public void delete(String resourceGroupName, String connectorName, Context context) { + this.serviceClient().delete(resourceGroupName, connectorName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AccessConnectorImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AccessConnectorImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AccessConnectorImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AccessConnectorImpl(inner1, this.manager())); + } + + public AccessConnector getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String connectorName = Utils.getValueFromIdByName(id, "accessConnectors"); + if (connectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'accessConnectors'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, connectorName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String connectorName = Utils.getValueFromIdByName(id, "accessConnectors"); + if (connectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'accessConnectors'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, connectorName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String connectorName = Utils.getValueFromIdByName(id, "accessConnectors"); + if (connectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'accessConnectors'.", id))); + } + this.delete(resourceGroupName, connectorName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String connectorName = Utils.getValueFromIdByName(id, "accessConnectors"); + if (connectorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'accessConnectors'.", id))); + } + this.delete(resourceGroupName, connectorName, context); + } + + private AccessConnectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.databricks.AzureDatabricksManager manager() { + return this.serviceManager; + } + + public AccessConnectorImpl define(String name) { + return new AccessConnectorImpl(name, this.manager()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnector.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnector.java new file mode 100644 index 000000000000..f0c2d5df1915 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnector.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.databricks.fluent.models.AccessConnectorInner; +import java.util.Map; + +/** An immutable client-side representation of AccessConnector. */ +public interface AccessConnector { + /** + * 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 identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the properties property: Azure Databricks accessConnector properties. + * + * @return the properties value. + */ + AccessConnectorProperties properties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.databricks.fluent.models.AccessConnectorInner object. + * + * @return the inner object. + */ + AccessConnectorInner innerModel(); + + /** The entirety of the AccessConnector definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The AccessConnector definition stages. */ + interface DefinitionStages { + /** The first stage of the AccessConnector definition. */ + interface Blank extends WithLocation { + } + /** The stage of the AccessConnector 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 AccessConnector 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 AccessConnector 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.WithIdentity, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + AccessConnector create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AccessConnector create(Context context); + } + /** The stage of the AccessConnector 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 AccessConnector definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed service identity (system assigned and/or user assigned + * identities). + * + * @param identity Managed service identity (system assigned and/or user assigned identities). + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the AccessConnector definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Azure Databricks accessConnector properties. + * + * @param properties Azure Databricks accessConnector properties. + * @return the next definition stage. + */ + WithCreate withProperties(AccessConnectorProperties properties); + } + } + /** + * Begins update for the AccessConnector resource. + * + * @return the stage of resource update. + */ + AccessConnector.Update update(); + + /** The template for AccessConnector update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AccessConnector apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AccessConnector apply(Context context); + } + /** The AccessConnector update stages. */ + interface UpdateStages { + /** The stage of the AccessConnector 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 AccessConnector update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed service identity (system assigned and/or user assigned + * identities). + * + * @param identity Managed service identity (system assigned and/or user assigned identities). + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AccessConnector refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AccessConnector refresh(Context context); +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectorListResult.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectorListResult.java new file mode 100644 index 000000000000..371a07370c21 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectorListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.databricks.fluent.models.AccessConnectorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of azure databricks accessConnector. */ +@Fluent +public final class AccessConnectorListResult { + /* + * The array of azure databricks accessConnector. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of AccessConnectorListResult class. */ + public AccessConnectorListResult() { + } + + /** + * Get the value property: The array of azure databricks accessConnector. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The array of azure databricks accessConnector. + * + * @param value the value value to set. + * @return the AccessConnectorListResult object itself. + */ + public AccessConnectorListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the AccessConnectorListResult object itself. + */ + public AccessConnectorListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectorProperties.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectorProperties.java new file mode 100644 index 000000000000..cf63f4a495c1 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectorProperties.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AccessConnectorProperties model. */ +@Immutable +public final class AccessConnectorProperties { + /* + * Provisioning status of the accessConnector. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of AccessConnectorProperties class. */ + public AccessConnectorProperties() { + } + + /** + * Get the provisioningState property: Provisioning status of the accessConnector. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectorUpdate.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectorUpdate.java new file mode 100644 index 000000000000..5edc75335bd4 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectorUpdate.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An update to an azure databricks accessConnector. */ +@Fluent +public final class AccessConnectorUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Managed service identity (system assigned and/or user assigned identities) + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /** Creates an instance of AccessConnectorUpdate class. */ + public AccessConnectorUpdate() { + } + + /** + * 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 AccessConnectorUpdate object itself. + */ + public AccessConnectorUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed service identity (system assigned and/or user assigned identities). + * + * @param identity the identity value to set. + * @return the AccessConnectorUpdate object itself. + */ + public AccessConnectorUpdate withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectors.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectors.java new file mode 100644 index 000000000000..82d609f08b23 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/AccessConnectors.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.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 AccessConnectors. */ +public interface AccessConnectors { + /** + * Gets an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an azure databricks accessConnector along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String connectorName, Context context); + + /** + * Gets an azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an azure databricks accessConnector. + */ + AccessConnector getByResourceGroup(String resourceGroupName, String connectorName); + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException 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 connectorName); + + /** + * Deletes the azure databricks accessConnector. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param connectorName The name of the azure databricks accessConnector. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException 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 connectorName, Context context); + + /** + * Gets all the azure databricks accessConnectors within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all the azure databricks accessConnectors within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all the azure databricks accessConnectors within a subscription. + * + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a subscription as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets all the azure databricks accessConnectors within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all the azure databricks accessConnectors within a subscription as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets an azure databricks accessConnector. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an azure databricks accessConnector along with {@link Response}. + */ + AccessConnector getById(String id); + + /** + * Gets an azure databricks accessConnector. + * + * @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.resourcemanager.databricks.models.ErrorInfoException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an azure databricks accessConnector along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the azure databricks accessConnector. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.resourcemanager.databricks.models.ErrorInfoException 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); + + /** + * Deletes the azure databricks accessConnector. + * + * @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.resourcemanager.databricks.models.ErrorInfoException 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 AccessConnector resource. + * + * @param name resource name. + * @return the first stage of the new AccessConnector definition. + */ + AccessConnector.DefinitionStages.Blank define(String name); +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedDiskEncryption.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedDiskEncryption.java new file mode 100644 index 000000000000..bdbd0326398a --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedDiskEncryption.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that contains details of encryption used on the workspace. */ +@Fluent +public final class ManagedDiskEncryption { + /* + * The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Keyvault + */ + @JsonProperty(value = "keySource", required = true) + private EncryptionKeySource keySource; + + /* + * Key Vault input properties for encryption. + */ + @JsonProperty(value = "keyVaultProperties", required = true) + private ManagedDiskEncryptionKeyVaultProperties keyVaultProperties; + + /* + * Indicate whether the latest key version should be automatically used for Managed Disk Encryption. + */ + @JsonProperty(value = "rotationToLatestKeyVersionEnabled") + private Boolean rotationToLatestKeyVersionEnabled; + + /** Creates an instance of ManagedDiskEncryption class. */ + public ManagedDiskEncryption() { + } + + /** + * Get the keySource property: The encryption keySource (provider). Possible values (case-insensitive): + * Microsoft.Keyvault. + * + * @return the keySource value. + */ + public EncryptionKeySource keySource() { + return this.keySource; + } + + /** + * Set the keySource property: The encryption keySource (provider). Possible values (case-insensitive): + * Microsoft.Keyvault. + * + * @param keySource the keySource value to set. + * @return the ManagedDiskEncryption object itself. + */ + public ManagedDiskEncryption withKeySource(EncryptionKeySource keySource) { + this.keySource = keySource; + return this; + } + + /** + * Get the keyVaultProperties property: Key Vault input properties for encryption. + * + * @return the keyVaultProperties value. + */ + public ManagedDiskEncryptionKeyVaultProperties keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set the keyVaultProperties property: Key Vault input properties for encryption. + * + * @param keyVaultProperties the keyVaultProperties value to set. + * @return the ManagedDiskEncryption object itself. + */ + public ManagedDiskEncryption withKeyVaultProperties(ManagedDiskEncryptionKeyVaultProperties keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + return this; + } + + /** + * Get the rotationToLatestKeyVersionEnabled property: Indicate whether the latest key version should be + * automatically used for Managed Disk Encryption. + * + * @return the rotationToLatestKeyVersionEnabled value. + */ + public Boolean rotationToLatestKeyVersionEnabled() { + return this.rotationToLatestKeyVersionEnabled; + } + + /** + * Set the rotationToLatestKeyVersionEnabled property: Indicate whether the latest key version should be + * automatically used for Managed Disk Encryption. + * + * @param rotationToLatestKeyVersionEnabled the rotationToLatestKeyVersionEnabled value to set. + * @return the ManagedDiskEncryption object itself. + */ + public ManagedDiskEncryption withRotationToLatestKeyVersionEnabled(Boolean rotationToLatestKeyVersionEnabled) { + this.rotationToLatestKeyVersionEnabled = rotationToLatestKeyVersionEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keySource() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property keySource in model ManagedDiskEncryption")); + } + if (keyVaultProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property keyVaultProperties in model ManagedDiskEncryption")); + } else { + keyVaultProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedDiskEncryption.class); +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedDiskEncryptionKeyVaultProperties.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedDiskEncryptionKeyVaultProperties.java new file mode 100644 index 000000000000..7417878e70b7 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedDiskEncryptionKeyVaultProperties.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Key Vault input properties for encryption. */ +@Fluent +public final class ManagedDiskEncryptionKeyVaultProperties { + /* + * The URI of KeyVault. + */ + @JsonProperty(value = "keyVaultUri", required = true) + private String keyVaultUri; + + /* + * The name of KeyVault key. + */ + @JsonProperty(value = "keyName", required = true) + private String keyName; + + /* + * The version of KeyVault key. + */ + @JsonProperty(value = "keyVersion", required = true) + private String keyVersion; + + /** Creates an instance of ManagedDiskEncryptionKeyVaultProperties class. */ + public ManagedDiskEncryptionKeyVaultProperties() { + } + + /** + * Get the keyVaultUri property: The URI of KeyVault. + * + * @return the keyVaultUri value. + */ + public String keyVaultUri() { + return this.keyVaultUri; + } + + /** + * Set the keyVaultUri property: The URI of KeyVault. + * + * @param keyVaultUri the keyVaultUri value to set. + * @return the ManagedDiskEncryptionKeyVaultProperties object itself. + */ + public ManagedDiskEncryptionKeyVaultProperties withKeyVaultUri(String keyVaultUri) { + this.keyVaultUri = keyVaultUri; + return this; + } + + /** + * Get the keyName property: The name of KeyVault key. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: The name of KeyVault key. + * + * @param keyName the keyName value to set. + * @return the ManagedDiskEncryptionKeyVaultProperties object itself. + */ + public ManagedDiskEncryptionKeyVaultProperties withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the keyVersion property: The version of KeyVault key. + * + * @return the keyVersion value. + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set the keyVersion property: The version of KeyVault key. + * + * @param keyVersion the keyVersion value to set. + * @return the ManagedDiskEncryptionKeyVaultProperties object itself. + */ + public ManagedDiskEncryptionKeyVaultProperties withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyVaultUri() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property keyVaultUri in model ManagedDiskEncryptionKeyVaultProperties")); + } + if (keyName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property keyName in model ManagedDiskEncryptionKeyVaultProperties")); + } + if (keyVersion() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property keyVersion in model ManagedDiskEncryptionKeyVaultProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedDiskEncryptionKeyVaultProperties.class); +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedServiceIdentity.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..6f9543ff9c13 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedServiceIdentity.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Managed service identity (system assigned and/or user assigned identities). */ +@Fluent +public final class ManagedServiceIdentity { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ + @JsonProperty(value = "type", required = true) + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys + * will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** Creates an instance of ManagedServiceIdentity class. */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + 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 UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedServiceIdentityType.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..d63fc35f94e5 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/ManagedServiceIdentityType.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** Static value None for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** Static value SystemAssigned,UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = + fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + @JsonCreator + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/UserAssignedIdentity.java b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..d9980b2286c2 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/models/UserAssignedIdentity.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** User assigned identity properties. */ +@Immutable +public final class UserAssignedIdentity { + /* + * The principal ID of the assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** Creates an instance of UserAssignedIdentity class. */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsCreateOrUpdateSamples.java b/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..ff298898694e --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsCreateOrUpdateSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +/** Samples for AccessConnectors CreateOrUpdate. */ +public final class AccessConnectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-05-01/examples/AccessConnectorCreateOrUpdateWithUserAssigned.json + */ + /** + * Sample code: Create an azure databricks accessConnector with UserAssigned Identity. + * + * @param manager Entry point to AzureDatabricksManager. + */ + public static void createAnAzureDatabricksAccessConnectorWithUserAssignedIdentity( + com.azure.resourcemanager.databricks.AzureDatabricksManager manager) { + manager + .accessConnectors() + .define("myAccessConnector") + .withRegion("westus") + .withExistingResourceGroup("rg") + .create(); + } + + /* + * x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-05-01/examples/AccessConnectorCreateOrUpdate.json + */ + /** + * Sample code: Create an azure databricks accessConnector with SystemAssigned Identity. + * + * @param manager Entry point to AzureDatabricksManager. + */ + public static void createAnAzureDatabricksAccessConnectorWithSystemAssignedIdentity( + com.azure.resourcemanager.databricks.AzureDatabricksManager manager) { + manager + .accessConnectors() + .define("myAccessConnector") + .withRegion("westus") + .withExistingResourceGroup("rg") + .create(); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsDeleteSamples.java b/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsDeleteSamples.java new file mode 100644 index 000000000000..fc75b0cc9ece --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsDeleteSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +/** Samples for AccessConnectors Delete. */ +public final class AccessConnectorsDeleteSamples { + /* + * x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-05-01/examples/AccessConnectorDelete.json + */ + /** + * Sample code: Delete an azure databricks accessConnector. + * + * @param manager Entry point to AzureDatabricksManager. + */ + public static void deleteAnAzureDatabricksAccessConnector( + com.azure.resourcemanager.databricks.AzureDatabricksManager manager) { + manager.accessConnectors().delete("rg", "myAccessConnector", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsGetByResourceGroupSamples.java b/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..55bc601177dc --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +/** Samples for AccessConnectors GetByResourceGroup. */ +public final class AccessConnectorsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-05-01/examples/AccessConnectorGet.json + */ + /** + * Sample code: Get an azure databricks accessConnector. + * + * @param manager Entry point to AzureDatabricksManager. + */ + public static void getAnAzureDatabricksAccessConnector( + com.azure.resourcemanager.databricks.AzureDatabricksManager manager) { + manager + .accessConnectors() + .getByResourceGroupWithResponse("rg", "myAccessConnector", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListByResourceGroupSamples.java b/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListByResourceGroupSamples.java new file mode 100644 index 000000000000..ac7cae8adee8 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +/** Samples for AccessConnectors ListByResourceGroup. */ +public final class AccessConnectorsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-05-01/examples/AccessConnectorsListByResourceGroup.json + */ + /** + * Sample code: Lists azure databricks accessConnectors within a resource group. + * + * @param manager Entry point to AzureDatabricksManager. + */ + public static void listsAzureDatabricksAccessConnectorsWithinAResourceGroup( + com.azure.resourcemanager.databricks.AzureDatabricksManager manager) { + manager.accessConnectors().listByResourceGroup("rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListSamples.java b/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListSamples.java new file mode 100644 index 000000000000..a3720bd55c08 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +/** Samples for AccessConnectors List. */ +public final class AccessConnectorsListSamples { + /* + * x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-05-01/examples/AccessConnectorsListBySubscriptionId.json + */ + /** + * Sample code: Lists all the azure databricks accessConnectors within a subscription. + * + * @param manager Entry point to AzureDatabricksManager. + */ + public static void listsAllTheAzureDatabricksAccessConnectorsWithinASubscription( + com.azure.resourcemanager.databricks.AzureDatabricksManager manager) { + manager.accessConnectors().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsUpdateSamples.java b/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsUpdateSamples.java new file mode 100644 index 000000000000..03b6a1398526 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/samples/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.resourcemanager.databricks.models.AccessConnector; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AccessConnectors Update. */ +public final class AccessConnectorsUpdateSamples { + /* + * x-ms-original-file: specification/databricks/resource-manager/Microsoft.Databricks/stable/2023-05-01/examples/AccessConnectorPatchUpdate.json + */ + /** + * Sample code: Update an azure databricks accessConnector. + * + * @param manager Entry point to AzureDatabricksManager. + */ + public static void updateAnAzureDatabricksAccessConnector( + com.azure.resourcemanager.databricks.AzureDatabricksManager manager) { + AccessConnector resource = + manager + .accessConnectors() + .getByResourceGroupWithResponse("rg", "myAccessConnector", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "value1")).apply(); + } + + @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/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/DatabricksTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/DatabricksTests.java new file mode 100644 index 000000000000..13dbad9944fe --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/DatabricksTests.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.databricks; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.Region; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.TestBase; +import com.azure.core.test.annotation.DoNotRecord; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.identity.DefaultAzureCredentialBuilder; +import com.azure.resourcemanager.databricks.models.Sku; +import com.azure.resourcemanager.databricks.models.Workspace; +import com.azure.resourcemanager.resources.ResourceManager; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.Random; + +public class DatabricksTests extends TestBase { + + private static final Random RANDOM = new Random(); + + private static final Region REGION = Region.US_WEST2; + private String resourceGroupName = "rg" + randomPadding(); + private AzureDatabricksManager databricksManager; + private ResourceManager resourceManager; + private boolean testEnv; + + @Override + public void beforeTest() { + final TokenCredential credential = new DefaultAzureCredentialBuilder().build(); + final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); + + databricksManager = AzureDatabricksManager + .configure().withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)) + .authenticate(credential, profile); + + resourceManager = ResourceManager + .configure().withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)) + .authenticate(credential, profile) + .withDefaultSubscription(); + + // use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI + String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME"); + testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup); + if (testEnv) { + resourceGroupName = testResourceGroup; + } else { + resourceManager.resourceGroups().define(resourceGroupName) + .withRegion(REGION) + .create(); + } + } + + @Override + protected void afterTest() { + if (!testEnv) { + resourceManager.resourceGroups().beginDeleteByName(resourceGroupName); + } + } + + @Test + @DoNotRecord(skipInPlayback = true) + public void testCrudWorkspace() { + Workspace workspace = null; + try { + String workspaceName = "workspace" + randomPadding(); + String managedResourceGroupId = resourceManager.resourceGroups().getByName(resourceGroupName).id() + .replace(resourceGroupName, "databricks-" + resourceGroupName); + // @embedmeStart + workspace = databricksManager.workspaces().define(workspaceName) + .withRegion(REGION) + .withExistingResourceGroup(resourceGroupName) + .withManagedResourceGroupId(managedResourceGroupId) + .withSku(new Sku().withName("standard")) + .create(); + // @embedmeEnd + + workspace.refresh(); + + Assertions.assertEquals(workspaceName, workspace.name()); + + Assertions.assertEquals(workspace.name(), databricksManager.workspaces().getById(workspace.id()).name()); + + Assertions.assertTrue(databricksManager.workspaces().listByResourceGroup(resourceGroupName).stream().count() > 0); + } finally { + if (workspace != null) { + databricksManager.workspaces().deleteById(workspace.id()); + } + } + } + + private static String randomPadding() { + return String.format("%05d", Math.abs(RANDOM.nextInt() % 100000)); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorInnerTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorInnerTests.java new file mode 100644 index 000000000000..f6450a5a0e48 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorInnerTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.AccessConnectorInner; +import com.azure.resourcemanager.databricks.models.AccessConnectorProperties; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentity; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.databricks.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AccessConnectorInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccessConnectorInner model = + BinaryData + .fromString( + "{\"identity\":{\"principalId\":\"d3f50460-46be-46e7-884a-0472d3ced6a0\",\"tenantId\":\"c6ad9185-7349-42a7-9a5a-c54cbe0b6047\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"pwhonowkg\":{\"principalId\":\"ffab6ef8-9d89-4559-9bf1-a3c451a1f48e\",\"clientId\":\"676bb094-89fb-4e81-ac9b-22f8c0fdd646\"},\"ankixzbinjeput\":{\"principalId\":\"f7b1a267-cf28-418a-8b43-6a376a7316ed\",\"clientId\":\"24087e3c-201e-4c88-ac71-552551711bb9\"},\"ywnuzoq\":{\"principalId\":\"1df0b5f8-6614-47d0-a7d8-ba169d810656\",\"clientId\":\"e1a3360b-409c-48ee-81fc-5dd4733dc455\"}}},\"properties\":{\"provisioningState\":\"Failed\"},\"location\":\"zrnkcqvyxlwh\",\"tags\":{\"yav\":\"icohoqqnwvl\",\"konocu\":\"hheunmmqhgyx\",\"zf\":\"oklyaxuconuq\",\"vjektcxsenh\":\"beypewrmjmw\"},\"id\":\"lrsf\",\"name\":\"rzpwvlqdqgbiq\",\"type\":\"lihkaetcktvfc\"}") + .toObject(AccessConnectorInner.class); + Assertions.assertEquals("zrnkcqvyxlwh", model.location()); + Assertions.assertEquals("icohoqqnwvl", model.tags().get("yav")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccessConnectorInner model = + new AccessConnectorInner() + .withLocation("zrnkcqvyxlwh") + .withTags( + mapOf( + "yav", + "icohoqqnwvl", + "konocu", + "hheunmmqhgyx", + "zf", + "oklyaxuconuq", + "vjektcxsenh", + "beypewrmjmw")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "pwhonowkg", + new UserAssignedIdentity(), + "ankixzbinjeput", + new UserAssignedIdentity(), + "ywnuzoq", + new UserAssignedIdentity()))) + .withProperties(new AccessConnectorProperties()); + model = BinaryData.fromObject(model).toObject(AccessConnectorInner.class); + Assertions.assertEquals("zrnkcqvyxlwh", model.location()); + Assertions.assertEquals("icohoqqnwvl", model.tags().get("yav")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.identity().type()); + } + + @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/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorListResultTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorListResultTests.java new file mode 100644 index 000000000000..61858a9f78e5 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorListResultTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.AccessConnectorInner; +import com.azure.resourcemanager.databricks.models.AccessConnectorListResult; +import com.azure.resourcemanager.databricks.models.AccessConnectorProperties; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentity; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentityType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AccessConnectorListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccessConnectorListResult model = + BinaryData + .fromString( + "{\"value\":[{\"identity\":{\"principalId\":\"89510fc0-1456-4c4f-9e2c-b4ff51a0a0fb\",\"tenantId\":\"4bd764c1-2bb9-4057-9a1b-7a0f5ce42ec7\",\"type\":\"None\",\"userAssignedIdentities\":{}},\"properties\":{\"provisioningState\":\"Updating\"},\"location\":\"nhijggmebfsi\",\"tags\":{\"pnazzm\":\"utrc\"},\"id\":\"jrunmpxtt\",\"name\":\"bh\",\"type\":\"bnlankxmyskpb\"},{\"identity\":{\"principalId\":\"00613ad4-f0d7-4ffa-a440-e9570fab7430\",\"tenantId\":\"33ee25bb-dbe2-4360-a7c5-a72475458984\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{}},\"properties\":{\"provisioningState\":\"Creating\"},\"location\":\"ny\",\"tags\":{\"haaxdbabphl\":\"synlqidybyxczfc\"},\"id\":\"rqlfktsthsucocmn\",\"name\":\"yazttbtwwrqpue\",\"type\":\"ckzywbiexzfeyue\"},{\"identity\":{\"principalId\":\"42426329-5d6a-4e8c-a848-2008d200015e\",\"tenantId\":\"63cf7029-3723-49aa-9800-7b671e7394de\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{}},\"properties\":{\"provisioningState\":\"Created\"},\"location\":\"qwalmuzyoxaepd\",\"tags\":{\"bavxbniwdjswzt\":\"ancuxrhd\",\"xbzpfzab\":\"dbpgnxytxhp\"},\"id\":\"lcuhxwtctyqiklb\",\"name\":\"ovplw\",\"type\":\"bhvgy\"}],\"nextLink\":\"uosvmkfssxqukk\"}") + .toObject(AccessConnectorListResult.class); + Assertions.assertEquals("nhijggmebfsi", model.value().get(0).location()); + Assertions.assertEquals("utrc", model.value().get(0).tags().get("pnazzm")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.value().get(0).identity().type()); + Assertions.assertEquals("uosvmkfssxqukk", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccessConnectorListResult model = + new AccessConnectorListResult() + .withValue( + Arrays + .asList( + new AccessConnectorInner() + .withLocation("nhijggmebfsi") + .withTags(mapOf("pnazzm", "utrc")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf())) + .withProperties(new AccessConnectorProperties()), + new AccessConnectorInner() + .withLocation("ny") + .withTags(mapOf("haaxdbabphl", "synlqidybyxczfc")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withProperties(new AccessConnectorProperties()), + new AccessConnectorInner() + .withLocation("qwalmuzyoxaepd") + .withTags(mapOf("bavxbniwdjswzt", "ancuxrhd", "xbzpfzab", "dbpgnxytxhp")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withProperties(new AccessConnectorProperties()))) + .withNextLink("uosvmkfssxqukk"); + model = BinaryData.fromObject(model).toObject(AccessConnectorListResult.class); + Assertions.assertEquals("nhijggmebfsi", model.value().get(0).location()); + Assertions.assertEquals("utrc", model.value().get(0).tags().get("pnazzm")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.value().get(0).identity().type()); + Assertions.assertEquals("uosvmkfssxqukk", model.nextLink()); + } + + @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/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorPropertiesTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorPropertiesTests.java new file mode 100644 index 000000000000..89df7211b27e --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorPropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.AccessConnectorProperties; + +public final class AccessConnectorPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccessConnectorProperties model = + BinaryData.fromString("{\"provisioningState\":\"Ready\"}").toObject(AccessConnectorProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccessConnectorProperties model = new AccessConnectorProperties(); + model = BinaryData.fromObject(model).toObject(AccessConnectorProperties.class); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorUpdateTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorUpdateTests.java new file mode 100644 index 000000000000..2e838c5f0b64 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorUpdateTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.AccessConnectorUpdate; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentity; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.databricks.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AccessConnectorUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccessConnectorUpdate model = + BinaryData + .fromString( + "{\"tags\":{\"jljyoxgv\":\"ujqgidok\",\"szzhbijhtxfvgxbf\":\"ltbgsncghkj\",\"ec\":\"mxnehmp\",\"gr\":\"godebfqkkrbmpu\"},\"identity\":{\"principalId\":\"1411a3e5-a26f-4f94-ae71-b0ec1b527d3e\",\"tenantId\":\"25c17099-5ea0-43a7-8d65-5393b15ee9cb\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"zpuzycisp\":{\"principalId\":\"a5bb5228-9b36-4d1a-8c16-697e2406d47c\",\"clientId\":\"18034bca-9343-4048-8ff9-2d93f2df9bb6\"},\"ahmgkbrp\":{\"principalId\":\"2f2e3a07-f555-4d7a-a167-9d9820bce1ef\",\"clientId\":\"a134ac77-e688-46b9-8127-7dcd30b025f7\"},\"hibnuqqkpika\":{\"principalId\":\"98b0ab9d-d3b5-4d5b-b0cc-0082ca9f4f84\",\"clientId\":\"9252c6e2-cb83-4857-8734-2dde7a217efa\"}}}}") + .toObject(AccessConnectorUpdate.class); + Assertions.assertEquals("ujqgidok", model.tags().get("jljyoxgv")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.identity().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccessConnectorUpdate model = + new AccessConnectorUpdate() + .withTags( + mapOf( + "jljyoxgv", + "ujqgidok", + "szzhbijhtxfvgxbf", + "ltbgsncghkj", + "ec", + "mxnehmp", + "gr", + "godebfqkkrbmpu")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "zpuzycisp", + new UserAssignedIdentity(), + "ahmgkbrp", + new UserAssignedIdentity(), + "hibnuqqkpika", + new UserAssignedIdentity()))); + model = BinaryData.fromObject(model).toObject(AccessConnectorUpdate.class); + Assertions.assertEquals("ujqgidok", model.tags().get("jljyoxgv")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.identity().type()); + } + + @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/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsCreateOrUpdateMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..c7fc8d292b61 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsCreateOrUpdateMockTests.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.AccessConnector; +import com.azure.resourcemanager.databricks.models.AccessConnectorProperties; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentity; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentityType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class AccessConnectorsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"identity\":{\"principalId\":\"64a35e2c-2994-4e63-8b74-7932ebffa657\",\"tenantId\":\"ab9c7717-6585-4711-ba47-88648b69f97a\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{}},\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"quyfx\",\"tags\":{\"ptramxj\":\"l\",\"nwxuqlcvydyp\":\"zwl\",\"niodkooeb\":\"tdooaoj\"},\"id\":\"nuj\",\"name\":\"emmsbvdkc\",\"type\":\"odtji\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + AccessConnector response = + manager + .accessConnectors() + .define("imrzrtuzqog") + .withRegion("wmewzsyy") + .withExistingResourceGroup("yxbaaabjyvayf") + .withTags(mapOf("hzv", "zsoibjudpfrxtr", "qbrqubpaxhexiili", "ytdw")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withProperties(new AccessConnectorProperties()) + .create(); + + Assertions.assertEquals("quyfx", response.location()); + Assertions.assertEquals("l", response.tags().get("ptramxj")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, response.identity().type()); + } + + @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/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsDeleteMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsDeleteMockTests.java new file mode 100644 index 000000000000..62702934f944 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsDeleteMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class AccessConnectorsDeleteMockTests { + @Test + public void testDelete() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.accessConnectors().delete("elpcirelsfeaenwa", "fatkld", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsGetByResourceGroupWithResponseMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..f57517fac40f --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.AccessConnector; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentityType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class AccessConnectorsGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"identity\":{\"principalId\":\"e4e4c164-c3f2-4d3d-8803-68a3058fe6c2\",\"tenantId\":\"5a2065cf-a1ec-4c78-9372-c03f5528d465\",\"type\":\"None\",\"userAssignedIdentities\":{}},\"properties\":{\"provisioningState\":\"Creating\"},\"location\":\"alm\",\"tags\":{\"aygdvwvgpioh\":\"d\",\"udxepxgyqagv\":\"wxrt\",\"wi\":\"vmnpkukghimdblx\"},\"id\":\"fnjhfjxwmszkkfo\",\"name\":\"rey\",\"type\":\"kzikfjawneaivxwc\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + AccessConnector response = + manager + .accessConnectors() + .getByResourceGroupWithResponse("rhyrnxxmueed", "drd", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("alm", response.location()); + Assertions.assertEquals("d", response.tags().get("aygdvwvgpioh")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.identity().type()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListByResourceGroupMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListByResourceGroupMockTests.java new file mode 100644 index 000000000000..c4862cf44d1d --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListByResourceGroupMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.AccessConnector; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentityType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class AccessConnectorsListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"identity\":{\"principalId\":\"f562d775-64dc-4c4c-a30e-8924b99de760\",\"tenantId\":\"8cbc6887-d1d3-4871-9c39-d938fcbecf96\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{}},\"properties\":{\"provisioningState\":\"Canceled\"},\"location\":\"l\",\"tags\":{\"tcs\":\"mjwosytx\",\"zikhl\":\"fcktqumiekke\"},\"id\":\"fjhdg\",\"name\":\"gge\",\"type\":\"dunyg\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.accessConnectors().listByResourceGroup("xbjhwuaanozjosph", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("l", response.iterator().next().location()); + Assertions.assertEquals("mjwosytx", response.iterator().next().tags().get("tcs")); + Assertions + .assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, response.iterator().next().identity().type()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListMockTests.java new file mode 100644 index 000000000000..e714c645f245 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AccessConnectorsListMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.AccessConnector; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentityType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class AccessConnectorsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"identity\":{\"principalId\":\"0b6e54aa-aa52-4836-ac81-01efe6d11758\",\"tenantId\":\"d4b0e95f-10eb-45df-9d18-d4503b2b5f2e\",\"type\":\"None\",\"userAssignedIdentities\":{}},\"properties\":{\"provisioningState\":\"Failed\"},\"location\":\"xllrxcyjm\",\"tags\":{\"arm\":\"su\",\"rw\":\"wdmjsjqbjhhyx\",\"duhpk\":\"yc\",\"hky\":\"kgymareqnajxqug\"},\"id\":\"ubeddg\",\"name\":\"sofwqmzqalkrmnji\",\"type\":\"pxacqqudfn\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.accessConnectors().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("xllrxcyjm", response.iterator().next().location()); + Assertions.assertEquals("su", response.iterator().next().tags().get("arm")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.iterator().next().identity().type()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AddressSpaceTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AddressSpaceTests.java new file mode 100644 index 000000000000..55fcad103e14 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/AddressSpaceTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.AddressSpace; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class AddressSpaceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AddressSpace model = + BinaryData.fromString("{\"addressPrefixes\":[\"kevle\",\"gz\"]}").toObject(AddressSpace.class); + Assertions.assertEquals("kevle", model.addressPrefixes().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AddressSpace model = new AddressSpace().withAddressPrefixes(Arrays.asList("kevle", "gz")); + model = BinaryData.fromObject(model).toObject(AddressSpace.class); + Assertions.assertEquals("kevle", model.addressPrefixes().get(0)); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/CreatedByTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/CreatedByTests.java new file mode 100644 index 000000000000..13685784710d --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/CreatedByTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.CreatedBy; + +public final class CreatedByTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CreatedBy model = + BinaryData + .fromString( + "{\"oid\":\"d98edc34-6ad1-4d2d-9641-917b45563bda\",\"puid\":\"ldhugjzzdatqxh\",\"applicationId\":\"c0c78437-4350-418a-9905-82050a57b994\"}") + .toObject(CreatedBy.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CreatedBy model = new CreatedBy(); + model = BinaryData.fromObject(model).toObject(CreatedBy.class); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/EndpointDependencyTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/EndpointDependencyTests.java new file mode 100644 index 000000000000..6194cb39d4dd --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/EndpointDependencyTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.EndpointDependency; +import com.azure.resourcemanager.databricks.models.EndpointDetail; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EndpointDependencyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EndpointDependency model = + BinaryData + .fromString( + "{\"domainName\":\"xyqj\",\"endpointDetails\":[{\"ipAddress\":\"t\",\"port\":738552235,\"latency\":89.54885021656311,\"isAccessible\":false},{\"ipAddress\":\"zsqpjhvmdajvny\",\"port\":340667292,\"latency\":0.19355568935980338,\"isAccessible\":false},{\"ipAddress\":\"oaeupfhyhltrpmo\",\"port\":1593902435,\"latency\":34.71437790880483,\"isAccessible\":false},{\"ipAddress\":\"kthfui\",\"port\":1958511129,\"latency\":82.85533213384883,\"isAccessible\":false}]}") + .toObject(EndpointDependency.class); + Assertions.assertEquals("xyqj", model.domainName()); + Assertions.assertEquals("t", model.endpointDetails().get(0).ipAddress()); + Assertions.assertEquals(738552235, model.endpointDetails().get(0).port()); + Assertions.assertEquals(89.54885021656311D, model.endpointDetails().get(0).latency()); + Assertions.assertEquals(false, model.endpointDetails().get(0).isAccessible()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EndpointDependency model = + new EndpointDependency() + .withDomainName("xyqj") + .withEndpointDetails( + Arrays + .asList( + new EndpointDetail() + .withIpAddress("t") + .withPort(738552235) + .withLatency(89.54885021656311D) + .withIsAccessible(false), + new EndpointDetail() + .withIpAddress("zsqpjhvmdajvny") + .withPort(340667292) + .withLatency(0.19355568935980338D) + .withIsAccessible(false), + new EndpointDetail() + .withIpAddress("oaeupfhyhltrpmo") + .withPort(1593902435) + .withLatency(34.71437790880483D) + .withIsAccessible(false), + new EndpointDetail() + .withIpAddress("kthfui") + .withPort(1958511129) + .withLatency(82.85533213384883D) + .withIsAccessible(false))); + model = BinaryData.fromObject(model).toObject(EndpointDependency.class); + Assertions.assertEquals("xyqj", model.domainName()); + Assertions.assertEquals("t", model.endpointDetails().get(0).ipAddress()); + Assertions.assertEquals(738552235, model.endpointDetails().get(0).port()); + Assertions.assertEquals(89.54885021656311D, model.endpointDetails().get(0).latency()); + Assertions.assertEquals(false, model.endpointDetails().get(0).isAccessible()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/EndpointDetailTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/EndpointDetailTests.java new file mode 100644 index 000000000000..77077d8603ac --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/EndpointDetailTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.EndpointDetail; +import org.junit.jupiter.api.Assertions; + +public final class EndpointDetailTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EndpointDetail model = + BinaryData + .fromString( + "{\"ipAddress\":\"vxodpu\",\"port\":1447641859,\"latency\":97.60419370044511,\"isAccessible\":true}") + .toObject(EndpointDetail.class); + Assertions.assertEquals("vxodpu", model.ipAddress()); + Assertions.assertEquals(1447641859, model.port()); + Assertions.assertEquals(97.60419370044511D, model.latency()); + Assertions.assertEquals(true, model.isAccessible()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EndpointDetail model = + new EndpointDetail() + .withIpAddress("vxodpu") + .withPort(1447641859) + .withLatency(97.60419370044511D) + .withIsAccessible(true); + model = BinaryData.fromObject(model).toObject(EndpointDetail.class); + Assertions.assertEquals("vxodpu", model.ipAddress()); + Assertions.assertEquals(1447641859, model.port()); + Assertions.assertEquals(97.60419370044511D, model.latency()); + Assertions.assertEquals(true, model.isAccessible()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/ErrorInfoTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/ErrorInfoTests.java new file mode 100644 index 000000000000..913589b9f431 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/ErrorInfoTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.ErrorInfo; + +public final class ErrorInfoTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ErrorInfo model = BinaryData.fromString("{\"innererror\":\"vfqawrlyxwjkcpr\"}").toObject(ErrorInfo.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ErrorInfo model = new ErrorInfo(); + model = BinaryData.fromObject(model).toObject(ErrorInfo.class); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/GroupIdInformationInnerTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/GroupIdInformationInnerTests.java new file mode 100644 index 000000000000..ce112efbe1c4 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/GroupIdInformationInnerTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.databricks.models.GroupIdInformationProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class GroupIdInformationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GroupIdInformationInner model = + BinaryData + .fromString( + "{\"properties\":{\"groupId\":\"gtzxdpn\",\"requiredMembers\":[\"qwxrjfeallnw\"],\"requiredZoneNames\":[\"isnjampmngnz\",\"c\"]},\"id\":\"aqw\",\"name\":\"ochcbonqvpkvl\",\"type\":\"xnj\"}") + .toObject(GroupIdInformationInner.class); + Assertions.assertEquals("gtzxdpn", model.properties().groupId()); + Assertions.assertEquals("qwxrjfeallnw", model.properties().requiredMembers().get(0)); + Assertions.assertEquals("isnjampmngnz", model.properties().requiredZoneNames().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GroupIdInformationInner model = + new GroupIdInformationInner() + .withProperties( + new GroupIdInformationProperties() + .withGroupId("gtzxdpn") + .withRequiredMembers(Arrays.asList("qwxrjfeallnw")) + .withRequiredZoneNames(Arrays.asList("isnjampmngnz", "c"))); + model = BinaryData.fromObject(model).toObject(GroupIdInformationInner.class); + Assertions.assertEquals("gtzxdpn", model.properties().groupId()); + Assertions.assertEquals("qwxrjfeallnw", model.properties().requiredMembers().get(0)); + Assertions.assertEquals("isnjampmngnz", model.properties().requiredZoneNames().get(0)); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/GroupIdInformationPropertiesTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/GroupIdInformationPropertiesTests.java new file mode 100644 index 000000000000..19198a07c752 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/GroupIdInformationPropertiesTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.GroupIdInformationProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class GroupIdInformationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GroupIdInformationProperties model = + BinaryData + .fromString( + "{\"groupId\":\"seiphe\",\"requiredMembers\":[\"okeyyienj\",\"dlwtgrhpdj\"],\"requiredZoneNames\":[\"masxazjpqyegu\",\"lhbxxhejjzzvdud\",\"wdslfhotwmcy\"]}") + .toObject(GroupIdInformationProperties.class); + Assertions.assertEquals("seiphe", model.groupId()); + Assertions.assertEquals("okeyyienj", model.requiredMembers().get(0)); + Assertions.assertEquals("masxazjpqyegu", model.requiredZoneNames().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GroupIdInformationProperties model = + new GroupIdInformationProperties() + .withGroupId("seiphe") + .withRequiredMembers(Arrays.asList("okeyyienj", "dlwtgrhpdj")) + .withRequiredZoneNames(Arrays.asList("masxazjpqyegu", "lhbxxhejjzzvdud", "wdslfhotwmcy")); + model = BinaryData.fromObject(model).toObject(GroupIdInformationProperties.class); + Assertions.assertEquals("seiphe", model.groupId()); + Assertions.assertEquals("okeyyienj", model.requiredMembers().get(0)); + Assertions.assertEquals("masxazjpqyegu", model.requiredZoneNames().get(0)); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/ManagedIdentityConfigurationTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/ManagedIdentityConfigurationTests.java new file mode 100644 index 000000000000..b9a63bfa5d31 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/ManagedIdentityConfigurationTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.ManagedIdentityConfiguration; + +public final class ManagedIdentityConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedIdentityConfiguration model = + BinaryData + .fromString( + "{\"principalId\":\"cd54fb4b-3070-47cb-acc9-e7afb33f8dd5\",\"tenantId\":\"6fb3425d-6960-4eed-ae98-9704248d7083\",\"type\":\"ablgphuticndvk\"}") + .toObject(ManagedIdentityConfiguration.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedIdentityConfiguration model = new ManagedIdentityConfiguration(); + model = BinaryData.fromObject(model).toObject(ManagedIdentityConfiguration.class); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/ManagedServiceIdentityTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/ManagedServiceIdentityTests.java new file mode 100644 index 000000000000..3a89f09d83dd --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentity; +import com.azure.resourcemanager.databricks.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.databricks.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = + BinaryData + .fromString( + "{\"principalId\":\"df9de276-bc35-4f4b-adfa-29024408ba4e\",\"tenantId\":\"6f28171b-d601-46f5-8279-d01f67385894\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"uctqhjfbe\":{\"principalId\":\"ec477f0d-1fbe-48e2-8f24-0caa774edaf4\",\"clientId\":\"b2c541da-473e-49c0-a98f-e4b53201a846\"},\"cxerf\":{\"principalId\":\"d88a34b8-a22a-464b-b4d7-cb3e9672d7c8\",\"clientId\":\"7bfd5676-94e4-454c-997e-f812deae3ae6\"},\"tttxfvjrb\":{\"principalId\":\"b304f0c9-0cd3-4b1b-baf3-0615a0101f84\",\"clientId\":\"9ee8a22a-cb0b-45c6-9d6c-93553ac5b16e\"},\"hxepcyvahfnlj\":{\"principalId\":\"87556d43-cec0-4efa-8e5a-41d01c56d224\",\"clientId\":\"04020914-c081-4845-a976-1767db4cbd11\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model = + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "uctqhjfbe", + new UserAssignedIdentity(), + "cxerf", + new UserAssignedIdentity(), + "tttxfvjrb", + new UserAssignedIdentity(), + "hxepcyvahfnlj", + new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + @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/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationDisplayTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..1fc7f37fae6b --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationDisplayTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.OperationDisplay; +import org.junit.jupiter.api.Assertions; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = + BinaryData + .fromString( + "{\"provider\":\"fgugnxkrxdqmid\",\"resource\":\"hzrvqd\",\"operation\":\"bhj\",\"description\":\"igeho\"}") + .toObject(OperationDisplay.class); + Assertions.assertEquals("fgugnxkrxdqmid", model.provider()); + Assertions.assertEquals("hzrvqd", model.resource()); + Assertions.assertEquals("bhj", model.operation()); + Assertions.assertEquals("igeho", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationDisplay model = + new OperationDisplay() + .withProvider("fgugnxkrxdqmid") + .withResource("hzrvqd") + .withOperation("bhj") + .withDescription("igeho"); + model = BinaryData.fromObject(model).toObject(OperationDisplay.class); + Assertions.assertEquals("fgugnxkrxdqmid", model.provider()); + Assertions.assertEquals("hzrvqd", model.resource()); + Assertions.assertEquals("bhj", model.operation()); + Assertions.assertEquals("igeho", model.description()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationInnerTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationInnerTests.java new file mode 100644 index 000000000000..0662c3f7fd71 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationInnerTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.OperationInner; +import com.azure.resourcemanager.databricks.models.OperationDisplay; +import org.junit.jupiter.api.Assertions; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = + BinaryData + .fromString( + "{\"name\":\"iwqvhkh\",\"display\":{\"provider\":\"igdtopbob\",\"resource\":\"ghmewuam\",\"operation\":\"hrzayvvtpgvdf\",\"description\":\"otkftutqxlngx\"}}") + .toObject(OperationInner.class); + Assertions.assertEquals("iwqvhkh", model.name()); + Assertions.assertEquals("igdtopbob", model.display().provider()); + Assertions.assertEquals("ghmewuam", model.display().resource()); + Assertions.assertEquals("hrzayvvtpgvdf", model.display().operation()); + Assertions.assertEquals("otkftutqxlngx", model.display().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationInner model = + new OperationInner() + .withName("iwqvhkh") + .withDisplay( + new OperationDisplay() + .withProvider("igdtopbob") + .withResource("ghmewuam") + .withOperation("hrzayvvtpgvdf") + .withDescription("otkftutqxlngx")); + model = BinaryData.fromObject(model).toObject(OperationInner.class); + Assertions.assertEquals("iwqvhkh", model.name()); + Assertions.assertEquals("igdtopbob", model.display().provider()); + Assertions.assertEquals("ghmewuam", model.display().resource()); + Assertions.assertEquals("hrzayvvtpgvdf", model.display().operation()); + Assertions.assertEquals("otkftutqxlngx", model.display().description()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationListResultTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationListResultTests.java new file mode 100644 index 000000000000..bcf65ef66748 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationListResultTests.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.OperationInner; +import com.azure.resourcemanager.databricks.models.OperationDisplay; +import com.azure.resourcemanager.databricks.models.OperationListResult; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = + BinaryData + .fromString( + "{\"value\":[{\"name\":\"kexxppof\",\"display\":{\"provider\":\"x\",\"resource\":\"jpgd\",\"operation\":\"ocjjxhvpmouexh\",\"description\":\"xibqeojnx\"}},{\"name\":\"zvddntwndeicbtwn\",\"display\":{\"provider\":\"oqvuhr\",\"resource\":\"f\",\"operation\":\"yd\",\"description\":\"lmjthjq\"}}],\"nextLink\":\"pyeicxm\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("kexxppof", model.value().get(0).name()); + Assertions.assertEquals("x", model.value().get(0).display().provider()); + Assertions.assertEquals("jpgd", model.value().get(0).display().resource()); + Assertions.assertEquals("ocjjxhvpmouexh", model.value().get(0).display().operation()); + Assertions.assertEquals("xibqeojnx", model.value().get(0).display().description()); + Assertions.assertEquals("pyeicxm", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationListResult model = + new OperationListResult() + .withValue( + Arrays + .asList( + new OperationInner() + .withName("kexxppof") + .withDisplay( + new OperationDisplay() + .withProvider("x") + .withResource("jpgd") + .withOperation("ocjjxhvpmouexh") + .withDescription("xibqeojnx")), + new OperationInner() + .withName("zvddntwndeicbtwn") + .withDisplay( + new OperationDisplay() + .withProvider("oqvuhr") + .withResource("f") + .withOperation("yd") + .withDescription("lmjthjq")))) + .withNextLink("pyeicxm"); + model = BinaryData.fromObject(model).toObject(OperationListResult.class); + Assertions.assertEquals("kexxppof", model.value().get(0).name()); + Assertions.assertEquals("x", model.value().get(0).display().provider()); + Assertions.assertEquals("jpgd", model.value().get(0).display().resource()); + Assertions.assertEquals("ocjjxhvpmouexh", model.value().get(0).display().operation()); + Assertions.assertEquals("xibqeojnx", model.value().get(0).display().description()); + Assertions.assertEquals("pyeicxm", model.nextLink()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationsListMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..84804d7d909f --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OperationsListMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.Operation; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"name\":\"aruoujmkcjhwqyt\",\"display\":{\"provider\":\"bnw\",\"resource\":\"wgdrjervnaenqp\",\"operation\":\"indoygmifthnzd\",\"description\":\"sl\"}}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("aruoujmkcjhwqyt", response.iterator().next().name()); + Assertions.assertEquals("bnw", response.iterator().next().display().provider()); + Assertions.assertEquals("wgdrjervnaenqp", response.iterator().next().display().resource()); + Assertions.assertEquals("indoygmifthnzd", response.iterator().next().display().operation()); + Assertions.assertEquals("sl", response.iterator().next().display().description()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OutboundEnvironmentEndpointInnerTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OutboundEnvironmentEndpointInnerTests.java new file mode 100644 index 000000000000..cb19de74c246 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OutboundEnvironmentEndpointInnerTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.OutboundEnvironmentEndpointInner; +import com.azure.resourcemanager.databricks.models.EndpointDependency; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OutboundEnvironmentEndpointInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OutboundEnvironmentEndpointInner model = + BinaryData + .fromString( + "{\"category\":\"vdcsitynn\",\"endpoints\":[{\"domainName\":\"ectehf\",\"endpointDetails\":[]},{\"domainName\":\"jeyp\",\"endpointDetails\":[]},{\"domainName\":\"rkgqhcjrefo\",\"endpointDetails\":[]},{\"domainName\":\"qsl\",\"endpointDetails\":[]}]}") + .toObject(OutboundEnvironmentEndpointInner.class); + Assertions.assertEquals("vdcsitynn", model.category()); + Assertions.assertEquals("ectehf", model.endpoints().get(0).domainName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OutboundEnvironmentEndpointInner model = + new OutboundEnvironmentEndpointInner() + .withCategory("vdcsitynn") + .withEndpoints( + Arrays + .asList( + new EndpointDependency().withDomainName("ectehf").withEndpointDetails(Arrays.asList()), + new EndpointDependency().withDomainName("jeyp").withEndpointDetails(Arrays.asList()), + new EndpointDependency().withDomainName("rkgqhcjrefo").withEndpointDetails(Arrays.asList()), + new EndpointDependency().withDomainName("qsl").withEndpointDetails(Arrays.asList()))); + model = BinaryData.fromObject(model).toObject(OutboundEnvironmentEndpointInner.class); + Assertions.assertEquals("vdcsitynn", model.category()); + Assertions.assertEquals("ectehf", model.endpoints().get(0).domainName()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OutboundNetworkDependenciesEndpointsListWithResponseMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OutboundNetworkDependenciesEndpointsListWithResponseMockTests.java new file mode 100644 index 000000000000..5ef97aeedd76 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/OutboundNetworkDependenciesEndpointsListWithResponseMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.OutboundEnvironmentEndpoint; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OutboundNetworkDependenciesEndpointsListWithResponseMockTests { + @Test + public void testListWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "[{\"category\":\"ibahwflus\",\"endpoints\":[{\"domainName\":\"hrkwo\",\"endpointDetails\":[]},{\"domainName\":\"voqacpiexpbt\",\"endpointDetails\":[]},{\"domainName\":\"bwoenwashrt\",\"endpointDetails\":[]},{\"domainName\":\"cnqxwbpokulpi\",\"endpointDetails\":[]}]}]"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + List response = + manager + .outboundNetworkDependenciesEndpoints() + .listWithResponse("i", "m", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("ibahwflus", response.get(0).category()); + Assertions.assertEquals("hrkwo", response.get(0).endpoints().get(0).domainName()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionInnerTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionInnerTests.java new file mode 100644 index 000000000000..e89f36869559 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionInnerTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.databricks.models.PrivateEndpoint; +import com.azure.resourcemanager.databricks.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.databricks.models.PrivateLinkServiceConnectionState; +import com.azure.resourcemanager.databricks.models.PrivateLinkServiceConnectionStatus; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointConnectionInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointConnectionInner model = + BinaryData + .fromString( + "{\"properties\":{\"privateEndpoint\":{\"id\":\"w\"},\"groupIds\":[\"ryplwckbasyypn\",\"dhsgcba\",\"phejkotynqgoulz\",\"dlikwyqkgfgibma\"],\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"keqsrxybzqqedq\",\"actionsRequired\":\"bciqfouflm\"},\"provisioningState\":\"Deleting\"},\"id\":\"zsm\",\"name\":\"dmgloug\",\"type\":\"b\"}") + .toObject(PrivateEndpointConnectionInner.class); + Assertions.assertEquals("ryplwckbasyypn", model.properties().groupIds().get(0)); + Assertions + .assertEquals( + PrivateLinkServiceConnectionStatus.APPROVED, + model.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("keqsrxybzqqedq", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("bciqfouflm", model.properties().privateLinkServiceConnectionState().actionsRequired()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpointConnectionInner model = + new PrivateEndpointConnectionInner() + .withProperties( + new PrivateEndpointConnectionProperties() + .withPrivateEndpoint(new PrivateEndpoint()) + .withGroupIds(Arrays.asList("ryplwckbasyypn", "dhsgcba", "phejkotynqgoulz", "dlikwyqkgfgibma")) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateLinkServiceConnectionStatus.APPROVED) + .withDescription("keqsrxybzqqedq") + .withActionsRequired("bciqfouflm"))); + model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionInner.class); + Assertions.assertEquals("ryplwckbasyypn", model.properties().groupIds().get(0)); + Assertions + .assertEquals( + PrivateLinkServiceConnectionStatus.APPROVED, + model.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("keqsrxybzqqedq", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("bciqfouflm", model.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionPropertiesTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionPropertiesTests.java new file mode 100644 index 000000000000..8dc7e9ae4474 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionPropertiesTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.PrivateEndpoint; +import com.azure.resourcemanager.databricks.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.databricks.models.PrivateLinkServiceConnectionState; +import com.azure.resourcemanager.databricks.models.PrivateLinkServiceConnectionStatus; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointConnectionPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointConnectionProperties model = + BinaryData + .fromString( + "{\"privateEndpoint\":{\"id\":\"mutduqktaps\"},\"groupIds\":[\"cuertu\"],\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"o\",\"actionsRequired\":\"qw\"},\"provisioningState\":\"Succeeded\"}") + .toObject(PrivateEndpointConnectionProperties.class); + Assertions.assertEquals("cuertu", model.groupIds().get(0)); + Assertions + .assertEquals( + PrivateLinkServiceConnectionStatus.APPROVED, model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("o", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("qw", model.privateLinkServiceConnectionState().actionsRequired()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpointConnectionProperties model = + new PrivateEndpointConnectionProperties() + .withPrivateEndpoint(new PrivateEndpoint()) + .withGroupIds(Arrays.asList("cuertu")) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateLinkServiceConnectionStatus.APPROVED) + .withDescription("o") + .withActionsRequired("qw")); + model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionProperties.class); + Assertions.assertEquals("cuertu", model.groupIds().get(0)); + Assertions + .assertEquals( + PrivateLinkServiceConnectionStatus.APPROVED, model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("o", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("qw", model.privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsCreateMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsCreateMockTests.java new file mode 100644 index 000000000000..17378ec64933 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsCreateMockTests.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.PrivateEndpoint; +import com.azure.resourcemanager.databricks.models.PrivateEndpointConnection; +import com.azure.resourcemanager.databricks.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.databricks.models.PrivateLinkServiceConnectionState; +import com.azure.resourcemanager.databricks.models.PrivateLinkServiceConnectionStatus; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PrivateEndpointConnectionsCreateMockTests { + @Test + public void testCreate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"privateEndpoint\":{\"id\":\"xvy\"},\"groupIds\":[\"gkopkwhojvpajqgx\"],\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"ocmbqfqvmkcxoza\",\"actionsRequired\":\"helxprglya\"},\"provisioningState\":\"Succeeded\"},\"id\":\"ckcb\",\"name\":\"uejrjxgc\",\"type\":\"qibrhosxsdqrhzoy\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PrivateEndpointConnection response = + manager + .privateEndpointConnections() + .define("qsluicp") + .withExistingWorkspace("mgxcxrslpm", "twuoegrpkhjwni") + .withProperties( + new PrivateEndpointConnectionProperties() + .withPrivateEndpoint(new PrivateEndpoint()) + .withGroupIds(Arrays.asList("fy")) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateLinkServiceConnectionStatus.REJECTED) + .withDescription("pfvmwyhrfou") + .withActionsRequired("taakc"))) + .create(); + + Assertions.assertEquals("gkopkwhojvpajqgx", response.properties().groupIds().get(0)); + Assertions + .assertEquals( + PrivateLinkServiceConnectionStatus.APPROVED, + response.properties().privateLinkServiceConnectionState().status()); + Assertions + .assertEquals("ocmbqfqvmkcxoza", response.properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals("helxprglya", response.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsDeleteMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsDeleteMockTests.java new file mode 100644 index 000000000000..d2e3aa7b8249 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsDeleteMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PrivateEndpointConnectionsDeleteMockTests { + @Test + public void testDelete() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.privateEndpointConnections().delete("sotbob", "dopcjwvnh", "ld", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java new file mode 100644 index 000000000000..4a061532851f --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.PrivateEndpointConnection; +import com.azure.resourcemanager.databricks.models.PrivateLinkServiceConnectionStatus; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PrivateEndpointConnectionsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"privateEndpoint\":{\"id\":\"acffgdkzzewkfvhq\"},\"groupIds\":[\"ilvpnppfuflrwd\"],\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"lxyjr\",\"actionsRequired\":\"agafcnihgwqap\"},\"provisioningState\":\"Failed\"},\"id\":\"gfbcvkcv\",\"name\":\"vpk\",\"type\":\"qdcvdrhvoo\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PrivateEndpointConnection response = + manager + .privateEndpointConnections() + .getWithResponse("zonosgg", "hcohfwdsjnk", "ljuti", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("ilvpnppfuflrwd", response.properties().groupIds().get(0)); + Assertions + .assertEquals( + PrivateLinkServiceConnectionStatus.DISCONNECTED, + response.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("lxyjr", response.properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals("agafcnihgwqap", response.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsListMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsListMockTests.java new file mode 100644 index 000000000000..291326322476 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsListMockTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.PrivateEndpointConnection; +import com.azure.resourcemanager.databricks.models.PrivateLinkServiceConnectionStatus; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PrivateEndpointConnectionsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"privateEndpoint\":{\"id\":\"bqtkoievseotgqr\"},\"groupIds\":[\"muwlauwzizxbm\",\"gcj\",\"fuzmuvpbtt\"],\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"orppxebmnzbtb\",\"actionsRequired\":\"pglkf\"},\"provisioningState\":\"Updating\"},\"id\":\"dneu\",\"name\":\"lfphsdyhtozfikd\",\"type\":\"wwquuvxzxclvithh\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.privateEndpointConnections().list("uriplbpodxunkb", "bxmubyynt", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("muwlauwzizxbm", response.iterator().next().properties().groupIds().get(0)); + Assertions + .assertEquals( + PrivateLinkServiceConnectionStatus.PENDING, + response.iterator().next().properties().privateLinkServiceConnectionState().status()); + Assertions + .assertEquals( + "orppxebmnzbtb", + response.iterator().next().properties().privateLinkServiceConnectionState().description()); + Assertions + .assertEquals( + "pglkf", response.iterator().next().properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsListTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsListTests.java new file mode 100644 index 000000000000..b600062a1f78 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointConnectionsListTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.databricks.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.databricks.models.PrivateEndpointConnectionsList; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointConnectionsListTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointConnectionsList model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Updating\"},\"id\":\"pgacftadehxnlty\",\"name\":\"sop\",\"type\":\"usue\"},{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Updating\"},\"id\":\"ej\",\"name\":\"avo\",\"type\":\"xzdmohctb\"},{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Deleting\"},\"id\":\"xdn\",\"name\":\"nvowgujju\",\"type\":\"wdkcglhsl\"},{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Succeeded\"},\"id\":\"ggd\",\"name\":\"jixhbk\",\"type\":\"ofqweykhmenevfye\"}],\"nextLink\":\"whybcib\"}") + .toObject(PrivateEndpointConnectionsList.class); + Assertions.assertEquals("whybcib", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpointConnectionsList model = + new PrivateEndpointConnectionsList() + .withValue( + Arrays + .asList( + new PrivateEndpointConnectionInner() + .withProperties( + new PrivateEndpointConnectionProperties().withGroupIds(Arrays.asList())), + new PrivateEndpointConnectionInner() + .withProperties( + new PrivateEndpointConnectionProperties().withGroupIds(Arrays.asList())), + new PrivateEndpointConnectionInner() + .withProperties( + new PrivateEndpointConnectionProperties().withGroupIds(Arrays.asList())), + new PrivateEndpointConnectionInner() + .withProperties( + new PrivateEndpointConnectionProperties().withGroupIds(Arrays.asList())))) + .withNextLink("whybcib"); + model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionsList.class); + Assertions.assertEquals("whybcib", model.nextLink()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointTests.java new file mode 100644 index 000000000000..ad2e3ee6f8be --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateEndpointTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.PrivateEndpoint; + +public final class PrivateEndpointTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpoint model = BinaryData.fromString("{\"id\":\"gbbjfddgmbmbe\"}").toObject(PrivateEndpoint.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpoint model = new PrivateEndpoint(); + model = BinaryData.fromObject(model).toObject(PrivateEndpoint.class); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkResourcesGetWithResponseMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkResourcesGetWithResponseMockTests.java new file mode 100644 index 000000000000..daa43167ba49 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkResourcesGetWithResponseMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.GroupIdInformation; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PrivateLinkResourcesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"groupId\":\"hszhedplvwiwu\",\"requiredMembers\":[\"mbes\",\"dnkwwtppjflcxog\",\"okonzmnsikvmkqz\"],\"requiredZoneNames\":[\"kdltfzxmhhvhg\",\"r\"]},\"id\":\"odkwobd\",\"name\":\"gxtibqdxbxw\",\"type\":\"kbogqxndlkzgx\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + GroupIdInformation response = + manager + .privateLinkResources() + .getWithResponse("fiwjmygtdssls", "tmweriofzpyq", "emwabnet", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("hszhedplvwiwu", response.properties().groupId()); + Assertions.assertEquals("mbes", response.properties().requiredMembers().get(0)); + Assertions.assertEquals("kdltfzxmhhvhg", response.properties().requiredZoneNames().get(0)); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkResourcesListMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkResourcesListMockTests.java new file mode 100644 index 000000000000..bd766f9fc6ea --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkResourcesListMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.GroupIdInformation; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PrivateLinkResourcesListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"groupId\":\"qlkth\",\"requiredMembers\":[\"qolbgyc\",\"uie\",\"tgccymvaolpss\",\"qlfmmdnbb\"],\"requiredZoneNames\":[\"pswiydmcwyh\",\"dxssadbzm\",\"vdfznudaodvxzb\"]},\"id\":\"cblylpstdbhhxsr\",\"name\":\"dzu\",\"type\":\"erscdntne\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.privateLinkResources().list("nayqi", "ynduha", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qlkth", response.iterator().next().properties().groupId()); + Assertions.assertEquals("qolbgyc", response.iterator().next().properties().requiredMembers().get(0)); + Assertions.assertEquals("pswiydmcwyh", response.iterator().next().properties().requiredZoneNames().get(0)); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkResourcesListTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkResourcesListTests.java new file mode 100644 index 000000000000..29b8d3ec7c89 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkResourcesListTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.GroupIdInformationInner; +import com.azure.resourcemanager.databricks.models.GroupIdInformationProperties; +import com.azure.resourcemanager.databricks.models.PrivateLinkResourcesList; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class PrivateLinkResourcesListTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkResourcesList model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"groupId\":\"wska\",\"requiredMembers\":[],\"requiredZoneNames\":[]},\"id\":\"tzlcuiywgqywgn\",\"name\":\"rvynhzgpph\",\"type\":\"cgyncocpecf\"},{\"properties\":{\"groupId\":\"mcoo\",\"requiredMembers\":[],\"requiredZoneNames\":[]},\"id\":\"lzevgbmqjqab\",\"name\":\"y\",\"type\":\"mivkwlzuvcc\"}],\"nextLink\":\"nfnbacfionlebxe\"}") + .toObject(PrivateLinkResourcesList.class); + Assertions.assertEquals("wska", model.value().get(0).properties().groupId()); + Assertions.assertEquals("nfnbacfionlebxe", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkResourcesList model = + new PrivateLinkResourcesList() + .withValue( + Arrays + .asList( + new GroupIdInformationInner() + .withProperties( + new GroupIdInformationProperties() + .withGroupId("wska") + .withRequiredMembers(Arrays.asList()) + .withRequiredZoneNames(Arrays.asList())), + new GroupIdInformationInner() + .withProperties( + new GroupIdInformationProperties() + .withGroupId("mcoo") + .withRequiredMembers(Arrays.asList()) + .withRequiredZoneNames(Arrays.asList())))) + .withNextLink("nfnbacfionlebxe"); + model = BinaryData.fromObject(model).toObject(PrivateLinkResourcesList.class); + Assertions.assertEquals("wska", model.value().get(0).properties().groupId()); + Assertions.assertEquals("nfnbacfionlebxe", model.nextLink()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkServiceConnectionStateTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkServiceConnectionStateTests.java new file mode 100644 index 000000000000..4f78df405801 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/PrivateLinkServiceConnectionStateTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.PrivateLinkServiceConnectionState; +import com.azure.resourcemanager.databricks.models.PrivateLinkServiceConnectionStatus; +import org.junit.jupiter.api.Assertions; + +public final class PrivateLinkServiceConnectionStateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkServiceConnectionState model = + BinaryData + .fromString( + "{\"status\":\"Rejected\",\"description\":\"bhtqqrolfpfpsa\",\"actionsRequired\":\"bquxigjy\"}") + .toObject(PrivateLinkServiceConnectionState.class); + Assertions.assertEquals(PrivateLinkServiceConnectionStatus.REJECTED, model.status()); + Assertions.assertEquals("bhtqqrolfpfpsa", model.description()); + Assertions.assertEquals("bquxigjy", model.actionsRequired()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkServiceConnectionState model = + new PrivateLinkServiceConnectionState() + .withStatus(PrivateLinkServiceConnectionStatus.REJECTED) + .withDescription("bhtqqrolfpfpsa") + .withActionsRequired("bquxigjy"); + model = BinaryData.fromObject(model).toObject(PrivateLinkServiceConnectionState.class); + Assertions.assertEquals(PrivateLinkServiceConnectionStatus.REJECTED, model.status()); + Assertions.assertEquals("bhtqqrolfpfpsa", model.description()); + Assertions.assertEquals("bquxigjy", model.actionsRequired()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/SkuTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/SkuTests.java new file mode 100644 index 000000000000..8e4120d328b8 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/SkuTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.Sku; +import org.junit.jupiter.api.Assertions; + +public final class SkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Sku model = BinaryData.fromString("{\"name\":\"gzjaoyfhrtxilne\",\"tier\":\"ujysvle\"}").toObject(Sku.class); + Assertions.assertEquals("gzjaoyfhrtxilne", model.name()); + Assertions.assertEquals("ujysvle", model.tier()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Sku model = new Sku().withName("gzjaoyfhrtxilne").withTier("ujysvle"); + model = BinaryData.fromObject(model).toObject(Sku.class); + Assertions.assertEquals("gzjaoyfhrtxilne", model.name()); + Assertions.assertEquals("ujysvle", model.tier()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/UserAssignedIdentityTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/UserAssignedIdentityTests.java new file mode 100644 index 000000000000..86395503b135 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/UserAssignedIdentityTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model = + BinaryData + .fromString( + "{\"principalId\":\"17fb418c-c62c-4db8-92c6-b5b0d9a2992f\",\"clientId\":\"d17d7149-360f-434e-b652-83e0e70795fe\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsCreateOrUpdateMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..8fa3d97ec17a --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsCreateOrUpdateMockTests.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.AddressSpace; +import com.azure.resourcemanager.databricks.models.VirtualNetworkPeering; +import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork; +import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class VNetPeeringsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"allowVirtualNetworkAccess\":false,\"allowForwardedTraffic\":true,\"allowGatewayTransit\":true,\"useRemoteGateways\":true,\"databricksVirtualNetwork\":{\"id\":\"tbnnha\"},\"databricksAddressSpace\":{\"addressPrefixes\":[]},\"remoteVirtualNetwork\":{\"id\":\"rkvcikhnvpa\"},\"remoteAddressSpace\":{\"addressPrefixes\":[]},\"peeringState\":\"Disconnected\",\"provisioningState\":\"Succeeded\"},\"id\":\"ezikywggxkal\",\"name\":\"atmelwui\",\"type\":\"iccjzkzivgvvcna\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + VirtualNetworkPeering response = + manager + .vNetPeerings() + .define("ysuiizynkedya") + .withExistingWorkspace("yzrpzbchckqqzq", "ox") + .withRemoteVirtualNetwork( + new VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork().withId("yynpcdpumnzgmwz")) + .withAllowVirtualNetworkAccess(true) + .withAllowForwardedTraffic(true) + .withAllowGatewayTransit(true) + .withUseRemoteGateways(false) + .withDatabricksVirtualNetwork( + new VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork().withId("hwit")) + .withDatabricksAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList())) + .withRemoteAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList())) + .create(); + + Assertions.assertEquals(false, response.allowVirtualNetworkAccess()); + Assertions.assertEquals(true, response.allowForwardedTraffic()); + Assertions.assertEquals(true, response.allowGatewayTransit()); + Assertions.assertEquals(true, response.useRemoteGateways()); + Assertions.assertEquals("tbnnha", response.databricksVirtualNetwork().id()); + Assertions.assertEquals("rkvcikhnvpa", response.remoteVirtualNetwork().id()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsDeleteMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsDeleteMockTests.java new file mode 100644 index 000000000000..1417c2d76fb2 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsDeleteMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class VNetPeeringsDeleteMockTests { + @Test + public void testDelete() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.vNetPeerings().delete("reqnovvqfov", "jxywsuws", "rsndsytgadgvra", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsGetWithResponseMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsGetWithResponseMockTests.java new file mode 100644 index 000000000000..4479f5cb8eb7 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsGetWithResponseMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.VirtualNetworkPeering; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class VNetPeeringsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"allowVirtualNetworkAccess\":false,\"allowForwardedTraffic\":true,\"allowGatewayTransit\":true,\"useRemoteGateways\":true,\"databricksVirtualNetwork\":{\"id\":\"iuqgbdbutauv\"},\"databricksAddressSpace\":{\"addressPrefixes\":[]},\"remoteVirtualNetwork\":{\"id\":\"uwhhmhykojoxafn\"},\"remoteAddressSpace\":{\"addressPrefixes\":[]},\"peeringState\":\"Disconnected\",\"provisioningState\":\"Deleting\"},\"id\":\"koymkcd\",\"name\":\"h\",\"type\":\"pkkpw\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + VirtualNetworkPeering response = + manager.vNetPeerings().getWithResponse("waasip", "i", "obyu", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals(false, response.allowVirtualNetworkAccess()); + Assertions.assertEquals(true, response.allowForwardedTraffic()); + Assertions.assertEquals(true, response.allowGatewayTransit()); + Assertions.assertEquals(true, response.useRemoteGateways()); + Assertions.assertEquals("iuqgbdbutauv", response.databricksVirtualNetwork().id()); + Assertions.assertEquals("uwhhmhykojoxafn", response.remoteVirtualNetwork().id()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsListByWorkspaceMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsListByWorkspaceMockTests.java new file mode 100644 index 000000000000..5ec9e70c07cc --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VNetPeeringsListByWorkspaceMockTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.VirtualNetworkPeering; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class VNetPeeringsListByWorkspaceMockTests { + @Test + public void testListByWorkspace() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"allowVirtualNetworkAccess\":false,\"allowForwardedTraffic\":true,\"allowGatewayTransit\":true,\"useRemoteGateways\":false,\"databricksVirtualNetwork\":{\"id\":\"pfpubjibww\"},\"databricksAddressSpace\":{\"addressPrefixes\":[]},\"remoteVirtualNetwork\":{\"id\":\"hqkvpuvksgplsak\"},\"remoteAddressSpace\":{\"addressPrefixes\":[]},\"peeringState\":\"Connected\",\"provisioningState\":\"Succeeded\"},\"id\":\"ljphuopxodl\",\"name\":\"iyntorzihle\",\"type\":\"sjswsrms\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.vNetPeerings().listByWorkspace("aeneqnzarrwl", "uu", com.azure.core.util.Context.NONE); + + Assertions.assertEquals(false, response.iterator().next().allowVirtualNetworkAccess()); + Assertions.assertEquals(true, response.iterator().next().allowForwardedTraffic()); + Assertions.assertEquals(true, response.iterator().next().allowGatewayTransit()); + Assertions.assertEquals(false, response.iterator().next().useRemoteGateways()); + Assertions.assertEquals("pfpubjibww", response.iterator().next().databricksVirtualNetwork().id()); + Assertions.assertEquals("hqkvpuvksgplsak", response.iterator().next().remoteVirtualNetwork().id()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringInnerTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringInnerTests.java new file mode 100644 index 000000000000..815424bc159e --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringInnerTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.VirtualNetworkPeeringInner; +import com.azure.resourcemanager.databricks.models.AddressSpace; +import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork; +import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VirtualNetworkPeeringInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualNetworkPeeringInner model = + BinaryData + .fromString( + "{\"properties\":{\"allowVirtualNetworkAccess\":false,\"allowForwardedTraffic\":true,\"allowGatewayTransit\":false,\"useRemoteGateways\":false,\"databricksVirtualNetwork\":{\"id\":\"uokktwhrdxwz\"},\"databricksAddressSpace\":{\"addressPrefixes\":[\"mbsureximo\"]},\"remoteVirtualNetwork\":{\"id\":\"ocfs\"},\"remoteAddressSpace\":{\"addressPrefixes\":[\"mddystkiiux\",\"qyud\"]},\"peeringState\":\"Disconnected\",\"provisioningState\":\"Succeeded\"},\"id\":\"nbpoczvyifqrvkdv\",\"name\":\"sllr\",\"type\":\"vvdfwatkpnpul\"}") + .toObject(VirtualNetworkPeeringInner.class); + Assertions.assertEquals(false, model.allowVirtualNetworkAccess()); + Assertions.assertEquals(true, model.allowForwardedTraffic()); + Assertions.assertEquals(false, model.allowGatewayTransit()); + Assertions.assertEquals(false, model.useRemoteGateways()); + Assertions.assertEquals("uokktwhrdxwz", model.databricksVirtualNetwork().id()); + Assertions.assertEquals("mbsureximo", model.databricksAddressSpace().addressPrefixes().get(0)); + Assertions.assertEquals("ocfs", model.remoteVirtualNetwork().id()); + Assertions.assertEquals("mddystkiiux", model.remoteAddressSpace().addressPrefixes().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualNetworkPeeringInner model = + new VirtualNetworkPeeringInner() + .withAllowVirtualNetworkAccess(false) + .withAllowForwardedTraffic(true) + .withAllowGatewayTransit(false) + .withUseRemoteGateways(false) + .withDatabricksVirtualNetwork( + new VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork().withId("uokktwhrdxwz")) + .withDatabricksAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("mbsureximo"))) + .withRemoteVirtualNetwork( + new VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork().withId("ocfs")) + .withRemoteAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("mddystkiiux", "qyud"))); + model = BinaryData.fromObject(model).toObject(VirtualNetworkPeeringInner.class); + Assertions.assertEquals(false, model.allowVirtualNetworkAccess()); + Assertions.assertEquals(true, model.allowForwardedTraffic()); + Assertions.assertEquals(false, model.allowGatewayTransit()); + Assertions.assertEquals(false, model.useRemoteGateways()); + Assertions.assertEquals("uokktwhrdxwz", model.databricksVirtualNetwork().id()); + Assertions.assertEquals("mbsureximo", model.databricksAddressSpace().addressPrefixes().get(0)); + Assertions.assertEquals("ocfs", model.remoteVirtualNetwork().id()); + Assertions.assertEquals("mddystkiiux", model.remoteAddressSpace().addressPrefixes().get(0)); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringListTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringListTests.java new file mode 100644 index 000000000000..552fb0368003 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringListTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.VirtualNetworkPeeringInner; +import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringList; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VirtualNetworkPeeringListTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualNetworkPeeringList model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"allowVirtualNetworkAccess\":true,\"allowForwardedTraffic\":false,\"allowGatewayTransit\":false,\"useRemoteGateways\":true,\"peeringState\":\"Initiated\",\"provisioningState\":\"Succeeded\"},\"id\":\"ez\",\"name\":\"v\",\"type\":\"hxmzsbbzoggig\"},{\"properties\":{\"allowVirtualNetworkAccess\":true,\"allowForwardedTraffic\":false,\"allowGatewayTransit\":false,\"useRemoteGateways\":true,\"peeringState\":\"Disconnected\",\"provisioningState\":\"Deleting\"},\"id\":\"ptkoenkoukn\",\"name\":\"udwtiukbl\",\"type\":\"ngkpocipazy\"},{\"properties\":{\"allowVirtualNetworkAccess\":true,\"allowForwardedTraffic\":true,\"allowGatewayTransit\":false,\"useRemoteGateways\":true,\"peeringState\":\"Initiated\",\"provisioningState\":\"Updating\"},\"id\":\"evqzntypmrbp\",\"name\":\"zcdrqjsdpydnfyhx\",\"type\":\"eoejzic\"},{\"properties\":{\"allowVirtualNetworkAccess\":false,\"allowForwardedTraffic\":false,\"allowGatewayTransit\":true,\"useRemoteGateways\":true,\"peeringState\":\"Disconnected\",\"provisioningState\":\"Succeeded\"},\"id\":\"khaj\",\"name\":\"eyeam\",\"type\":\"p\"}],\"nextLink\":\"g\"}") + .toObject(VirtualNetworkPeeringList.class); + Assertions.assertEquals(true, model.value().get(0).allowVirtualNetworkAccess()); + Assertions.assertEquals(false, model.value().get(0).allowForwardedTraffic()); + Assertions.assertEquals(false, model.value().get(0).allowGatewayTransit()); + Assertions.assertEquals(true, model.value().get(0).useRemoteGateways()); + Assertions.assertEquals("g", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualNetworkPeeringList model = + new VirtualNetworkPeeringList() + .withValue( + Arrays + .asList( + new VirtualNetworkPeeringInner() + .withAllowVirtualNetworkAccess(true) + .withAllowForwardedTraffic(false) + .withAllowGatewayTransit(false) + .withUseRemoteGateways(true), + new VirtualNetworkPeeringInner() + .withAllowVirtualNetworkAccess(true) + .withAllowForwardedTraffic(false) + .withAllowGatewayTransit(false) + .withUseRemoteGateways(true), + new VirtualNetworkPeeringInner() + .withAllowVirtualNetworkAccess(true) + .withAllowForwardedTraffic(true) + .withAllowGatewayTransit(false) + .withUseRemoteGateways(true), + new VirtualNetworkPeeringInner() + .withAllowVirtualNetworkAccess(false) + .withAllowForwardedTraffic(false) + .withAllowGatewayTransit(true) + .withUseRemoteGateways(true))) + .withNextLink("g"); + model = BinaryData.fromObject(model).toObject(VirtualNetworkPeeringList.class); + Assertions.assertEquals(true, model.value().get(0).allowVirtualNetworkAccess()); + Assertions.assertEquals(false, model.value().get(0).allowForwardedTraffic()); + Assertions.assertEquals(false, model.value().get(0).allowGatewayTransit()); + Assertions.assertEquals(true, model.value().get(0).useRemoteGateways()); + Assertions.assertEquals("g", model.nextLink()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetworkTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetworkTests.java new file mode 100644 index 000000000000..1367b9072d19 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetworkTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork; +import org.junit.jupiter.api.Assertions; + +public final class VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetworkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork model = + BinaryData + .fromString("{\"id\":\"svexcsonpclhoco\"}") + .toObject(VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork.class); + Assertions.assertEquals("svexcsonpclhoco", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork model = + new VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork().withId("svexcsonpclhoco"); + model = + BinaryData.fromObject(model).toObject(VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork.class); + Assertions.assertEquals("svexcsonpclhoco", model.id()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetworkTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetworkTests.java new file mode 100644 index 000000000000..47e9e05fe4ec --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetworkTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork; +import org.junit.jupiter.api.Assertions; + +public final class VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetworkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork model = + BinaryData + .fromString("{\"id\":\"u\"}") + .toObject(VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork.class); + Assertions.assertEquals("u", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork model = + new VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork().withId("u"); + model = BinaryData.fromObject(model).toObject(VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork.class); + Assertions.assertEquals("u", model.id()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringPropertiesFormatTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringPropertiesFormatTests.java new file mode 100644 index 000000000000..094c9bd51668 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/VirtualNetworkPeeringPropertiesFormatTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.VirtualNetworkPeeringPropertiesFormat; +import com.azure.resourcemanager.databricks.models.AddressSpace; +import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork; +import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VirtualNetworkPeeringPropertiesFormatTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualNetworkPeeringPropertiesFormat model = + BinaryData + .fromString( + "{\"allowVirtualNetworkAccess\":true,\"allowForwardedTraffic\":true,\"allowGatewayTransit\":true,\"useRemoteGateways\":true,\"databricksVirtualNetwork\":{\"id\":\"iqzbq\"},\"databricksAddressSpace\":{\"addressPrefixes\":[\"vmyokacspkwl\"]},\"remoteVirtualNetwork\":{\"id\":\"dobpxjmflbvvn\"},\"remoteAddressSpace\":{\"addressPrefixes\":[\"cciw\",\"zjuqkhrsaj\",\"wkuofoskghsauu\",\"mjmvxieduugidyjr\"]},\"peeringState\":\"Disconnected\",\"provisioningState\":\"Succeeded\"}") + .toObject(VirtualNetworkPeeringPropertiesFormat.class); + Assertions.assertEquals(true, model.allowVirtualNetworkAccess()); + Assertions.assertEquals(true, model.allowForwardedTraffic()); + Assertions.assertEquals(true, model.allowGatewayTransit()); + Assertions.assertEquals(true, model.useRemoteGateways()); + Assertions.assertEquals("iqzbq", model.databricksVirtualNetwork().id()); + Assertions.assertEquals("vmyokacspkwl", model.databricksAddressSpace().addressPrefixes().get(0)); + Assertions.assertEquals("dobpxjmflbvvn", model.remoteVirtualNetwork().id()); + Assertions.assertEquals("cciw", model.remoteAddressSpace().addressPrefixes().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualNetworkPeeringPropertiesFormat model = + new VirtualNetworkPeeringPropertiesFormat() + .withAllowVirtualNetworkAccess(true) + .withAllowForwardedTraffic(true) + .withAllowGatewayTransit(true) + .withUseRemoteGateways(true) + .withDatabricksVirtualNetwork( + new VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork().withId("iqzbq")) + .withDatabricksAddressSpace(new AddressSpace().withAddressPrefixes(Arrays.asList("vmyokacspkwl"))) + .withRemoteVirtualNetwork( + new VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork().withId("dobpxjmflbvvn")) + .withRemoteAddressSpace( + new AddressSpace() + .withAddressPrefixes( + Arrays.asList("cciw", "zjuqkhrsaj", "wkuofoskghsauu", "mjmvxieduugidyjr"))); + model = BinaryData.fromObject(model).toObject(VirtualNetworkPeeringPropertiesFormat.class); + Assertions.assertEquals(true, model.allowVirtualNetworkAccess()); + Assertions.assertEquals(true, model.allowForwardedTraffic()); + Assertions.assertEquals(true, model.allowGatewayTransit()); + Assertions.assertEquals(true, model.useRemoteGateways()); + Assertions.assertEquals("iqzbq", model.databricksVirtualNetwork().id()); + Assertions.assertEquals("vmyokacspkwl", model.databricksAddressSpace().addressPrefixes().get(0)); + Assertions.assertEquals("dobpxjmflbvvn", model.remoteVirtualNetwork().id()); + Assertions.assertEquals("cciw", model.remoteAddressSpace().addressPrefixes().get(0)); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceCustomBooleanParameterTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceCustomBooleanParameterTests.java new file mode 100644 index 000000000000..d1f808077748 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceCustomBooleanParameterTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.WorkspaceCustomBooleanParameter; +import org.junit.jupiter.api.Assertions; + +public final class WorkspaceCustomBooleanParameterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspaceCustomBooleanParameter model = + BinaryData + .fromString("{\"type\":\"Object\",\"value\":true}") + .toObject(WorkspaceCustomBooleanParameter.class); + Assertions.assertEquals(true, model.value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkspaceCustomBooleanParameter model = new WorkspaceCustomBooleanParameter().withValue(true); + model = BinaryData.fromObject(model).toObject(WorkspaceCustomBooleanParameter.class); + Assertions.assertEquals(true, model.value()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceCustomObjectParameterTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceCustomObjectParameterTests.java new file mode 100644 index 000000000000..74b33684330a --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceCustomObjectParameterTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.WorkspaceCustomObjectParameter; + +public final class WorkspaceCustomObjectParameterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspaceCustomObjectParameter model = + BinaryData + .fromString("{\"type\":\"String\",\"value\":\"datawjfeusnhutjel\"}") + .toObject(WorkspaceCustomObjectParameter.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkspaceCustomObjectParameter model = new WorkspaceCustomObjectParameter().withValue("datawjfeusnhutjel"); + model = BinaryData.fromObject(model).toObject(WorkspaceCustomObjectParameter.class); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceCustomStringParameterTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceCustomStringParameterTests.java new file mode 100644 index 000000000000..ff90adcca2c2 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceCustomStringParameterTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.WorkspaceCustomStringParameter; +import org.junit.jupiter.api.Assertions; + +public final class WorkspaceCustomStringParameterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspaceCustomStringParameter model = + BinaryData + .fromString("{\"type\":\"Bool\",\"value\":\"dzevndhkrw\"}") + .toObject(WorkspaceCustomStringParameter.class); + Assertions.assertEquals("dzevndhkrw", model.value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkspaceCustomStringParameter model = new WorkspaceCustomStringParameter().withValue("dzevndhkrw"); + model = BinaryData.fromObject(model).toObject(WorkspaceCustomStringParameter.class); + Assertions.assertEquals("dzevndhkrw", model.value()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceInnerTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceInnerTests.java new file mode 100644 index 000000000000..e553e1a16fb4 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceInnerTests.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.databricks.models.CreatedBy; +import com.azure.resourcemanager.databricks.models.ManagedIdentityConfiguration; +import com.azure.resourcemanager.databricks.models.PublicNetworkAccess; +import com.azure.resourcemanager.databricks.models.RequiredNsgRules; +import com.azure.resourcemanager.databricks.models.Sku; +import com.azure.resourcemanager.databricks.models.WorkspaceCustomParameters; +import com.azure.resourcemanager.databricks.models.WorkspacePropertiesEncryption; +import com.azure.resourcemanager.databricks.models.WorkspaceProviderAuthorization; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; + +public final class WorkspaceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspaceInner model = + BinaryData + .fromString( + "{\"properties\":{\"managedResourceGroupId\":\"mmhquvgjxpyb\",\"parameters\":{},\"provisioningState\":\"Updating\",\"uiDefinitionUri\":\"ybbejhph\",\"authorizations\":[{\"principalId\":\"9b3f7b40-1587-45c8-95f1-87f90fbf4888\",\"roleDefinitionId\":\"8b764ca8-eb36-4499-b8cf-6404187604b2\"},{\"principalId\":\"d8b5fede-7d64-4b99-96dd-405ebefb865f\",\"roleDefinitionId\":\"767ca662-4293-4640-9920-9ab706598d92\"},{\"principalId\":\"d315d44d-a220-4bcb-ac96-0090356610ba\",\"roleDefinitionId\":\"7101072a-cc2b-4608-a09a-6bcacff97d61\"}],\"createdBy\":{\"oid\":\"29bac2a1-cdd4-4fd8-af48-44d6338b49de\",\"puid\":\"ao\",\"applicationId\":\"47346ec5-6c4d-4263-a1d1-614e619dd5fe\"},\"updatedBy\":{\"oid\":\"da5892da-f90d-4fee-afd9-471d7aed8d58\",\"puid\":\"mtqio\",\"applicationId\":\"bb659603-7dc5-4c2f-a2f4-63029154fecc\"},\"createdDateTime\":\"2021-02-12T12:17:55Z\",\"workspaceId\":\"tbmufpo\",\"workspaceUrl\":\"oizh\",\"storageAccountIdentity\":{\"principalId\":\"a93e1e4c-3129-4671-8bb1-dc41106a5f7c\",\"tenantId\":\"bbe9a138-5300-4496-b381-807a8f6fe35f\",\"type\":\"bqsoqijg\"},\"managedDiskIdentity\":{\"principalId\":\"6948af9c-79a5-4047-be23-10a152ea7dea\",\"tenantId\":\"9d258237-c39f-4bd6-935c-373a215fe30e\",\"type\":\"azlobcufpdznrbt\"},\"diskEncryptionSetId\":\"qjnqglhqgnufoooj\",\"encryption\":{},\"privateEndpointConnections\":[{\"id\":\"sqe\",\"name\":\"aagdfmg\",\"type\":\"zlhjxrifkwmrvkt\"},{\"id\":\"izntocipao\",\"name\":\"ajpsquc\",\"type\":\"poyfdkfogkn\"},{\"id\":\"gjofjd\",\"name\":\"eqsrdeupewnwreit\",\"type\":\"zyf\"},{\"id\":\"usarhmofc\",\"name\":\"hs\",\"type\":\"yurkdtmlxhekuksj\"}],\"publicNetworkAccess\":\"Disabled\",\"requiredNsgRules\":\"AllRules\"},\"sku\":{\"name\":\"mparcryuanzw\",\"tier\":\"zdxtayrlhmwhf\"},\"location\":\"rqobmtuk\",\"tags\":{\"xtij\":\"yrtih\",\"zk\":\"pzvgnwzsymglzufc\",\"fhfcb\":\"hdbihan\",\"a\":\"y\"},\"id\":\"ithxqhabifpi\",\"name\":\"xwczbyscnp\",\"type\":\"x\"}") + .toObject(WorkspaceInner.class); + Assertions.assertEquals("rqobmtuk", model.location()); + Assertions.assertEquals("yrtih", model.tags().get("xtij")); + Assertions.assertEquals("mparcryuanzw", model.sku().name()); + Assertions.assertEquals("zdxtayrlhmwhf", model.sku().tier()); + Assertions.assertEquals("mmhquvgjxpyb", model.managedResourceGroupId()); + Assertions.assertEquals("ybbejhph", model.uiDefinitionUri()); + Assertions + .assertEquals( + UUID.fromString("9b3f7b40-1587-45c8-95f1-87f90fbf4888"), model.authorizations().get(0).principalId()); + Assertions + .assertEquals( + UUID.fromString("8b764ca8-eb36-4499-b8cf-6404187604b2"), + model.authorizations().get(0).roleDefinitionId()); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, model.publicNetworkAccess()); + Assertions.assertEquals(RequiredNsgRules.ALL_RULES, model.requiredNsgRules()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkspaceInner model = + new WorkspaceInner() + .withLocation("rqobmtuk") + .withTags(mapOf("xtij", "yrtih", "zk", "pzvgnwzsymglzufc", "fhfcb", "hdbihan", "a", "y")) + .withSku(new Sku().withName("mparcryuanzw").withTier("zdxtayrlhmwhf")) + .withManagedResourceGroupId("mmhquvgjxpyb") + .withParameters(new WorkspaceCustomParameters()) + .withUiDefinitionUri("ybbejhph") + .withAuthorizations( + Arrays + .asList( + new WorkspaceProviderAuthorization() + .withPrincipalId(UUID.fromString("9b3f7b40-1587-45c8-95f1-87f90fbf4888")) + .withRoleDefinitionId(UUID.fromString("8b764ca8-eb36-4499-b8cf-6404187604b2")), + new WorkspaceProviderAuthorization() + .withPrincipalId(UUID.fromString("d8b5fede-7d64-4b99-96dd-405ebefb865f")) + .withRoleDefinitionId(UUID.fromString("767ca662-4293-4640-9920-9ab706598d92")), + new WorkspaceProviderAuthorization() + .withPrincipalId(UUID.fromString("d315d44d-a220-4bcb-ac96-0090356610ba")) + .withRoleDefinitionId(UUID.fromString("7101072a-cc2b-4608-a09a-6bcacff97d61")))) + .withCreatedBy(new CreatedBy()) + .withUpdatedBy(new CreatedBy()) + .withStorageAccountIdentity(new ManagedIdentityConfiguration()) + .withManagedDiskIdentity(new ManagedIdentityConfiguration()) + .withEncryption(new WorkspacePropertiesEncryption()) + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED) + .withRequiredNsgRules(RequiredNsgRules.ALL_RULES); + model = BinaryData.fromObject(model).toObject(WorkspaceInner.class); + Assertions.assertEquals("rqobmtuk", model.location()); + Assertions.assertEquals("yrtih", model.tags().get("xtij")); + Assertions.assertEquals("mparcryuanzw", model.sku().name()); + Assertions.assertEquals("zdxtayrlhmwhf", model.sku().tier()); + Assertions.assertEquals("mmhquvgjxpyb", model.managedResourceGroupId()); + Assertions.assertEquals("ybbejhph", model.uiDefinitionUri()); + Assertions + .assertEquals( + UUID.fromString("9b3f7b40-1587-45c8-95f1-87f90fbf4888"), model.authorizations().get(0).principalId()); + Assertions + .assertEquals( + UUID.fromString("8b764ca8-eb36-4499-b8cf-6404187604b2"), + model.authorizations().get(0).roleDefinitionId()); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, model.publicNetworkAccess()); + Assertions.assertEquals(RequiredNsgRules.ALL_RULES, model.requiredNsgRules()); + } + + @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/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceListResultTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceListResultTests.java new file mode 100644 index 000000000000..162c71a82eb7 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceListResultTests.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.databricks.models.PublicNetworkAccess; +import com.azure.resourcemanager.databricks.models.RequiredNsgRules; +import com.azure.resourcemanager.databricks.models.Sku; +import com.azure.resourcemanager.databricks.models.WorkspaceListResult; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class WorkspaceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspaceListResult model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"managedResourceGroupId\":\"wzwbnguitn\",\"provisioningState\":\"Created\",\"uiDefinitionUri\":\"a\",\"authorizations\":[],\"createdDateTime\":\"2020-12-27T04:43:40Z\",\"workspaceId\":\"ckyfih\",\"workspaceUrl\":\"idf\",\"diskEncryptionSetId\":\"zuhtymwisdkfthwx\",\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Enabled\",\"requiredNsgRules\":\"NoAzureServiceRules\"},\"sku\":{\"name\":\"pvkmijcmmxdcuf\",\"tier\":\"srp\"},\"location\":\"zidnsezcxtbzsgfy\",\"tags\":{\"sflnrosfqp\":\"newmdwzjeiachbo\"},\"id\":\"eeh\",\"name\":\"zvypyqrimzinp\",\"type\":\"swjdkirso\"},{\"properties\":{\"managedResourceGroupId\":\"dqxhcrmnohjtckwh\",\"provisioningState\":\"Canceled\",\"uiDefinitionUri\":\"iy\",\"authorizations\":[],\"createdDateTime\":\"2021-02-24T22:15:36Z\",\"workspaceId\":\"pgrjbz\",\"workspaceUrl\":\"rcjxvsnbyxqabn\",\"diskEncryptionSetId\":\"cyshurzafbljjgp\",\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Enabled\",\"requiredNsgRules\":\"NoAzureDatabricksRules\"},\"sku\":{\"name\":\"ljavbqid\",\"tier\":\"ajzyul\"},\"location\":\"u\",\"tags\":{\"xzlocxscp\":\"rlkhbzhfepgzgq\",\"j\":\"ierhhbcsglummaj\",\"jionpimexgstxgc\":\"odxobnbdxkqpxok\"},\"id\":\"odgmaajrmvdjwz\",\"name\":\"lovmclwhijcoe\",\"type\":\"ctbzaq\"}],\"nextLink\":\"sycbkbfk\"}") + .toObject(WorkspaceListResult.class); + Assertions.assertEquals("zidnsezcxtbzsgfy", model.value().get(0).location()); + Assertions.assertEquals("newmdwzjeiachbo", model.value().get(0).tags().get("sflnrosfqp")); + Assertions.assertEquals("pvkmijcmmxdcuf", model.value().get(0).sku().name()); + Assertions.assertEquals("srp", model.value().get(0).sku().tier()); + Assertions.assertEquals("wzwbnguitn", model.value().get(0).managedResourceGroupId()); + Assertions.assertEquals("a", model.value().get(0).uiDefinitionUri()); + Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.value().get(0).publicNetworkAccess()); + Assertions.assertEquals(RequiredNsgRules.NO_AZURE_SERVICE_RULES, model.value().get(0).requiredNsgRules()); + Assertions.assertEquals("sycbkbfk", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkspaceListResult model = + new WorkspaceListResult() + .withValue( + Arrays + .asList( + new WorkspaceInner() + .withLocation("zidnsezcxtbzsgfy") + .withTags(mapOf("sflnrosfqp", "newmdwzjeiachbo")) + .withSku(new Sku().withName("pvkmijcmmxdcuf").withTier("srp")) + .withManagedResourceGroupId("wzwbnguitn") + .withUiDefinitionUri("a") + .withAuthorizations(Arrays.asList()) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withRequiredNsgRules(RequiredNsgRules.NO_AZURE_SERVICE_RULES), + new WorkspaceInner() + .withLocation("u") + .withTags( + mapOf( + "xzlocxscp", + "rlkhbzhfepgzgq", + "j", + "ierhhbcsglummaj", + "jionpimexgstxgc", + "odxobnbdxkqpxok")) + .withSku(new Sku().withName("ljavbqid").withTier("ajzyul")) + .withManagedResourceGroupId("dqxhcrmnohjtckwh") + .withUiDefinitionUri("iy") + .withAuthorizations(Arrays.asList()) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withRequiredNsgRules(RequiredNsgRules.NO_AZURE_DATABRICKS_RULES))) + .withNextLink("sycbkbfk"); + model = BinaryData.fromObject(model).toObject(WorkspaceListResult.class); + Assertions.assertEquals("zidnsezcxtbzsgfy", model.value().get(0).location()); + Assertions.assertEquals("newmdwzjeiachbo", model.value().get(0).tags().get("sflnrosfqp")); + Assertions.assertEquals("pvkmijcmmxdcuf", model.value().get(0).sku().name()); + Assertions.assertEquals("srp", model.value().get(0).sku().tier()); + Assertions.assertEquals("wzwbnguitn", model.value().get(0).managedResourceGroupId()); + Assertions.assertEquals("a", model.value().get(0).uiDefinitionUri()); + Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.value().get(0).publicNetworkAccess()); + Assertions.assertEquals(RequiredNsgRules.NO_AZURE_SERVICE_RULES, model.value().get(0).requiredNsgRules()); + Assertions.assertEquals("sycbkbfk", model.nextLink()); + } + + @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/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacePropertiesTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacePropertiesTests.java new file mode 100644 index 000000000000..6d5d008e70c0 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacePropertiesTests.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.fluent.models.WorkspaceProperties; +import com.azure.resourcemanager.databricks.models.CreatedBy; +import com.azure.resourcemanager.databricks.models.EncryptionEntitiesDefinition; +import com.azure.resourcemanager.databricks.models.ManagedIdentityConfiguration; +import com.azure.resourcemanager.databricks.models.PublicNetworkAccess; +import com.azure.resourcemanager.databricks.models.RequiredNsgRules; +import com.azure.resourcemanager.databricks.models.WorkspaceCustomBooleanParameter; +import com.azure.resourcemanager.databricks.models.WorkspaceCustomParameters; +import com.azure.resourcemanager.databricks.models.WorkspaceCustomStringParameter; +import com.azure.resourcemanager.databricks.models.WorkspaceEncryptionParameter; +import com.azure.resourcemanager.databricks.models.WorkspacePropertiesEncryption; +import com.azure.resourcemanager.databricks.models.WorkspaceProviderAuthorization; +import java.util.Arrays; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; + +public final class WorkspacePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspaceProperties model = + BinaryData + .fromString( + "{\"managedResourceGroupId\":\"hiv\",\"parameters\":{\"amlWorkspaceId\":{\"type\":\"Bool\",\"value\":\"b\"},\"customVirtualNetworkId\":{\"type\":\"Object\",\"value\":\"xvd\"},\"customPublicSubnetName\":{\"type\":\"Object\",\"value\":\"rtfw\"},\"customPrivateSubnetName\":{\"type\":\"String\",\"value\":\"gaudcc\"},\"enableNoPublicIp\":{\"type\":\"String\",\"value\":false},\"loadBalancerBackendPoolName\":{\"type\":\"Bool\",\"value\":\"ejhkry\"},\"loadBalancerId\":{\"type\":\"Bool\",\"value\":\"pczwlo\"},\"natGatewayName\":{\"type\":\"Object\",\"value\":\"mkkvnip\"},\"publicIpName\":{\"type\":\"String\",\"value\":\"jnchgej\"},\"prepareEncryption\":{\"type\":\"String\",\"value\":true},\"encryption\":{\"type\":\"Object\"},\"requireInfrastructureEncryption\":{\"type\":\"Bool\",\"value\":false},\"storageAccountName\":{\"type\":\"Bool\",\"value\":\"yahux\"},\"storageAccountSkuName\":{\"type\":\"String\",\"value\":\"qnjaqwix\"},\"vnetAddressPrefix\":{\"type\":\"String\",\"value\":\"ozvcput\"},\"resourceTags\":{\"type\":\"Object\",\"value\":\"datawmfdatscmdvpjhul\"}},\"provisioningState\":\"Ready\",\"uiDefinitionUri\":\"mkjozkrwf\",\"authorizations\":[{\"principalId\":\"423825c0-d7b7-43df-9531-f0a89709749a\",\"roleDefinitionId\":\"5ee36843-2071-404d-8a89-ef90b190dfbc\"},{\"principalId\":\"9943af85-f67d-4113-8d2d-ce32b16a7041\",\"roleDefinitionId\":\"158a0eb5-2a85-446f-a91c-3c8cd7b09c4e\"}],\"createdBy\":{\"oid\":\"8757365e-9e99-4485-a785-c82ecd83fe50\",\"puid\":\"pslwejdpvw\",\"applicationId\":\"c8612b79-6663-486e-876e-8cdbdaa4007b\"},\"updatedBy\":{\"oid\":\"fd76275f-1599-46e7-a79a-0311ba4af930\",\"puid\":\"soacctazakl\",\"applicationId\":\"b80d575a-7890-4055-b4cd-a7697defdf0b\"},\"createdDateTime\":\"2021-05-05T03:41:54Z\",\"workspaceId\":\"cr\",\"workspaceUrl\":\"fdfdosygexpa\",\"storageAccountIdentity\":{\"principalId\":\"d7418a12-4ee4-4a80-a3ab-2ab139635f88\",\"tenantId\":\"10f2fbb2-2353-4deb-96de-440f0dc1ef57\",\"type\":\"msbzjhcrz\"},\"managedDiskIdentity\":{\"principalId\":\"47df26cd-98fe-41ba-ae19-790bbbdba738\",\"tenantId\":\"bf8147fe-9bba-456c-95f6-97934ef9f2c9\",\"type\":\"lxaolthqtrgqjbp\"},\"diskEncryptionSetId\":\"fsinzgvfcjrwzoxx\",\"encryption\":{\"entities\":{}},\"privateEndpointConnections\":[{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Creating\"},\"id\":\"it\",\"name\":\"np\",\"type\":\"qfpjk\"},{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Deleting\"},\"id\":\"pdvhpfxxypin\",\"name\":\"nmayhuybb\",\"type\":\"podepoo\"},{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Deleting\"},\"id\":\"amiheognarxz\",\"name\":\"theotusiv\",\"type\":\"evcciqihnhun\"},{\"properties\":{\"groupIds\":[],\"provisioningState\":\"Failed\"},\"id\":\"rnfygxgispem\",\"name\":\"tzfkufubl\",\"type\":\"ofx\"}],\"publicNetworkAccess\":\"Disabled\",\"requiredNsgRules\":\"AllRules\"}") + .toObject(WorkspaceProperties.class); + Assertions.assertEquals("hiv", model.managedResourceGroupId()); + Assertions.assertEquals("b", model.parameters().amlWorkspaceId().value()); + Assertions.assertEquals("xvd", model.parameters().customVirtualNetworkId().value()); + Assertions.assertEquals("rtfw", model.parameters().customPublicSubnetName().value()); + Assertions.assertEquals("gaudcc", model.parameters().customPrivateSubnetName().value()); + Assertions.assertEquals(false, model.parameters().enableNoPublicIp().value()); + Assertions.assertEquals("ejhkry", model.parameters().loadBalancerBackendPoolName().value()); + Assertions.assertEquals("pczwlo", model.parameters().loadBalancerId().value()); + Assertions.assertEquals("mkkvnip", model.parameters().natGatewayName().value()); + Assertions.assertEquals("jnchgej", model.parameters().publicIpName().value()); + Assertions.assertEquals(true, model.parameters().prepareEncryption().value()); + Assertions.assertEquals(false, model.parameters().requireInfrastructureEncryption().value()); + Assertions.assertEquals("yahux", model.parameters().storageAccountName().value()); + Assertions.assertEquals("qnjaqwix", model.parameters().storageAccountSkuName().value()); + Assertions.assertEquals("ozvcput", model.parameters().vnetAddressPrefix().value()); + Assertions.assertEquals("mkjozkrwf", model.uiDefinitionUri()); + Assertions + .assertEquals( + UUID.fromString("423825c0-d7b7-43df-9531-f0a89709749a"), model.authorizations().get(0).principalId()); + Assertions + .assertEquals( + UUID.fromString("5ee36843-2071-404d-8a89-ef90b190dfbc"), + model.authorizations().get(0).roleDefinitionId()); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, model.publicNetworkAccess()); + Assertions.assertEquals(RequiredNsgRules.ALL_RULES, model.requiredNsgRules()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkspaceProperties model = + new WorkspaceProperties() + .withManagedResourceGroupId("hiv") + .withParameters( + new WorkspaceCustomParameters() + .withAmlWorkspaceId(new WorkspaceCustomStringParameter().withValue("b")) + .withCustomVirtualNetworkId(new WorkspaceCustomStringParameter().withValue("xvd")) + .withCustomPublicSubnetName(new WorkspaceCustomStringParameter().withValue("rtfw")) + .withCustomPrivateSubnetName(new WorkspaceCustomStringParameter().withValue("gaudcc")) + .withEnableNoPublicIp(new WorkspaceCustomBooleanParameter().withValue(false)) + .withLoadBalancerBackendPoolName(new WorkspaceCustomStringParameter().withValue("ejhkry")) + .withLoadBalancerId(new WorkspaceCustomStringParameter().withValue("pczwlo")) + .withNatGatewayName(new WorkspaceCustomStringParameter().withValue("mkkvnip")) + .withPublicIpName(new WorkspaceCustomStringParameter().withValue("jnchgej")) + .withPrepareEncryption(new WorkspaceCustomBooleanParameter().withValue(true)) + .withEncryption(new WorkspaceEncryptionParameter()) + .withRequireInfrastructureEncryption(new WorkspaceCustomBooleanParameter().withValue(false)) + .withStorageAccountName(new WorkspaceCustomStringParameter().withValue("yahux")) + .withStorageAccountSkuName(new WorkspaceCustomStringParameter().withValue("qnjaqwix")) + .withVnetAddressPrefix(new WorkspaceCustomStringParameter().withValue("ozvcput"))) + .withUiDefinitionUri("mkjozkrwf") + .withAuthorizations( + Arrays + .asList( + new WorkspaceProviderAuthorization() + .withPrincipalId(UUID.fromString("423825c0-d7b7-43df-9531-f0a89709749a")) + .withRoleDefinitionId(UUID.fromString("5ee36843-2071-404d-8a89-ef90b190dfbc")), + new WorkspaceProviderAuthorization() + .withPrincipalId(UUID.fromString("9943af85-f67d-4113-8d2d-ce32b16a7041")) + .withRoleDefinitionId(UUID.fromString("158a0eb5-2a85-446f-a91c-3c8cd7b09c4e")))) + .withCreatedBy(new CreatedBy()) + .withUpdatedBy(new CreatedBy()) + .withStorageAccountIdentity(new ManagedIdentityConfiguration()) + .withManagedDiskIdentity(new ManagedIdentityConfiguration()) + .withEncryption(new WorkspacePropertiesEncryption().withEntities(new EncryptionEntitiesDefinition())) + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED) + .withRequiredNsgRules(RequiredNsgRules.ALL_RULES); + model = BinaryData.fromObject(model).toObject(WorkspaceProperties.class); + Assertions.assertEquals("hiv", model.managedResourceGroupId()); + Assertions.assertEquals("b", model.parameters().amlWorkspaceId().value()); + Assertions.assertEquals("xvd", model.parameters().customVirtualNetworkId().value()); + Assertions.assertEquals("rtfw", model.parameters().customPublicSubnetName().value()); + Assertions.assertEquals("gaudcc", model.parameters().customPrivateSubnetName().value()); + Assertions.assertEquals(false, model.parameters().enableNoPublicIp().value()); + Assertions.assertEquals("ejhkry", model.parameters().loadBalancerBackendPoolName().value()); + Assertions.assertEquals("pczwlo", model.parameters().loadBalancerId().value()); + Assertions.assertEquals("mkkvnip", model.parameters().natGatewayName().value()); + Assertions.assertEquals("jnchgej", model.parameters().publicIpName().value()); + Assertions.assertEquals(true, model.parameters().prepareEncryption().value()); + Assertions.assertEquals(false, model.parameters().requireInfrastructureEncryption().value()); + Assertions.assertEquals("yahux", model.parameters().storageAccountName().value()); + Assertions.assertEquals("qnjaqwix", model.parameters().storageAccountSkuName().value()); + Assertions.assertEquals("ozvcput", model.parameters().vnetAddressPrefix().value()); + Assertions.assertEquals("mkjozkrwf", model.uiDefinitionUri()); + Assertions + .assertEquals( + UUID.fromString("423825c0-d7b7-43df-9531-f0a89709749a"), model.authorizations().get(0).principalId()); + Assertions + .assertEquals( + UUID.fromString("5ee36843-2071-404d-8a89-ef90b190dfbc"), + model.authorizations().get(0).roleDefinitionId()); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, model.publicNetworkAccess()); + Assertions.assertEquals(RequiredNsgRules.ALL_RULES, model.requiredNsgRules()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceProviderAuthorizationTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceProviderAuthorizationTests.java new file mode 100644 index 000000000000..c0cdb3ebf2cf --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceProviderAuthorizationTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.WorkspaceProviderAuthorization; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; + +public final class WorkspaceProviderAuthorizationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspaceProviderAuthorization model = + BinaryData + .fromString( + "{\"principalId\":\"4fd517cd-d648-4f01-9053-54d0c89de410\",\"roleDefinitionId\":\"ffb05287-7804-4938-b591-9b5921328ff7\"}") + .toObject(WorkspaceProviderAuthorization.class); + Assertions.assertEquals(UUID.fromString("4fd517cd-d648-4f01-9053-54d0c89de410"), model.principalId()); + Assertions.assertEquals(UUID.fromString("ffb05287-7804-4938-b591-9b5921328ff7"), model.roleDefinitionId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkspaceProviderAuthorization model = + new WorkspaceProviderAuthorization() + .withPrincipalId(UUID.fromString("4fd517cd-d648-4f01-9053-54d0c89de410")) + .withRoleDefinitionId(UUID.fromString("ffb05287-7804-4938-b591-9b5921328ff7")); + model = BinaryData.fromObject(model).toObject(WorkspaceProviderAuthorization.class); + Assertions.assertEquals(UUID.fromString("4fd517cd-d648-4f01-9053-54d0c89de410"), model.principalId()); + Assertions.assertEquals(UUID.fromString("ffb05287-7804-4938-b591-9b5921328ff7"), model.roleDefinitionId()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceUpdateTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceUpdateTests.java new file mode 100644 index 000000000000..bdfdd2549c0d --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspaceUpdateTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.databricks.models.WorkspaceUpdate; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class WorkspaceUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspaceUpdate model = + BinaryData + .fromString("{\"tags\":{\"gjvtbv\":\"b\",\"uouq\":\"ysszdnrujqguh\"}}") + .toObject(WorkspaceUpdate.class); + Assertions.assertEquals("b", model.tags().get("gjvtbv")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkspaceUpdate model = new WorkspaceUpdate().withTags(mapOf("gjvtbv", "b", "uouq", "ysszdnrujqguh")); + model = BinaryData.fromObject(model).toObject(WorkspaceUpdate.class); + Assertions.assertEquals("b", model.tags().get("gjvtbv")); + } + + @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/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesDeleteMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesDeleteMockTests.java new file mode 100644 index 000000000000..f994c46b3785 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesDeleteMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class WorkspacesDeleteMockTests { + @Test + public void testDelete() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.workspaces().delete("glaocq", "tcc", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesGetByResourceGroupWithResponseMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..dd3981c52b37 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.PublicNetworkAccess; +import com.azure.resourcemanager.databricks.models.RequiredNsgRules; +import com.azure.resourcemanager.databricks.models.Workspace; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class WorkspacesGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"managedResourceGroupId\":\"slpvlop\",\"parameters\":{},\"provisioningState\":\"Ready\",\"uiDefinitionUri\":\"m\",\"authorizations\":[],\"createdBy\":{\"oid\":\"c37ec0eb-5fcf-45a4-ae1d-fe0e71eec7a9\",\"puid\":\"deoj\",\"applicationId\":\"1304327b-8166-4cf0-a689-3ad13822d27c\"},\"updatedBy\":{\"oid\":\"9d632ff5-c609-4ec0-a601-86a6a47e6d2f\",\"puid\":\"hsmtxpsiebtfhvp\",\"applicationId\":\"0e9e2939-6907-4cb0-9d80-519cb831ba5e\"},\"createdDateTime\":\"2021-07-15T16:58:50Z\",\"workspaceId\":\"krdqmh\",\"workspaceUrl\":\"dhtldwkyz\",\"storageAccountIdentity\":{\"principalId\":\"3e4d5959-ec1f-4f19-ac22-b9f0108364d0\",\"tenantId\":\"7e91680d-0316-4e3c-84d7-b6679dde3de0\",\"type\":\"ncwscwsvlxoto\"},\"managedDiskIdentity\":{\"principalId\":\"e6a9e1e2-8d99-4b7a-8344-9910599bb1d7\",\"tenantId\":\"a8465cfc-3de9-4500-9de2-2166608ffc79\",\"type\":\"pqsxvnmicy\"},\"diskEncryptionSetId\":\"ceoveilovno\",\"encryption\":{},\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Disabled\",\"requiredNsgRules\":\"AllRules\"},\"sku\":{\"name\":\"k\",\"tier\":\"x\"},\"location\":\"bttk\",\"tags\":{\"jtoqne\":\"wpn\",\"abgy\":\"mclfplphoxuscr\"},\"id\":\"psbjta\",\"name\":\"qugxywpmueefjzwf\",\"type\":\"kqujidsuyono\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Workspace response = + manager + .workspaces() + .getByResourceGroupWithResponse("plgmgsxnk", "zkd", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("bttk", response.location()); + Assertions.assertEquals("wpn", response.tags().get("jtoqne")); + Assertions.assertEquals("k", response.sku().name()); + Assertions.assertEquals("x", response.sku().tier()); + Assertions.assertEquals("slpvlop", response.managedResourceGroupId()); + Assertions.assertEquals("m", response.uiDefinitionUri()); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, response.publicNetworkAccess()); + Assertions.assertEquals(RequiredNsgRules.ALL_RULES, response.requiredNsgRules()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesListByResourceGroupMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesListByResourceGroupMockTests.java new file mode 100644 index 000000000000..a7761aed74e0 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesListByResourceGroupMockTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.PublicNetworkAccess; +import com.azure.resourcemanager.databricks.models.RequiredNsgRules; +import com.azure.resourcemanager.databricks.models.Workspace; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class WorkspacesListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"managedResourceGroupId\":\"udxytlmoyrx\",\"parameters\":{},\"provisioningState\":\"Updating\",\"uiDefinitionUri\":\"ck\",\"authorizations\":[],\"createdBy\":{\"oid\":\"e4be9bd1-128c-4ef3-8d44-b9a6f901bde7\",\"puid\":\"sbkyvpycanuzbp\",\"applicationId\":\"8094609e-dfa3-42c5-836b-3ab83087d859\"},\"updatedBy\":{\"oid\":\"bd92074b-bc28-4ad2-95ee-f13175da1627\",\"puid\":\"uwbc\",\"applicationId\":\"02706fd9-920d-4b1e-aa94-96bfc4057f3f\"},\"createdDateTime\":\"2021-02-06T08:20:06Z\",\"workspaceId\":\"ehhseyvjusrts\",\"workspaceUrl\":\"spkdee\",\"storageAccountIdentity\":{\"principalId\":\"7e484482-6c21-422d-aaea-8d0238b5bea4\",\"tenantId\":\"25287f50-030a-490c-8552-8810538c2520\",\"type\":\"xagkvtmelmqkrh\"},\"managedDiskIdentity\":{\"principalId\":\"2bae85f5-a62f-48e1-aa14-d1e4b84fbd67\",\"tenantId\":\"ace640f7-bb30-4ef0-aa76-54e054f11869\",\"type\":\"uahaquhcdhmd\"},\"diskEncryptionSetId\":\"laexqp\",\"encryption\":{},\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Enabled\",\"requiredNsgRules\":\"NoAzureServiceRules\"},\"sku\":{\"name\":\"r\",\"tier\":\"xpvgo\"},\"location\":\"lf\",\"tags\":{\"b\":\"gwb\",\"dawkzbali\":\"e\",\"hashsfwxosow\":\"urqhaka\"},\"id\":\"xcug\",\"name\":\"cjooxdjebwpucwwf\",\"type\":\"ovbvmeueciv\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.workspaces().listByResourceGroup("g", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("lf", response.iterator().next().location()); + Assertions.assertEquals("gwb", response.iterator().next().tags().get("b")); + Assertions.assertEquals("r", response.iterator().next().sku().name()); + Assertions.assertEquals("xpvgo", response.iterator().next().sku().tier()); + Assertions.assertEquals("udxytlmoyrx", response.iterator().next().managedResourceGroupId()); + Assertions.assertEquals("ck", response.iterator().next().uiDefinitionUri()); + Assertions.assertEquals(PublicNetworkAccess.ENABLED, response.iterator().next().publicNetworkAccess()); + Assertions.assertEquals(RequiredNsgRules.NO_AZURE_SERVICE_RULES, response.iterator().next().requiredNsgRules()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesListMockTests.java b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesListMockTests.java new file mode 100644 index 000000000000..e4eaa32a4a04 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/java/com/azure/resourcemanager/databricks/generated/WorkspacesListMockTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.databricks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.databricks.AzureDatabricksManager; +import com.azure.resourcemanager.databricks.models.PublicNetworkAccess; +import com.azure.resourcemanager.databricks.models.RequiredNsgRules; +import com.azure.resourcemanager.databricks.models.Workspace; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class WorkspacesListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"managedResourceGroupId\":\"hzceuojgjrwjue\",\"parameters\":{},\"provisioningState\":\"Creating\",\"uiDefinitionUri\":\"qwgxhniskx\",\"authorizations\":[],\"createdBy\":{\"oid\":\"f51bdbd7-d603-44f1-bea7-3f978c6ff421\",\"puid\":\"gklwn\",\"applicationId\":\"89dee801-3f6e-423d-b143-1dfffa9cc2d4\"},\"updatedBy\":{\"oid\":\"b7013ef0-34ea-4e55-a7b7-e6531b3d6b19\",\"puid\":\"auwhvylwzbtdhx\",\"applicationId\":\"7dc283ad-32a6-40a3-a975-8b0a6ec69c1f\"},\"createdDateTime\":\"2021-01-21T23:49:51Z\",\"workspaceId\":\"mpowuwpr\",\"workspaceUrl\":\"lve\",\"storageAccountIdentity\":{\"principalId\":\"e28f7b89-5f44-4624-93ec-252384aaa981\",\"tenantId\":\"2c33366e-0625-4f1a-af5c-fa910e67f661\",\"type\":\"j\"},\"managedDiskIdentity\":{\"principalId\":\"8a5e180e-1ad9-4a42-aa85-c55ef8c0c157\",\"tenantId\":\"9e042c7e-8a91-4ef5-b395-26c85c41888b\",\"type\":\"obbc\"},\"diskEncryptionSetId\":\"s\",\"encryption\":{},\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Disabled\",\"requiredNsgRules\":\"AllRules\"},\"sku\":{\"name\":\"pbewtghfgblcgwx\",\"tier\":\"lvqhjkbegibtnmx\"},\"location\":\"bwwaloa\",\"tags\":{\"gwyzm\":\"gwrtzju\",\"mtsavjcbpwxqp\":\"txon\",\"yvxqtayriwwroy\":\"rknftguvriuhprwm\"},\"id\":\"bexrmcq\",\"name\":\"bycnojvkn\",\"type\":\"e\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + AzureDatabricksManager manager = + AzureDatabricksManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.workspaces().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("bwwaloa", response.iterator().next().location()); + Assertions.assertEquals("gwrtzju", response.iterator().next().tags().get("gwyzm")); + Assertions.assertEquals("pbewtghfgblcgwx", response.iterator().next().sku().name()); + Assertions.assertEquals("lvqhjkbegibtnmx", response.iterator().next().sku().tier()); + Assertions.assertEquals("hzceuojgjrwjue", response.iterator().next().managedResourceGroupId()); + Assertions.assertEquals("qwgxhniskx", response.iterator().next().uiDefinitionUri()); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, response.iterator().next().publicNetworkAccess()); + Assertions.assertEquals(RequiredNsgRules.ALL_RULES, response.iterator().next().requiredNsgRules()); + } +} diff --git a/sdk/databricks/azure-resourcemanager-databricks/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/sdk/databricks/azure-resourcemanager-databricks/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000000..1f0955d450f0 --- /dev/null +++ b/sdk/databricks/azure-resourcemanager-databricks/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline diff --git a/sdk/databricks/test-resources.bicep b/sdk/databricks/test-resources.bicep new file mode 100644 index 000000000000..2250946806c0 --- /dev/null +++ b/sdk/databricks/test-resources.bicep @@ -0,0 +1,27 @@ +@description('The tenant id to which the application and resources belong.') +param tenantId string = '72f988bf-86f1-41af-91ab-2d7cd011db47' + +@description('The client id of the service principal used to run tests.') +param testApplicationId string + +@description('This is the object id of the service principal used to run tests.') +param testApplicationOid string + +@description('The application client secret used to run tests.') +param testApplicationSecret string + +var contributorRoleId = '/subscriptions/${subscription().subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c' + +resource contributorRoleId_name 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + name: guid('contributorRoleId${resourceGroup().name}') + properties: { + roleDefinitionId: contributorRoleId + principalId: testApplicationOid + } +} + +output AZURE_TENANT_ID string = tenantId +output AZURE_CLIENT_ID string = testApplicationId +output AZURE_CLIENT_SECRET string = testApplicationSecret +output AZURE_SUBSCRIPTION_ID string = subscription().subscriptionId +output AZURE_RESOURCE_GROUP_NAME string = resourceGroup().name diff --git a/sdk/databricks/tests.mgmt.yml b/sdk/databricks/tests.mgmt.yml new file mode 100644 index 000000000000..320750245f01 --- /dev/null +++ b/sdk/databricks/tests.mgmt.yml @@ -0,0 +1,16 @@ +trigger: none + +pr: none + +stages: + - template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml + parameters: + ServiceDirectory: databricks + Artifacts: + - name: azure-resourcemanager-databricks + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdatabricks + Clouds: 'Public' + # Only run tests on Windows to save cost. + MatrixFilters: + - pool=.*(win).* diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/src/main/java/com/azure/messaging/eventhubs/checkpointstore/jedis/ClientConstants.java b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/src/main/java/com/azure/messaging/eventhubs/checkpointstore/jedis/ClientConstants.java new file mode 100644 index 000000000000..2b5481045acb --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-jedis/src/main/java/com/azure/messaging/eventhubs/checkpointstore/jedis/ClientConstants.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.checkpointstore.jedis; + +/** + * Constants used for logging context. + * They are in sync with azure-core-amqp, but duplicate to minimize dependency. + * + * @see ClientConstants.java + */ +class ClientConstants { + static final String CONSUMER_GROUP_KEY = "consumerGroup"; + static final String ENTITY_NAME_KEY = "entityName"; + static final String HOSTNAME_KEY = "hostName"; +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientCheckpointing.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientCheckpointing.java new file mode 100644 index 000000000000..8583665a724f --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorClientCheckpointing.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.credential.TokenCredential; +import com.azure.identity.DefaultAzureCredentialBuilder; +import com.azure.messaging.eventhubs.models.ErrorContext; +import com.azure.messaging.eventhubs.models.EventBatchContext; +import com.azure.messaging.eventhubs.models.EventContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.Duration; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; + +/** + * Sample code to demonstrate checkpointing after processing some number of events. + */ +public class EventProcessorClientCheckpointing { + private static final Logger LOGGER = LoggerFactory.getLogger(EventProcessorClientSample.class); + private static final int NUMBER_OF_EVENTS_BEFORE_CHECKPOINTING = 200; + private static final int MAX_BATCH_SIZE = 50; + private static final Map SAMPLE_PARTITION_PROCESSOR_MAP = new HashMap<>(); + + /** + * @param args The input arguments to this executable. + * + * @throws Exception If there are any errors while running the {@link EventProcessorClient}. + */ + public static void main(String[] args) throws Exception { + // This error handler logs the error that occurred and keeps the processor running. If the error occurred in + // a specific partition and had to be closed, the ownership of the partition will be given up and will allow + // other processors to claim ownership of the partition. + Consumer processError = errorContext -> { + LOGGER.error("Error while processing {}, {}, {}, {}", errorContext.getPartitionContext().getEventHubName(), + errorContext.getPartitionContext().getConsumerGroup(), + errorContext.getPartitionContext().getPartitionId(), + errorContext.getThrowable().getMessage()); + }; + + // The credential used is DefaultAzureCredential because it combines commonly used credentials + // in deployment and development and chooses the credential to used based on its running environment. + // More information can be found at: https://learn.microsoft.com/java/api/overview/azure/identity-readme + TokenCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); + + // Create an EventProcessorClient that processes 50 events in a batch or waits up to a maximum of 30 seconds + // before processing any available events up to that point. The batch could be empty if no events are received + // within that 30 seconds window. + // + // "<>" will look similar to "{your-namespace}.servicebus.windows.net" + // "<>" will be the name of the Event Hub instance you created inside the Event Hubs namespace. + EventProcessorClient eventProcessorClient = new EventProcessorClientBuilder() + .consumerGroup(EventHubClientBuilder.DEFAULT_CONSUMER_GROUP_NAME) + .credential("<>", "<>", + tokenCredential) + .processEventBatch( + batchContext -> onEventBatchReceived(batchContext, NUMBER_OF_EVENTS_BEFORE_CHECKPOINTING), + MAX_BATCH_SIZE, Duration.ofSeconds(30)) + .processError(processError) + .checkpointStore(new SampleCheckpointStore()) + .buildEventProcessorClient(); + + System.out.println("Starting event processor"); + eventProcessorClient.start(); + + // Continue to perform other tasks while the processor is running in the background. + // + // eventProcessorClient.start() is a non-blocking call, the program will proceed to the next line of code after + // setting up and starting the processor. + Thread.sleep(TimeUnit.MINUTES.toMillis(10)); + + System.out.println("Stopping event processor"); + + eventProcessorClient.stop(); + + System.out.println("Exiting process"); + } + + /** + * Creates or gets and delegates a {@link SamplePartitionProcessor} to take care of processing and updating the + * checkpoint if needed. + * + * @param batchContext Events to process. + * @param numberOfEventsBeforeCheckpointing Number of events to process before checkpointing. + */ + private static void onEventBatchReceived(EventBatchContext batchContext, int numberOfEventsBeforeCheckpointing) { + final String partitionId = batchContext.getPartitionContext().getPartitionId(); + + final SamplePartitionProcessor samplePartitionProcessor = SAMPLE_PARTITION_PROCESSOR_MAP.computeIfAbsent( + partitionId, key -> new SamplePartitionProcessor(key, numberOfEventsBeforeCheckpointing)); + + samplePartitionProcessor.processEventBatch(batchContext); + } + + /** + * Class keeps track of the number of events processed for each partition and checkpoints when at least + * {@code numberOfEventsBeforeCheckpointing} has been processed. + * + * In practice, only {@link #processEvent(EventContext)} OR {@link #processEventBatch(EventBatchContext)} will be + * used. + */ + private static final class SamplePartitionProcessor { + private final Logger logger; + private final String partitionId; + private final int numberOfEventsBeforeCheckpointing; + + private int eventsProcessed; + + private SamplePartitionProcessor(String partitionId, int numberOfEventsBeforeCheckpointing) { + this.partitionId = partitionId; + this.numberOfEventsBeforeCheckpointing = numberOfEventsBeforeCheckpointing; + + final String loggerName = SamplePartitionProcessor.class + partitionId; + this.logger = LoggerFactory.getLogger(loggerName); + } + + /** + * Processes some events and checkpointing after at least {@link #numberOfEventsBeforeCheckpointing} events have + * been processed. + * + * @param eventBatchContext Batch of events to process. + */ + private void processEventBatch(EventBatchContext eventBatchContext) { + + // There's nothing to process. + if (eventBatchContext.getEvents().isEmpty()) { + return; + } + + final String partitionId = eventBatchContext.getPartitionContext().getPartitionId(); + + for (EventData event : eventBatchContext.getEvents()) { + logger.info("Processing event: Partition id = {}; sequence number = {}; body = {}", + partitionId, event.getSequenceNumber(), event.getBodyAsString()); + } + + eventsProcessed = eventsProcessed + eventBatchContext.getEvents().size(); + + // We have processed at least the minimum number of events. If so, then checkpoint and reset the counter. + if (eventsProcessed >= numberOfEventsBeforeCheckpointing) { + eventBatchContext.updateCheckpoint(); + + eventsProcessed = 0; + } + } + + /** + * Processes an event and checkpoints if {@link #numberOfEventsBeforeCheckpointing} events have been processed. + * + * @param eventContext Event to process. + */ + private void processEvent(EventContext eventContext) { + + final EventData event = eventContext.getEventData(); + + logger.info("Processing event: Partition id = {}; sequence number = {}; body = {}", + partitionId, event.getSequenceNumber(), event.getBodyAsString()); + + // We have processed the number of events required. If so, then checkpoint and reset the counter. + if (++eventsProcessed % numberOfEventsBeforeCheckpointing == 0) { + eventContext.updateCheckpoint(); + + eventsProcessed = 0; + } + } + } +} + diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/instrumentation/EventHubsTracerTests.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/instrumentation/EventHubsTracerTests.java new file mode 100644 index 000000000000..c055307dd963 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/instrumentation/EventHubsTracerTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.implementation.instrumentation; + +import com.azure.core.amqp.exception.AmqpErrorCondition; +import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.util.Context; +import com.azure.core.util.tracing.Tracer; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.ArgumentMatchers.same; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class EventHubsTracerTests { + @Test + public void testSpanEndNoError() { + Tracer inner = mock(Tracer.class); + when(inner.isEnabled()).thenReturn(true); + + EventHubsTracer tracer = new EventHubsTracer(inner, "fqdn", "entityPath"); + tracer.endSpan(null, Context.NONE, null); + + verify(inner, times(1)).end(isNull(), isNull(), same(Context.NONE)); + } + + @Test + public void testSpanEndNoErrorAndScope() { + Tracer inner = mock(Tracer.class); + when(inner.isEnabled()).thenReturn(true); + + EventHubsTracer tracer = new EventHubsTracer(inner, "fqdn", "entityPath"); + AtomicBoolean closed = new AtomicBoolean(); + tracer.endSpan(null, Context.NONE, () -> closed.set(true)); + + verify(inner, times(1)).end(isNull(), isNull(), same(Context.NONE)); + assertTrue(closed.get()); + } + + @ParameterizedTest + @MethodSource("getAmqpException") + public void testSpanEndException(Exception amqpException, String expectedStatus) { + Tracer inner = mock(Tracer.class); + when(inner.isEnabled()).thenReturn(true); + + EventHubsTracer tracer = new EventHubsTracer(inner, "fqdn", "entityPath"); + + tracer.endSpan(amqpException, Context.NONE, null); + + verify(inner, times(1)).end(eq(expectedStatus), eq(amqpException), same(Context.NONE)); + } + + public static Stream getAmqpException() { + return Stream.of( + Arguments.of(new RuntimeException("foo"), null), + Arguments.of(new AmqpException(false, "foo", null, null), null), + Arguments.of(new AmqpException(false, AmqpErrorCondition.NOT_FOUND, "foo", null), AmqpErrorCondition.NOT_FOUND.getErrorCondition()), + Arguments.of(new AmqpException(false, AmqpErrorCondition.TIMEOUT_ERROR, "", null), AmqpErrorCondition.TIMEOUT_ERROR.getErrorCondition()), + Arguments.of(new AmqpException(false, AmqpErrorCondition.SERVER_BUSY_ERROR, null, new RuntimeException("foo"), null), AmqpErrorCondition.SERVER_BUSY_ERROR.getErrorCondition())); + } +} diff --git a/sdk/formrecognizer/azure-ai-formrecognizer/assets.json b/sdk/formrecognizer/azure-ai-formrecognizer/assets.json new file mode 100644 index 000000000000..ac92d8d6b29e --- /dev/null +++ b/sdk/formrecognizer/azure-ai-formrecognizer/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "java", + "TagPrefix": "java/formrecognizer/azure-ai-formrecognizer", + "Tag": "java/formrecognizer/azure-ai-formrecognizer_3f1f6482b8" +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/doc-files/DefaultAzureCredentialAuthFlow.png b/sdk/identity/azure-identity/src/main/java/com/azure/identity/doc-files/DefaultAzureCredentialAuthFlow.png new file mode 100644 index 0000000000000000000000000000000000000000..0a72eb0a925f4127c4024685ce8377fc282a67e7 GIT binary patch literal 36482 zcmeFZXH=8V7B@;21raQOpcD%tT|q$UMNvR{4WS4aT1WsXp(CK6R2AvcrFTd|2~`B7 z_XHA(f^-7XLJ5!?|EJy~=YG0h-gh0=3Yk35v-iyG*|W>+U-DK*>oFre2R#J^1*6)N zhk6tgw5Ajklwzk(k*_d_f?Fvl=tUh=RCLr-RCsh=INLfnfhZ`Ryp4;eGq|+C+R>DR zk3w$OZBOB-hJ0f!9)ZSlTIn@dbk3hq<;i;UM4#$HVX!X$1%~V4uX!?F()M0gQheJ& zm7ia)bU|~o&v&7L^Z>TDKCwR^0Gr3T5tt|n-oJmxOt(eJ+^;q7C4(KH3JG?oVW*(v zS3ITM{Ho=tdO2a+o%+pjPatOKawW$gXD`Bn6hLZHf60>em4<>|>3&+=*T~0S6jp+^ zRDA3diIL@grZ2v5tndhZQ#$o<3>tL<^S~vl75!jsi^I|x_^OJsIhOsb)=i49%Ad6~ zK&sdM-|#V`t*WxdPiylywM1H%Q}C!=FFw!R1c^#zHc~?K@kG*OgdOGB{hU4s^Iz(J z_Aubb&hCLwVN7FMNMoi*Z~S>S&UUMtVO7WdW!nn3J~Y!U zQpBjvtS|M64TxO>*&BAwRR9jS~)xEUIpp>z9!wFfPZ)ULjV& zNW*pxo78fpvCB@kkj%c9aH05?b2fS95%;fZoz06D@9_S9x#qbUSLsz473_>ua7uea zTkJ0}FS&YZ`OE$73*R+1diNss&L5r)c-{P1=Vsys+0#N_JeAL9Mh|G#XeQn&X5N3> z_0TO#^loTPiixTduLZ9bvt{g)n-4ym>5RCf*>x-Kz1I8E*jsAr->9BTR0=CmPFS?_C+GL+U1i)?#zjKz$@Ovl%<@P3Wc>WON1csF^qG-Ths;vK!&z$?xhqjBzu zh`O4_19jdfaT@0DlM`6uksqSpi@a~VEyt%4SMly`JpcRJn_H2$9#-YH4R+c4!)XC( z0KV}{;~e8k<17zA4-{&z)=Jhs-hAj?=l9C*tzX$;aByTWN;zIR;tTbo;Opjh)i>T) zH_cRjsMLEoWRatl0|4oQ?B>qSvCf@g2@lUv&r&bxGB+$1Fqbge$zOiQQEZ#fnqySp z3FI`A(u*-tD3mV_8oV?33_Ri(3H~5aBB3t;>)Vz}zEinB&hj z`4{u_^R{%16)}&b9#;c*dWZM zsKCK~#Wm72YCe)BQYES=vSTUOUEAl{QQevLukFthI=y3IxvIIHxp|s_Qp5KmB*2m> zlNt5b{8T1G`Q0A4g?dLlzy#Z#cid>8#pt0wSOLKMU)86=L59u}HYJXnHvV4@UPnbU zcH~alj-y9B!yqx7U44Th)6fBn=BfV1FUJ)jpHx1pM6?EHXWHc2#9VCe99_y7uBrMc zK3v=B-O@G&3e!jz93SmKeA#)Ml6mB3gTIDkh13PRwj8(Yv_zz=N^wrz0v=n(4g`6~Ifw4L@VqHT6oWwyV9cC2Ex5i*1us%GTN=ljX)a#8al z6Q78S*@GQ5ouT>9rO%aqYJ2fK;+;$R*l7?k(lt`;aO_|=v_Cw)M2#CouH)omf4tjJ zxg{N&G@innf{+2f2-}HHP95kgPi;W`gw3rb_j&d}Cp0HGQN)F-sh?&(N%>L{+!xg6 zY!|frXZJKUxU{+Woc+qirwh=sDzH-sJ-+XW-Em)MKS)AXh1(Tj3-J4#Ivs@Q*M0d~P-7j;uLlWk4U@K$ zcm;=}5f=-B-yCfw!y~r0Y;K~Z7F{*)vDg9ezz3U~2J7glFk`B+3H;XbmHK6$odbz5 zu<=0&QPfny!L#$^kwYFcH>?dn2Ig-Q@hH1D~n_pYQ?zwHU?T&4K|AQVzIo!6>f%liKxc&O+ zy}%-$%*~nAb)zOGAsUgVO+V|+{0;X^S3O#QvDVo37e zk9yRxbQ58fF@@YHh1!5*lPF7b&1Wu`(@QAm&)mOG_0pJ;LMND+c<+^0q2|gIo+*&J zb1~3WniPaNnzUo5)Cs#e?L;y0-fW8c<%KWxPwrn|wWiJB-A>q3Q9FO&v(oUDnMr-3 zs!kgGvM2UTbKbO(aRQr>v9UTua}u?VN%R=&0=r36N#IU&@ii`5as+7vGEuYD)T9s~w@*`0hB;8skXw}G7YF%8K|%c?l!A`@ zeu4aYm_hZAyR@bm)c*awC9}df7?`-5Xg-y; zafXOkJ$JSSiFiR=ev?qhdP$R;5RkhSj~B!V>L%?acm1y?q{;2ymqoAh{Pl=CSnj%s zrVfva^9vAcXIM4x$E}s?k>`zqA(at1ST%x{K8K3 z?t=#pMDK`+iiru6pAdHQhPqpM2}9j({Ef*!_&fx;*}QOYad&Wr^8Ds&W$oH?bd&i8oGgAs5nE&eY(s4Yia&Y{O>paPADt- zd+PrtioePEud8H1%hSt>{&Ugf=`Vd@JV!yHNTK#n$-s+pb&~EA%jiC7!%nb#d&>8* zqM}m8vyLenp}WYh(0h(gNql#Y18xm|y&N^4r)s0N${~3BI{lOPQ@+j&8g~2)xZ?$1 zPrF*wgm406cP-$YC}B!wr^k1`Z^C;%N!+!z^fE0a4YMM}3ID$5)6T^BJXL*o(#_x3 zeo@hwjx(Q3OcC^gp4ncQk0<-aOA4yfJb(Tp)1LYt?O$^LpRE2vLH?&3|J;-R(~bWh zb>nR&O$2Mh^9Z&hLHNb>^NJKfrh<1?Urhr#qU}bpb9OD{OaE_6n6XOrnyQ4O#JQ=v z#Ii}SOP)6Lw>@;sXofqJbg2`(=td8&DM!Kn=-zRg}q_)%kCW7{8dmaret6cYAw+0XJw7~-Re%P(f#xx1s zd;05#XyAU5gU^k}$IYIrW1Q|tdH=d`fL*FR#xn3NFYg?LV+EaqWidX?f0j5PCFkpj zl$zR$aIo+Rob+IOO+Y4zvtjYoBs7=*c7XoC-r(bO!I7rLu=6*ftNGIQYR!F?CgVTo zVYE?;cd{RA{~A7;TwmiK5zJrElro3zPHZ(OAB6{))V@eH_urv@B*VSo{p))p(tU}; zmvod@{3s%q_J}31aVFfiVbFJ74%9?Cs*-dZ@tRiP%}MiE9zlnmU0T4XwTABa?`ENC zFS909Me#PQA%dNV|Ru?&pRcaXa}hwt9`nLK#yaYZEzyFAVEraEC2?8yl%( zx4W;eTc=?r+^rZoDcuPCm1mAJY5}qh6x(6U+#35cM)vw;x9XzU#XFC8${rtib)^~V z@^~x`P}0sWMJ?xNdCP5l?QU!eWl*<|cfyo%($iWi?0wfrNbnB3Wq-or%aWm>9`MLH52c&=4z#a+05>IVd7gE z*bj|9TtnF$c1$16LsxLsDS>5*GAD&vJd!l_*%IOC;S}d+0-|;{8mxY{lC`7~x}~uH z^IGE;7E$oXH(|dj*KOKgYEKBWkRB*ABdN@C+Hjz56@T9Gw|IX)GL^{78CH1 z%`9NKpdNTY+V6+?m(g+87x1*+zbxq$6%pa4$?$1bLBy=)`l8tkSXp_>_^y3r=GUO5 zwabyJB?cmz=m^$X@>{5J@M+Ii){6}wyP^;fiuZ>64~4f%P}fpV)#jz z0u0}kw(8uJE(VH*Ox9(8$+et#_0h2S7Dwa0ZEiv5%j#(^e9EQ!gfaQHs2Nm$O7%!n z=+r@3SOV>ea@h*TStPOj-L;Or-KN92i$?J~26wJIpA=GNDQD;mQ@XO+@XLR*T?}^E`(^Mddn_eEaJkqByR*<1` z*Vz=|xJJDFZoI}-g=E3BI7G^jC5&mW_K0hrl|R5-ajqX}JoZUGI=}>0!KS<`b(%H< z_U2Onjhe=^rl8L+*J@m+>%vS^EvM8Hq#L0>jNk2SbXab;vhJ3bjEvmFT>Wxw+6ekC zRn}?jhbIJ43Ps_iXtz)Y%M7cTVbG0qZ3X{C=R&2VuTm4g#Pwro9odZVoq8wE*D^yV zLn7f07*SSH=Mm#H4X;txOqK4aW-mNulJ}}I_rC2w!7%Sc#5cRoj* z`S~bOyzhQXY5j}OQwKvum>*#lw38PuTv&boc+I1A5*)bKy0u2wZ*8S(y^3F<wgZ|}~gB;mz zU$QSDU`ICT-B-uZc6qkXufpp*RzBuuhFL|iZ)NqT)vuI>O_t!RR+GUZcMwb*rlIFJ zO>)nU54fU>#}^d@m@nVs&Zy)61~6Tks7*cE&QsV{>KqCc29ricN+i8EopyB!hUv{d zQc9B@2oT}e5ctFpkmmt!T~aaZR-)1^?#34bMN{Bvn@vD+f8NSTp z-1xZ!g>t)e|4FF?7t)awYw|hn6W2-mr6hTerP65Eb1MY+B!P2)!yYn6)zf`DfOjCS zibP7|ViUWq1yQ$_?sK$Cz1F9Mkz24vw^Bw<=?oox>b7%cpx1#3MEbX zNBJ@+a=NPe8?781!nhyCrKaMmq}<$Et22nR+zTMtW3u4|xZp^GLTv;*Y8BQ*L~-x* z$&|?@tL?eEU-4TM-h3=~P0CtJE4pEKimkEWbil%wL%F)4U(H z)&KzGp1;0l1{XR_)%P})>F2F#s$GigIdRwBGqH@FXhc2JY z1CO*PiB(VWAzEZBEXDus)2G#RFH8HIyP1YXwz&kwbgvnZ?~m88L*lbUyR`in7DlxH zE@}ZV(6?CUQ9xMC?oSFX9?lc}#q?>&&jTD_pCkrCfE^>(TH6Ft_kSwB7ah*{4i57QxSX# zU4}MXGH$9Hrn_Sqcyy77X`0&YF6-%)S+8%mdr=s|b;=O#N1hTfOvRx-LR3CGW0&k0 z`MtR7AFLE#WS}Y`?sAv!PLsY!dpO$hrQZ7{Qv37iuJrxO@Qhx}TsJ29I4u66)_vrd zVo|8RTrluZr6c0!(QofUr?5K_8*^EcX;Cl3kSUs;i-xr{%{1);Rf$p+vSsDG_zTXD zIYoMKMziU=ByF`>Ff#yrbV*p@c!Lpouz_y$2m5Zc!5Dm|VbhGcl0g2G6mL+Jc>(%Z zw1(S%Fe||<3I=EjFn$==3szzr9`dYdP6Ln~v$dxK)7AU-*spqe%k8UT2B5ax)p0P9 zzYFeOz< z1)?!u_{0O4(+@L$2VrLX250_dT>rggt?^P3{Qo(9vc2H2bJaC@RQT#-37vje{ab%a z=Tu>k0?w0%@p~TR981?k;lFcfAdfWP@{s}azmM-qkXv547jZa;K#0 z=yTks#_<;~+zP7%dQcp+%e>0UNaBk#{x|>EluP99FDb429~NMFn#+|4t~;>zf-f=H-eItjg2kD z&!F}?P2~$Q$Z#5-fH@ObT@>9gp|vJffBn`Kmf>#}^8I2{dnjI{qeG{;G|((nT35F$ zvFM>E60|;Ula$`%@Sunlu*oacHgR3Y>JL%ok5i2fxi>f2H8|i1_)1nr={iNQN^r4+ z?-fChr3i!Aibv0Rhz1#n;EPpdDLD{VN zn~Go`)w($jd?I0Ik@P2!aZ1ET^lc7$Ki{Ivs7PsdF$vR@Ne4- zb@~1nRDRCyUEoTi2wt*nwm!)hkS&Hc4Ov6o%uD%CN+tdp5|0>J&(YshLH2+2@Q<^N zGtBlNnSXrv&!@Whe{X6{2z-8i-qh1JnwW0h_ejWpTUf9f7tM&$;4Y^R)sd4d8#AJH z3-@EKeQ;0se68t{&GQGCv(>2!HIPQ>?k>2$BxI*=xtMC}4S8C{AaSz}IV;gmqcEf$dk1fTE0mODsLMorp$julZX*X5j3SmJc z4iRJSGBTVWd7dpA=pe3OW}k38a~3?2YX$1bGSb?r=evdL^ADqsZ-C)KJ&mU0JtyCC z3h`$Sc)Sa?5?JX4>!ZgPy@9JZ63hqG8@zOaah5Rp9Y8zAiz!r;&AyaG*LYCl8bD1F>Zr1E4L7lbA89G9A&k2N#lunzHo#Ys5|Myr)Sfg=oU}B!t-I{^-8;r zlFGXb!>es6bU^d^A}6^!H~v%N%!(PZRDs7fCCoaV7Q zjXh;P*0KEgCNP@8)c;`NjJ%-ajiYzYM7VCzDfwsjzptjTvT?IXM<}l|)!}L-%Az8M zg@`&x#M3co4)NZ&3Zr7QB#) z{Zi2l!PS|gK~H>f4G-iNSqL85SPS6Z96eCnH&()hvX0;n1d!Z(OkXtI6i+x)@3(9U z6thC$C*U2)HNZnu`ambZW2?K)xr36pSzCa%duTizIJ(U!|IEAz5Y8$6&Vfz-epd6t z^v7~{2eAZ4tBtoC@paFO%KE)`Q>{Dsp%$gjKXb#!`vSH$A@Pm=O^9W5k5Bs0XdM@3 zYFD&-lSsL*&yz7vwI+u``AY^y9JzhrAhx{eW94ScGX!(@Y9XrgoZ&1YttfE!f#*gA zWHtGs^w`HZnN?@YVt9)7(sQ=6PWpFBNKXOI+%>LTsO8HFhw*ZBcz&sg=a_r1yIjqa z$0qGOw~pvl1vYQt5ZuH~DKNf@)&bd9GJ9OQ6b;nEJMry0t%dpZ)4rN^^^l&@1g~b5 zcn%;WWb*ZGPz%Lt=mx{1;DR_wXV8Y0X+#a+%-n?u9fWzsX}ZGtJ7J>EepJ+S&vq^u*OI%15-kD>Y}w z`a-ZtRB>+d=GMd0mO85kgVZ&uN1))6Psk~0ZXDVt9or@;G-1tsxPBkkB-3hIL$GG~ zW+r2&-*WF>Usjos=~3>E-#Y}n&f#m^Fb21mkc*p2rStoKU;M@}oe;w;y5pW60iG&?kO-WdTAk!uwRe&^$F#eU;5+xQ5=M=;~Ok70LgnhGjy$NHdnS z%H?Svm#xTURKG*}(c5Bg%OE4SQ8Ptx)5*or*E3ZM!#i^4B zBV%y{%w0jJat0@X(}geXbhe+BV9YWkTFjs7=osOfEw*ADL@p=WhR8^5koZJ!P|V@9 zI}R>*<1+pY=CQnmb$^Vd4QI+|70%2PpB5?P`@MIc(7RdxtRxrZvm(#^TrSU21H3FE z`_z+icqJ_bTChJX++9CBAz4JR83M)fdtC72sV>Cj%USTD;t-T z(g;cKbxlG-eBkA7Yg}un)OT{tQq>tCPA{mag5R%&@aZ)3cTuQ73?;XpQLYP0-n(UW zZY}6}p*~&0wc@4qY5!){Nb~cNYhnGei6A~pg|Rv&{342}vD`V}C2HGa*x?y2*kNP- z2{{JjGSj6H6O_Tw$;7x(4&{|8py{-^r4=yHKyM^dsX*&?VJ7~Fh#;T8tcs;B6yxwA zMX*n4n42vm{{}1p)#DVUPz=^rz^jRv6lN>|hb703Zuss&GXvx67&v_HqsyV1cu~w* z7hk$6!Dwgag(J|1quHWSPxSz!qIU1KcBOzurkdUKzDcJTKls;UagT_1o%L~< zzPMpvyTuIiSo6}WzQ--LwDNItK3@!}{bMN{!LQ<&4ghcxDtT)8o@d=yTMT@!n3$bl-J^A^FGVxZJq?LXrUe_rl__%Kj$SqpE?)#>Su>f=KV_`X3^ zPnn_!v|}mUJVPa`OSsM8N6W}Dgc^tGrM+UzZBe2G-1nFKBCJ`0nz?kvhTn?Pw9f@~Xng4tMrEiCtHw-iB>rD=A#vy8M<0;*EEmMowHNJMwlCc@sydbVh)c~QmR?!{JYDnM|Cee~ts~6y=&)B_ zr+CdV`kGnii=_9C=?KH!dHFpv_r%TOl&s;xl61^Z=joEkN3Z+m7a%cJ=r!crqu{Jm zGlHW(n+txtF34HI5K<{1xNTD{w=B^nq2kgk0nWtj8crp9?q$7_2Opm6{Ss)5tn(-y zDl=ChaUANF8-joVqzvC*g_0m(P2|MLB;AcPSOP15%X6n znv>Mtm$nU-V74$BLjBaS|DeKnQkeLfG7+@e%fQ1=6gMjv=2=JL2Lc>lC<2m&r6o2} zSze7&*TriC?0RJ+H^vKER5H5sq-fO*gPTi8I-v?(59PMdR=F>ipJOamK4a`qk=O%T z_QD&``+e2598kS3M?+WF@*Ck?J~=&TmeS6bat=g4H29q`(Ea7C@` zNYCRBwqVwiORiNc?TSClt6K4Q0S64fbJCG>QOBn&|Iq7t&d7x}jIWdM1mp@_VRa&u zfsQT;fx!uyK8GwvNA@WR&f>J`hDLRsMk*SmzPI%N;lVlnkKHBYzN&YREPNDci)LN8 zjwqR+E+5$r!bUO*)7Qs?_EkE599dDytu9+(8Vl418Vf584M!{-?FXsLl)Kse&C4f1 zY9sX7m&Z;F*LkiaNyxVN$i5roX9 z35z_5Ws{|s3gHydf6>68$mIfXbtv-OqZ8$KGk`=!*KFJ`S{Iv}F^^Bfa+{OG$&#en zmKSEe@4Ge)a5)dgAD}D2;^~kFfjwfl1*$L)y$J|OB-@P~2x~Hx4yhE4$QO16U|zk% z%8edkx9y>tW_MtN#-(W*LuOaulB+~cd zhp?7syFo%JO;$0JzFM%AWwfr&C3iy#Bc{TkI|Wd#WX!7^oS96iH$H1kArWFJIzFGm zw>X{oe#awd$T@z!{4T?g-xdwWdgon1$Z+Xd-)GOYS4MM#dSBqmj_Dv>0kd4?J7f8v z_$6%M(b3$IpClA8e}pIs!-hBPz(theH2iwUt2$;-+lW0hr~1`WSve`_Co9G)p4IJ9 zs5m>Z6Am5_4|$|h&V6e_n2*QdR#rEw=XVuQVLJ*%d4Y+B<;S^5whxhAXnV=MsEMkw>zAP}vE+9m+-*)_qy&tUlruG{?>5?bWWsx? zwg5kl78zT;;rBXJSeB8|Z63n6=QQO!owN`(QjaA#EKMiW9lp*rM=9JU>NC~q`4+VL z-m8j;fvi}n7;-fhm&r+Z<}k(g0TOmyif5&zT$#89>$P@tglMgHD2fJ#ra`g_-grgd z?cp54!AO0v-Q+>wU*^6G)h9*-2Ds65 zS^NL0PxJhdQ4bMG?6^VG&P; zR>p)~CYPa*@^B`3m>vhUMKG3{l2+obGxE zF0N16HwwIMn+V7Ih90{P%f3s~U8QdNI9L>B7zZ!TjAigIn=_Of`J@bp5ChF|A&)^O z$5~qdlud=4-&$FT(&mrIo~+idUlxvHra+wyz5p}pHuL^(FIqf7&5|&sV{)OU`5{xI zK*7;SYH7odhin-T6DhxjkEzLt%yv76<# zon2z0R&|Az4qNBqGvSz?ohw2c@NQw(<}*2rJ|jnY{zN7)4*J<+)eEhw9diCpoD1Rf zs~GrK>?Z1)wks2qp7l|X3g~6L!53Qk*e&kU2JZEm8c6Ii;EJE*N(KY*6;q|-XR#6C z3BQQGvH?3OOuj9lWMvPk#$os*AL$vCeBQp~)SUBl8hB}~MY*FU_f$Ao z8^KZ7CiKTF{_-6e95jyZ84~h$`&5q?Z))&gBW~IE_SYXh9B$24PGP@~b-2q#RUzQg z(kvQYG*(LzT{ScA_$;jE{?YzJ}(Y$@e{}iyVbW*}fH_MUz1=H2?i6f#=CU`o(kS*>H zEKv|vSZ6K>ZNzAbeRr+{+jo=#u9npZeAV1iOpUZ5vC1^{f4gzeW*zo9w!dl>j}x|& zYC(sa1ttNJrb7-120w2mvHqFZ=s<%6nBax&7^d2G(-CKD9HF%OC~T+`D!l6$i9hpv z?s;7^(Fj)q&hfYVo`Y`i#*A5H9AY~poUA=c8@tby0KkBPf_UFw&!S999RY7vow}!L zhtHLm%!vVrfFb?`V-1N!{uBEBq-gCbCx9Z#@l8W78fzop7Tv;iL5egXZhDS+iVdHA z8f#ysL^pLwOW_T&nJ@U9gMZ|fb4|5PpJcgM&q`v1~SE_;$VdR&-hR=^V&?Atf0;dUUcj@tD$*v1TjDnHDEAU=}BrkZf!Xb#?z#<=^W2 z#^`s!qs}&;?N15*R=2N_~4%dbza58b^%uAtc(v9O$w zLXbC0kUa~zf>r_!_4z}&|2KVdIpBY*|9`jgKRIhzG4U&PDg5N!bDGEHRrC2EbX$b{ zouj(d=*e&3YgXHd;1jZaQoKwyHdZ=||FxEUoy`7%aOlalf|BM7 z*%mT}DF0bn`&+Gx=K`7id;7aWCz~=JW>vDSx_s$RKl*p!zyED&A4XW6Y-uTi?vPDs zYsSETDW)^Oc}Qk|)AZ~KRnET~9QOo1AQ@f3IB-`p#|l zlc5NdG}nK#f6Ll>LbdC!9<9i0^S`D4&k*W=OHYQG{BPI)AH3_IL_U8O8pRo8)*VHL zyp|`o1I!qK*IDy&&y)w|JAmPb-TEm6pc83s+QQnO9^v4-yCRS<{i>p|R~2+L>o~qX znS3Z$Xt*+jXBy{?uh%Fr#D!$%cTVF!VD9--2dR(EpMjsMxqIw$N3c~Mcu=ZosW9cq zImR`saS=Bf<7PP$zk?f7Gw-XY^0i>aF{t3dkCl2osh!8l~WkR3dPw6Jx4eeXXMIavNF(MuK)< zB_)G|_pmR9!Gu~vv&n-1&ReNIscqHk`o(I+gm06zoh99YK=e>&JjxkXETS5RmT7bq z)VNQ$sv(aj+NyaJx=$J2ty;~|7joMK#y42K15F`WmC36>FMH6Pc{0-Kr#g93NYQI zZg#NtmR{a?#4uO&tsPU-?7Chd{%a3Rjj4AEuLqg2c}=9(VhEfQHmNCua-jB}150l$ zy=|<=fS5%<^J=q}hCTY*%nC-T=+)CG0h0^1=jW(u0f6`_Z~`a?QvF%KRDyQNQN44# z{F~VEmWGD?PpWsl$tGr#$^Ou|lq81-GB8uyW!oaRmWFt*!$%SzLsLR!LHx$Nvrq+y zLBoD(VrF@yKEn!BTue?dg~1EZ?%r>e($j%Gw3*Vz?M{WD8;70$zWVxB>_Ye*b4#xM7{n!-qR}xWl1gk8P%#w+;;IYNVkr z4|283qTWy{$t^VA{>8~iPUc^2++NGsYwHo4Tw4P?1RhI@T zF+&&Y#_x}6#7`iy*(uSLm7|3}#H2pg^&AJq`;GT^Atq$c7Mb~tDs29gun`vIi{Jt8 zl!cc|*smoskClVtN?fWT`po&~f^;LM;qCmwrz?%<0?zj7kMH&_S0nr5>o0~N6e_zM zMO2a|XaF(rOpUacVyPV^d*29kt7sF^2Ul2ugt~nifQ|p7c9Wyo53#}pnhb39UJu$G zxf<(|^rzj}i#rh_-vpv+K3>vr!ePal0wiR$B0YLPZRhgB?X}(^uC54Y8VW{qKlmx8 z_&C8vU{Jh}p#K&c_~@O44_XaAdb7YBJpKG>AAxbMkRu5FV#AR1ZA-5S@jRJ6|CmKr znGqfk|G8Jt>a@=_od;AzCOl$fdk0;v72B0WsbBJ*3TqJ$Enz1LAv&=y@lC4GJQjqG zqk0aY!3dg?ZmAnvj9hwNmb?V@fa*ZD?Aj5=JdJ7>yC)IjFLu}7c)wb0yC|G#g@-G1;s&7llWz`H+!c%gnc_dFBdDn?vdexM9tZ9SMHs<$|pzz z&(*pqKQ)u$sBpi?Oyfxg;;*$>i%b>K7cMvuRAvlk(ZSWqFgXb$737%ng@U$KP$f|1 zUZ`<#<*MVBJBydz7M>kIXPu_R)R@&7nP?dm*GS=7x}UQhf)enTkCO|Tm;?%oyhqLp z;F6ZY*xnTBW901fPx-}|m74(S5Xc%_!R&=tAz0w5-Tq38F~Y~(Xh2n{HTjp~eSG@N z2Z!wHV95v$xuhDJ-OEJ{GTn$s8q@B!j&J`Z#C*vfWQ3&pFY#r@CvyDRedgQZe<7wI z)BcyVK=Gfn*QiQ+pUEk{4kpJ{m-yb1i~czxlaAv_53K0M$smzk1$Q2CCsO!o4Xh(T zp{!VCd@i|oxe$bHDq7~^ic4v2M4Abf#7BRsb4tNa7#!1mS{*CL{l=o@ggb4;wWg-M zH+*oh^i_dv?U9A5EppCa%ei-a#dCaUWLw?jOIOP09!b>f3K<+G;C$<8?GOzzmm5y5 zV4E)PdVsL<(i-;1f~gQ+a@K`OxT!Zlpf1#MX=#*<1N`+ z4e~gPhV|@n5~hFJ%nCu=+%F(Zt+$(M36FJx*_rTVhl)C{ORnB}rFc2$)2dmMW#X^R zNM(PP0WTsZ9oKU7TKk)=fBiS6bfn|s%pW)Q%N^TK5ogBv<12QbjSWf)Yi%9DoX4*q z10Q*sNlA_NgVPymSdDWVB`~6H?NeV^Gh5fk>-x3rTC?B-eJq<6#H1|Z$Wyk<-dhXV z_>{nYfqOC3zF$&UIo>c?(H;|t6-W<{A9&L>=R^08{5+QWU2OeNk^7cHqMoks;)8}e zvmvkB&Si7`#^sfzr5nxMc|2TIW3%$bRS=ILDj+9QnCPm*uMq6#fxwQz&K|>lts+7* z2yoc%Yh9Uo*ffiWD`>%gki@5;dkar}K|^)Qe0HEDtw(3KB4BLeRhA{CZ`2GA?h$Gj zf|>#X->2@3NqH{m>uW}vE=&teuPro8L8$p;HxY6&P{Rt3+L`rf>~5Oqp-kpj5Lhjy zf8KcmdNE!#pv9p>mj;zrI$@=7uxkcH9sSx^MDVZpRqJeeufT}w9ei%B>C+CtfdhGy zJ_^-ES?~~1ArLtMhuY-$)!G-4^^n)zM@#4I;~L-pBI+$|{){@*jqUW@R@;|*S5~8OyD_U)u+;Hhj!{iGE8_=$ zNbqXMhYx!n9X^^5Q5e>n4cQG3O-i zm9vCrMU%00igJaCJRX+}M~&xxS2jhbfs51*QlCaTxul!&%q8Frqi!9Ydxvftt76BV zQO{+fCBwRk`y(Y#LcO#L?KS@P#UH_1i_d^hrFXAVA6#4gUWO8L!MX2%@ z6F))&FS?f^G59slx%pJbwMWq(qDv-2J?|VbsjIb~YW-ze`I5?Ry?^2-9Y+;U zZ|K)%T6na`Sil0ixqm9lq3_HVO8~n?O8pd6u0*4g!Hj{}xY=upTND{N`aaU1K%67kuF^}+V9)&UPv+24=GGy2tpUSMlaXi_Jwq% zxZ!`UGa>=pqDW1RA;0-=6>QrT&<@xgT66a+KVH6(*#m$y*yh+9%o3guKF|Uq8_NLw!$Sx(8 zN2Avx*T?|b1uA)7%;RATa={-rgAH3*4SraqU~Ww}L0JL9*m_Rn968NZuRun77~}EF z*-Koo@w@Tw64@^6aW2$m3<)Ig=MpXfJspw|MQzXpEi;cb_*NfnCN#k{L~6gP zMqaksS?26>7b+nqHOS5Bw+7XdbU|puTD(sjqe!cE^@2co-8cfDf5FfAT%FKuJey=4 z@My;zJegg~x!wrI(&aA_v;8{;1c^AOYRhplqA%5N^4YZLc1&>fMT;Z{#^jtahw7`` z*rEaA2Lk(nM1|8P2k@>(Dyc8G=4roto@d2xyff$SjeECIW+^^}RRmWu{_l=VmsbUJ zA^o_83Mj=lx?IaW(<{TpeyGQ~+{2WreT?TX@kN%;imZX7CXclqY1Z9yC4RY|kXq;d z#jz=H^)m||kn!>khq<>9VpyB>DS4czd3QhpJN$ujq6(N+Ot$-fqkiR;ywDq&dfg;YE8 zx4UBO-+SiFBLIaqA1jSLdi2hS)p&fO5650k+uavyniO0Ct`zU`n-@dY;{)DRUTsoO z3BC2%DwhPyB%NE98Lb5C2RaQ)Zz)+;_ll<1q2p^Hk39$-gBPU%3NTD~bhbcOyOB7h zV3S9+F>2i&a~N@}(e70sT-)TnXDumUX+~pF_%PW3#0AVF!IYFdkA9<==?KqFYGz$h z(t3}a6ElssMNPO1amj!yN7AT0yF9kBd|#mi(Z;~tYFK#D!OgfTT;2i_?wo6_n)LAl!B4 z$Ij43sq~>vk;`6tGo68EwqtZ_uMR4TqBlGS@RA!6SWG}YY2WKNE4B*5-KRc1XI^ zEnZ(im*C!0KO6vM;+VihQg2&>f7OM90RF0NNf;&1X_tw`WR%Xn%A{*H@*^F$-@vJJSMAv>yfP8?KLVyXA9)8F6_Oh5 zoAQNzt)ql=StQCbaT~317HhJ*ly?4ML<;3ZP(;As$tTD%0b3V^pbN>Io2h@ZufCq1})+}2p=A_b2f43)D zMc{<^2ty|6t;&m{H;We+rXgp{8}}z8&m_jkyx#4)7+pp*7Ly0AV1X#Xs+OO*nk`t_+oY?x9i-&&GEvo1Fitxu%FzboM6x}9cz=&yka&@)SZc1 zu&RGmUbGuPx~4~CTOD>a+;xSXhx-UarZdHV2~>t&-kPc#MuQ2C{zt>d2j3B4EuGOnoo($vP4$VrAST>si<+`Ru{Zt=xc;bVD-Qa;wH^kW7mTO3PJLc{j zBSuu#GkD7S8xx`9so*O_;7EjBR&pbK4e=QD`!rA~>8zF`FOjE2;vh@0)$x8Dx_>|{ zkguc2=RS6)QIu2r1JvZPuwfJ_Tgh)ZsKoVU?w@j%%z^EI^Re^a=ryy?WCs}ba;~V3fy)V)B7uRz)0x0Z;S?>^9n{R(J2=;xBMZyI!uMZ2U7hcZ`dS#RpGsO5cN&d_|OeTv$?fkX{$ z)SW`Kg&0_|KY9&yC;I)*yb#Ak47eqP*}=L#b(_IiFA!R2XX_zP_|AJ}=&@@gkkBBi z=uOk~F;qe82P$9WK58!?%FC2~uLS21GUl+_di^d@2>Y?%oCgD@w4mqsLt&G$?+-8t zn-MjybA^38{p@T$x>>Lc`399+v}h8^CVS&H)9Hn~2i2ZOzW!IHHY0XVb#@?$w|ulk zE<_h>*@0SCNFwdr{;1x~pSthb-&ncfA7jtmHaB@HcdB@qejxMoE$Ng@BoMpBnrdj4 z+eq@kVk99;&FA>rtGLyB@XS~IQLL$B!(`lP(xeuXW>`q)*^-r+!BJB`u^5O0+hE9o zH;XNXNY84S%@)`1h;N`}?(NJ6xD&e5BC%vii%hP>j zA9KVZWrt1c*OW4{(gVLkmX8-votr0BR%?OmjK7Ll7A-wMe|sac_2~LD zoKtAl2xB^Cz*EQCo!_OR10{ULZ9orF!>#14zOj`X$5FRam1lnsJvtt7P)NmNa{GG* zHTK}s;051~(64b8in1>9G&_Wi62Jj}X5)Gm^sGyK$CyAqel*jrE`|x<=9;L3_}fT! z6dk%eGrm4{HUQ_Px_^bHaoo90E-K>bIx3*CTNz z^CQ{4(S^nVh;-hKhsqm;p6iy^ie1Yq#shdQ&Vk(|JAG`N6`gIOVm8?QuQ**;}Ft4}9i)8jv4>d(XDN`<-Pf z(Ohe!iOS~s{(9o4z#av_*Vy%$2woyfK-1bD!uxsa#wUoaLqY zW{#$+v?O@-hSV-v<(O`W+6r8iI>>62o=Zvd^ZeiLn)h99%wH#id6udcBL%h#WDiNt z&g2kz-9v_Xh+2a^~da3PPvtT(Z# zH#G*UKuQH+FDBy)1P)3ZSie?nvA}N4jHo6-YUj(`h2a5O$07>vOPVAg;|m^b!>)!0WXN5F|Fkpt`)3fS8B>6 zSpk``x#d~;eZ}4a%O(dYDYuWuw8YFlK-^AV>yZPK`UlWT@NG*Fz9<&DGc)a}D|d2l zOzeGvlAQE58UAhrp6J9Fu_+pA1fSPYQ+bV)@us`eda4KB86_Q3(p_EiO|{wGJc&0! z)55RHkrZXTG?8Tu3T=O{j(_HPb-3DZ||}2NMMuUmbk$B1gkBi948VEz6hAYZNUGF(aYl z@yT{>FUpSMoS3GwpE+wQcPKPIY;^w1Z13@m@SZitn;@diVyJN4Hq%p|A$tp1@-K?e zl*ix@cz2<-Q3y0z^5m3P!Z92L8tdEMinCLltP{``RBKjp7`9BFjZ3}=M3g$!@?~~q z19@gbH(%(pJ~x2Pq&mS!r}qxC*{}pvhy}GJUkhnVS>KFAy*a!EXVl!Vry+&0v5&tG z2~qDx)8l06M!-!_#&UuEQ2Kjz>!puM15_wQ@wCEkzzQ@wWb>rw0;B09Ebp0UCk)cG@*&t zPx|E066+l}`Jy70KYREumGq@6&F)jD;j<{6RN09ZBE>XpR2_50RoL*>TOod2Sc&h! z$RmvQ#<5o@LD3r4`>bI7qwP)R{5&~L0z}HvMJ<30zDB0|LPNEb`onb4G;&ur>~W)x zOVCR-e}D-I=g^n(Oxk@$9zjHnow$FTm65X#-2n+T79EKeg|AKjr0w{6n(cyKH;>JL zITIRHbuA?_Z0!LfsD9aYfL6c9DyF$LCXi0kXRo<|A1m#>M;7tz_)gZwe$GW^(U-HP zrh_oJFoj9o>4mDnk4f4l9+S@;;RWM>{mA>%}#E3$ncAUd|zY|yLS?A`(qvgTSm2G*I z;~b4{_`zZ}eKB?~J5o!UX)+(L*2BDgkk?~kRbey;vxx(bv8GV@y>UQ(2Vd%6Qs4|^ zjwoyca!v~Qhk05(%(l68B)y^f2Nj}E_OI&x^lj<=E!p0p4>r)*z9LJZ6?T)kn&e1K z4%SDGd_UewuSP&sLZG=c8mp$O#-H59f){zuC|Z(~Mrmc9bidLjd{h)&g%;fu7GN|H zI+yvH4{*-t`kMZL0Uf|0`$GPu2YCL3G)VmZum^vAuO&I2o(~H!Q!DQ}N7&ZUG4}qw z5q5m1)K)`J@^zFTn>SOOO*-EGt? z@4_0PE2|uhS&2=febY-$92-|h^4B(L>$ioZ;HSSA%m(MPh}Al1+8ExVrmsQxMGM#N zrlPq3Yu+k)y=wxSrUCD`ZM@xv;HoM*fP)&5!sDSYAh&#`fsOZhRsCSE%-p{gfr7&W zt#q*ii&2e{ML|iOm#caeJZx^Yy^HPDQ^8Ta=$W+*;c5o0;;0!b*bOSl!EeiKt-}svN{CiPx>ldHT`~;Hm(*opZ;z`|R|X7)-Hw zIyqPjtv}DeauD`if@YkSa=HzX&a2gQX)3h~;Tg%v3XAfxiWYa>G{O)z=Py3aClaMvO4-@MEeIvKaBAA!mD;;q_qG7ir(=ir2|J6kP?rci&? zh@P1i;za${BEGr)q1>_=!D01TPi{8b>Z<9Ya6-w7n33irEY_jifEG$*PPgA5m%SmM zjDb$LMX?!NoTm84)6bLegWPmj7R_VkFX1_-9nVL^MU$>W#w7oiIGSxM`z+oO3EuH$}D0*Tb zZ5ugwbbZ}wOWmOs;1G$UFU)d_AIKtvLl2y^2JY_ej$)yp*%fQZhxt?F;PUjU zA7Am>&9V8LU|z3=So+eghu{?d@3|R8Xkoyal8;+GtD-AX8VWo$9=WdbE_dzkMN-XL zO8l*2rev%@A=ovj`_UMsG@$#3p&_RbcJ3NyEl>up!C@4{@FCcG&4@N$l4|uXHy+Qo zmG{|!29E?xx2tPY|D-R)R%D!ew+RW>r6Kn7`(4{hTci5sebuaF9A>rCV+|7y;V`Nw^FLGd(eW~~#3HG}@tLL4(}7tl7bHun3>a{>)WMhm!X#_$ z$B-)Zzb&XwuNL*EPNAnW&6XzOLFi?xC1+w_Ve_%r)R(u;`W}Xf8nTJTzqI(jx<(s! z=bj6*hCYAhuR3#P8!gusT$~Q+W&w_{q-yq$hEjGWgSy{aohi1l>Mcd4T`41U7{YNl zjo*>Q4v83@q@et-9EtYL?Q<%MNick@<#7Z^<~=anzQ&J)2cq33s%SeYGP3Y(H$lNo zCT#4g_H<7D>>VsyW{yD|5uLMpZ=K`998~?~msaD$yktmtV)*D_wmJa|^=W^3dU3!? z#1$@c=gtoNjYfA7GCfe^p4C+&wOKJFTnWnY=DITzb6~?`zi+HRPS=ah)GcF#TzFKP z29)cu>v8X5&9>k6{=UnRRHIwM`|yco3*6PDpW*EKeHPJ~0)#_c%#k3Bwp{^Sc_idE z>Ehxd4Vij6eE6s4=@IF4=jWRSLT$qHc{|4QY{uebV&q2mh8$k=J^TI&pZv#WJe{JDFg;K zmcKS%6+5>U=cizAa5{4W3rbz1Pwj%>_l@sPz``IDKl<&+ZK1%)-0d@Gd*gg zv#CmdUp+LCL#S(@u;dT>Maz@n;gcYTE;(L+YL~e$dF{=t()MT-OP|N37xy!GuNywp ztt=^d#P!(rqZMqzLHfgi2O+ku_e}N-n5&}|a2fFDbxQ;NkYa!6w9&|ikK$sqGkeg5 zMx7wpM#LJg!~8nT!C@vgw}7Ytc;0q`ta48`V@+WKc2)I{H?*Q|Ed`cfr>!v>AfM|U z#?`z+&8^?34<~ZxR}4oXNoetl_)(X~(*y6=e(RQu^aS!u8D4u(J7-LT1L{>}sWm@y zSQdkGbjCa>-ui2yDqOW4|E24j%(Oj}Z8I1aF-ehd?D=)8-irL%y#NDO3gfJgYtG7UWiE*3TqcNVQAE}al;8QZBBt;DupO3>f)iy00gK zM;2wTcJ3)&WbGRQC-l!s9(+Fg6Q-B!)g^Cm)wnst@v!L*6-n3yu&y)8Xe&$~(2mj3 z{7t6o2%EU{;F0^(oION~+);R%$70Cl4SV82dhp?{u)}0moei!&?8$taq0BUFs&D$c zPtBev1j}v3_fid$dG=%4@3ya})zs5vVp>9iGtk;6w-vK(GNWPKdEnZjA24bc@vKcp z>C~I+nP(2leRhWBgouchrDn}0S3xlB`h^+H%X2u>DM>aO2J?8fsd>TRw;zRF#8>seY z0WGCVKMrYMS%G{oXH3>kSO_La?$X)n*TzQfuB;XgN*$>Cx=s4!Z5BF*MWC9?V14kk zFUT#WyUeum=R@rzdl3utKH(G3`}|OVQ+b+QsN#w07fZ%h8}!*-w9{-OXH%5O*&Y*u zU2-DBf(X6Bm~=%zvf?-+PhL}4O)M!E?(fmknaa4q(Ia=MjkinaHcn6Crcm$iMG0)T zTEJ*}W5WQv$zIQ5mRwO~0S#;VD%w*N<3KQGQxH<2pZLkdO}6F*-mL|?NzaI za=0YlTeG=V-n*B4&NP}jS8SW4raKb2-P&-mIW_}{T?omRqc?t#5uHrto;gq&d~+Tj*K^uBk19?>&lnY^2%t8QguzK;mkjdqB7=SjtT{ZkJN}bp=cAj zT!-kf8}hFO6sebEnoGxNYx=cOcXkw^02%X@M<6F_2Of07)@OuC*H4aK7VNc>GZ(Tj zS?R4_tBHA#^|5^8x+K@tD{SkH4==?5CcZR#|7;LaHKzL!e)5v68md1m=DO##LD;L; ztX;nLRom4O3mdn4IXh%Qgn+f7 zB&VZ|4FSYXR_A~KB!P5{f$g79SMp05AgU7}icCkF}9MVTaSH^rTtvSMduNbW7F<9&R zrk^cOh)~@-&H-#RSztn2k5tAA_6D?K#+`a}NFWgzc;rQO z60=#MsV>hc(FI{|$w6XlbF@NR$3H0Khz?X?Bn#b)(!th}+0t_M;HdOaR$fShw3ru- zXWoE2`Q07O2eP?Y?-<#bXBbBuRTA3b*BRbKruilYf2Y6U`^Z$)P{2iLU_8ywf~g_T zd~g5OT$gaUx9me}&&~%LQBvJl=MI){p@oa-5kY4O1&i53VmF}7)mfM6*qw*oEp8a* zZyS+baY57$lk7Y4No2FVpp*M>MX~*9UbzuN@l?i0v-PI+Ro&Il<)ISNI>n~h8Xv1@ z&E5zD9#|=uCMPFP8w0JDX{w{V`yEL%ipXBo zp=Oq%wt>A%40})+?#JJ)_toxxcU(8dLoG!tFo@OWN+(pe#hlFH*(qLL#N1`Kd-K_(kV#$62O=T(R=&ehko^VjYH+= za`hGl0p&WlAKGgf^!AqaUDRB}>h~|Hp0Mui2?TcA+m#xj5t=5Y;FE&P?2YnULAAq` z7K*KdldLR>Lhzmedm~NX9P>q^jfWk36c|cfMU%8NVz(D|w#p3epOudZmwEQK{~;w= zJ?<|_DM7@XhT*hlvYsXzpWv&KJ7y=@Q;p)!{lj?2jydPcd{RR3se; zgC-H!(y_=Aj@F>C=pU7i2zT_C%c>eOKW7j=b%-MfH?aLd`w^05QdqEPR~?T7Hjg^W znc!E0CNh1Cq;}#gAnSwVCQ+p~0qJgTyqkqpzjWeXUtJYx8(+k8F2ci*9V5&Pq`1*v z&p3tb234&T7Dg?8NQ3$pJ)v&ZX`eWSP3YbMd}Jm)0Gt$Hvn45J^uFmvKp9W@Mx|_P zUn-~5iS{N+zWpJ>u-p?cCM8JdZt}f%dCOJFnzU`+q?y%FMB^BMVlrMJ?q`e6lj_iQZs_o_u5ffvzE|D+sS ztXs)5LVl+Q6|iz!{o;MZ!4&TNlN;dL)HH|bOc$;6trnHD0@kG~`A;p`TPgz1Uw@JA zAj2rt6TovGAH0$3FNwo_JZn7{Ef^NGB%Np;Q+SOv{Xct2PrDq|K)*3d4>0Y7JBNqv(}h%`pjI%E+j4Kr!(kuxeLp_q($z!^^=j? zT$3g>jq6Xw5LjZ7l`L!OUTN_52e}*HFbQAVK96auC?NGA>4TfqX<|(Mcr0CEvd~6l ziC4zM3&h?Sk*bkok&JCcwpY4I^BhHCd#Q>p$4bt+hC}(SMoF-x7nr393XWGq=Tz{r zGdoRvJV5y7_)a5-q($3=MZ$Z22KQ0k>`v!K>5}_HHaa4 z*(8sbHdsBQ$65EN^WsM3yzL#4i3PK)O8y~$xEpo(+kVf?%*E$lwJC#D_72zsBGrDl z=PQ)DB}_LPc{~ru^Zu=1rS!&b?;z)03{59vO4;OXT;r*>E&fi=ng3y309Xd}omb4W zt`1F;P*?{Srj;^Ya19@i2lp6j|COr@sTd9+f;5y( z=@Np#e<&$zQ#Z1;zRyL|o7~%?SEqeSKN%=5p{6N~7bvJ($qy^+Evji`Y_`Y%aS9LN z69KOX_8k~(X` z!=q~9Wc9=@5UWgSf7|bAeq3*BgrZt)!QKBm5LeQHMH{g7)4aa_mf{A4{+pO zXmESwK8RH9i+BDR=01aYdf8h@m(B`bY%LNTslTzKSV+l#7(NL2POt4W(U`TPxK2;R z#rM^G(YRruTf^QN@0%oem5`L~(H)P^F-;m@91onAk+d%MXmkpw@b6*JLe=kol4LBY z$2odco$W;?C0xjJr#6^vb2;v!(!Hmb49hdz`<2FX+Y9hjcni%oO`$yshZH=%v&yYO zbQ6iR(wo^mY?+cNSuGc}C*|hY4x;jPwMrT=Xyzv5{opO7Z>zxW0F$P)*bfu}g7QQ{ z&+I6n_>JK8ia~oVO~x&ow+d}tU<~8c59>>(-)(zUrQ@p52vUXI806fPok|0cn3vfm zx357QQY@Q^r`k6+?W_jLGsf)0Jeo0?oQ=noPo?NgWIOv9T(;54GK?RD1V0ywrPr`- zzRyU0z$s>|$|O*zUIH09NZa*O(sE~Nj3`e>D0|wy?0)}bwna~6-?Ig2312zWQT=q1 zKmByD5~$IR6HBQmpYECPL7rs)@=H8A6J)w^w1lyv9+w?i$=rh)YPP?czNC?VnQXn8 zP{cEU)yVIxiaFVxipLK~PAX9sN*v*#4PscqLa&sE3BP6LjL_px?ybnL#3wG}`k*#) zxCe@#xo7(jK*ZH0VNF~v_!4(=b zua0&<%t_9ZRTOfe8vdTe`E4G};vAmY+(;{C&p5T?f}6G5G=w%FAN5SAr9&p8ij3yk zLdz>lEBbggT{o(w2409^KNm|DQu=QcgFfSz#XN;eB{nw+B{(b(rNn+qcGeH@COO%URc^MDtu7ZZ^SP#E)!|7c%Q@X>c}UfOpOhrLY~&K z#<})yJvA9ug0El4-&bDuJyis5C1keO63`fE)5~RySq2}n-e3l{c}w>FTE>-90sX)F zQY>WRlx_&!%$);1J_pP?+D~7~urpa}(1;)IH@D%|WiS&9+qMTIe_2HGv&CBd0_NMx z&WM_kz8>T1s3uZ&HL!9}Gb?8{bSU8llfZ@TBlZ|lQ`h4O#pmh2eh1f-uPKn){l4j! z?7lv|M{F!JnAO5(Ci^!+@R@G}Mz|1I?Uz0YO@c0mLixVlqQWp9V*;n!+fUxe+)3jt z_eqvmP3@e~_*D~BD=!;uB8#oKSEV3MH9GZJg)D?hCu)ASIVohjwmFNSMg77@eUmTc ziG3I48=W}I3hPMAK}|{%-^b=MXt|wQxFM$PZ4l$nN=*&;>P!hJ2&a;V53v=7Vr}Wj<&Gt(+)=siDr2YD20zrJlbnYhqv~Xa$TB5k zQzyyAj^U$kFLGw1cG)3F=AjZX6cmH ztDA*Zk4mfh?{XUI6RhHDh|9pKsN$WHq$lQKrO|E9+#_!rDB#bfjjw#gBrhlNj^1%h z1d|WFzcuJ4={HzLp(sBq-4DxXjm;Ur9~&#^`+ zD2UO9aY!E?`>vRat<``~m0MPJXf*bIVf8D!VDhYtdTLc~hO*SpSGn(EaH_&4JXgI)SSqzmX=B`Bb8%l<*OvPn2*Lri~j{1W` z?nM5iH1Y@Rzl92z`s{p*yl;1N$4)_lh6i2y?u6y(=5biG&y5bu=j_Te+Rz|8Cpk=9 zJU*JD)rKCZxU*xb`<@w`#nZ^i6hDHX$9g=vQP5L0@{_6VQF*8NO9kM*u~4ilZWP=v zt`at&<{Fpru8!1KwPmo$ev~Zw_Vj{TW>fSShQ5{l?J{kNcgl30YKE>ekhy&X>jfcP z%x1#g(lZ7g?}~-R3dY%Nn;LIHmneMl+Bd zo2M-Q=YIq0^!&*AOZlC(BYTlX-1HkNekaSJ4_XM$9p^|tAe!GAfZU)#rP2{*fc8t^ zI-Bt6uy34sH+|C5%jnQ>9`xQ~0;;~RgzGeTQbbOu-J4BB#9idC;w zxS*30j!7%c*`n9BgT1~OeQF%@B7*{GBm5sD;meS9@rc`o$PI1r7&+-MQa0XRA%qgSkr~`%wxw|5b(yN1C<= zbALiWgt$iY+ueoN0>}~4@!iW)5a!t43$j09pH7G;8VA@^X7}XSsc! z#nr!qdG^$kNY4l#fadsZ>d|Jq#&#I z5N2L==!kwXJvVom9g!0VoPQUk42pH;50ge5_kix^^WL0cB(HAVsrymTJZ0SCU)JnP1V7U?7XeA*nQviH~kJ zZrPlXPiLVJFq9^)Y;UaD=!Uz^Y)!_Az`wQIn3FcM*q!B%o+Eh2Y9mM&ED%Q_X#a!E z%@VFHPL^k-`NmfY#-!5TCxR?0C)3WHx%7xxPtL2;suVDeJzjhP#2kP6%4zH$l>60n zuJu$j!}_Lf!(J3&6g`2*<8dL_iy*_YSpuq9I-|OJm_{vMQk=w2icTd>v8!7Nq4+eiD|yFXfdNLH|Jnu#zImabo2={?FiPHkY} z_5g2b1cgYlcp)NFwr)JCn}xz)wQWZ)f$1st5C&Z3h3o+=gd5TpzmU^$v5?iyYu}atAZu~^Hd(g!R_2-Igqdi>mA5C5ad}Y}@9Y5M;DBDf&Dch~6 zJ6`~0muw}+AAOOSA_r3*MBW;clB~6~1N%n+E9#MWA%xhhSJ0|otJH11(*_O{VCf<& z6uOvK2iBchOd%Nz?>=_g;V%sTXw?mKn^>4sv|N^z#?&?MHM+C}hCkZN+Bm32hxYaI z){O$w(1vzSW77KVPrO3JdzPrO{yUQjHmBiRKnT<}))o%*b? z{YlWNwuL|KCS^fLaQbLzx{O$tZt;VJWP1D<0*b8%8{>PX=I)FJ`G$a=9^C~t?c6cO zlOKH}PQ7hTQ1`c$5#@oUa+SbA%r@eyA(9VT0Fpd%{rGS0eLoG29c0Hu;iXJl4VEXL zHm3?^N-g>0Kb$8zs-}KBwDSLTTW0Oxuup278ONzbEEn@GZEEa>)>Dh7^(M^iK z`VU~E7k{&Meq;&!6RPL$P-}4K|E`PjpS}5fmDU`f_76-mWxo3~j!@2Xo`1Ue9a=Me zSk^xnot0nFI6kj}<^RDa&G($veBs7F@Yv1;M9~se6r;~S-TV`+`O>4W|CEOA&=5xd z&xcN5dd>9uKLL`S(~_8~(9(ZP%Kr!N<{GW}UWLFv!KOa_O$ajT_!ofQ|9I+m|AssL z`-T5c=;Oa%_`jZJ|DNIhI`sW}hX2cq^6!vNS8 { + Completions resultCompletions = client.getCompletions(deploymentId, new CompletionsOptions(prompt)); + assertCompletions(1, resultCompletions); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetCompletionsStream(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + getCompletionsRunner((deploymentId, prompt) -> { + IterableStream resultCompletions = client.getCompletionsStream(deploymentId, new CompletionsOptions(prompt)); + assertTrue(resultCompletions.stream().toArray().length > 1); + resultCompletions.forEach(OpenAIClientTestBase::assertCompletionsStream); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetCompletionsFromPrompt(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + getCompletionsFromSinglePromptRunner((deploymentId, prompts) -> { + Completions completions = client.getCompletions(deploymentId, prompts); + assertCompletions(1, completions); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetCompletionsWithResponse(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + getCompletionsRunner((deploymentId, prompt) -> { + Response response = client.getCompletionsWithResponse(deploymentId, + BinaryData.fromObject(new CompletionsOptions(prompt)), new RequestOptions()); + Completions resultCompletions = assertAndGetValueFromResponse(response, Completions.class, 200); + assertCompletions(1, resultCompletions); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetCompletionsWithResponseBadDeployment(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + getCompletionsRunner((_deploymentId, prompt) -> { + String deploymentId = "BAD_DEPLOYMENT_ID"; + ResourceNotFoundException exception = assertThrows(ResourceNotFoundException.class, + () -> client.getCompletionsWithResponse(deploymentId, + BinaryData.fromObject(new CompletionsOptions(prompt)), new RequestOptions())); + assertEquals(404, exception.getResponse().getStatusCode()); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetCompletionsUsageField(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + getCompletionsRunner((modelId, prompt) -> { + CompletionsOptions completionsOptions = new CompletionsOptions(prompt); + completionsOptions.setMaxTokens(1024); + completionsOptions.setN(3); + completionsOptions.setLogprobs(1); + + Completions resultCompletions = client.getCompletions(modelId, completionsOptions); + + CompletionsUsage usage = resultCompletions.getUsage(); + assertCompletions(completionsOptions.getN() * completionsOptions.getPrompt().size(), resultCompletions); + assertNotNull(usage); + assertTrue(usage.getTotalTokens() > 0); + assertEquals(usage.getCompletionTokens() + usage.getPromptTokens(), usage.getTotalTokens()); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetCompletionsTokenCutoff(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + getCompletionsRunner((modelId, prompt) -> { + CompletionsOptions completionsOptions = new CompletionsOptions(prompt); + completionsOptions.setMaxTokens(3); + Completions resultCompletions = client.getCompletions(modelId, completionsOptions); + assertCompletions(1, "length", resultCompletions); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetChatCompletions(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + getChatCompletionsRunner((deploymentId, chatMessages) -> { + ChatCompletions resultChatCompletions = client.getChatCompletions(deploymentId, new ChatCompletionsOptions(chatMessages)); + assertChatCompletions(1, resultChatCompletions); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetChatCompletionsStream(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + getChatCompletionsRunner((deploymentId, chatMessages) -> { + IterableStream resultChatCompletions = client.getChatCompletionsStream(deploymentId, new ChatCompletionsOptions(chatMessages)); + assertTrue(resultChatCompletions.stream().toArray().length > 1); + resultChatCompletions.forEach(OpenAIClientTestBase::assertChatCompletionsStream); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetChatCompletionsWithResponse(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + getChatCompletionsRunner((deploymentId, chatMessages) -> { + Response response = client.getChatCompletionsWithResponse(deploymentId, + BinaryData.fromObject(new ChatCompletionsOptions(chatMessages)), new RequestOptions()); + ChatCompletions resultChatCompletions = assertAndGetValueFromResponse(response, ChatCompletions.class, 200); + assertChatCompletions(1, resultChatCompletions); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetEmbeddings(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + getEmbeddingRunner((deploymentId, embeddingsOptions) -> { + Embeddings resultEmbeddings = client.getEmbeddings(deploymentId, embeddingsOptions); + assertEmbeddings(resultEmbeddings); + }); + } + + @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) + @MethodSource("com.azure.ai.openai.TestUtils#getTestParameters") + public void testGetEmbeddingsWithResponse(HttpClient httpClient, OpenAIServiceVersion serviceVersion) { + client = getOpenAIClient(httpClient, serviceVersion); + getEmbeddingRunner((deploymentId, embeddingsOptions) -> { + Response response = client.getEmbeddingsWithResponse(deploymentId, + BinaryData.fromObject(embeddingsOptions), new RequestOptions()); + Embeddings resultEmbeddings = assertAndGetValueFromResponse(response, Embeddings.class, 200); + assertEmbeddings(resultEmbeddings); + }); + } +} diff --git a/sdk/purview/azure-analytics-purview-scanning/src/main/java/com/azure/analytics/purview/scanning/implementation/package-info.java b/sdk/purview/azure-analytics-purview-scanning/src/main/java/com/azure/analytics/purview/scanning/implementation/package-info.java new file mode 100644 index 000000000000..b539f69b9304 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-scanning/src/main/java/com/azure/analytics/purview/scanning/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for PurviewScanningClient. Creates a Microsoft.Scanning management client. */ +package com.azure.analytics.purview.scanning.implementation; diff --git a/sdk/purview/azure-analytics-purview-scanning/src/main/resources/azure-analytics-purview-scanning.properties b/sdk/purview/azure-analytics-purview-scanning/src/main/resources/azure-analytics-purview-scanning.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-scanning/src/main/resources/azure-analytics-purview-scanning.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/samples/java/com/azure/analytics/purview/workflow/generated/TaskRequestUpdate.java b/sdk/purview/azure-analytics-purview-workflow/src/samples/java/com/azure/analytics/purview/workflow/generated/TaskRequestUpdate.java new file mode 100644 index 000000000000..3ebbfaeba283 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/samples/java/com/azure/analytics/purview/workflow/generated/TaskRequestUpdate.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow.generated; + +import com.azure.analytics.purview.workflow.PurviewWorkflowClient; +import com.azure.analytics.purview.workflow.PurviewWorkflowClientBuilder; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +public class TaskRequestUpdate { + public static void main(String[] args) { + PurviewWorkflowClient purviewWorkflowClient = + new PurviewWorkflowClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT")) + .buildClient(); + // BEGIN:com.azure.analytics.purview.workflow.generated.updatetaskstatus.taskrequestupdate + BinaryData taskUpdateCommand = BinaryData.fromString("{\"comment\":\"Thanks!\",\"newStatus\":\"InProgress\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.updateTaskStatusWithResponse( + "d5bd0215-df84-4245-8e18-3a8f012be376", taskUpdateCommand, requestOptions); + // END:com.azure.analytics.purview.workflow.generated.updatetaskstatus.taskrequestupdate + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/ApprovalRequestReassignTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/ApprovalRequestReassignTests.java new file mode 100644 index 000000000000..85902f8f0f87 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/ApprovalRequestReassignTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class ApprovalRequestReassignTests extends PurviewWorkflowClientTestBase { + @Test + public void testApprovalRequestReassignTests() { + BinaryData reassignCommand = + BinaryData.fromString( + "{\"reassignments\":[{\"reassignFrom\":\"eece94d9-0619-4669-bb8a-d6ecec5220bc\",\"reassignTo\":\"7645223c-cdca-43e9-98c8-bd4d97e79e5e\"}]}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.reassignWorkflowTaskWithResponse( + "5b2ae679-13d3-4a50-9938-582eba7bf716", reassignCommand, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/ApprovalRequestRejectTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/ApprovalRequestRejectTests.java new file mode 100644 index 000000000000..6cbf19dc4d63 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/ApprovalRequestRejectTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class ApprovalRequestRejectTests extends PurviewWorkflowClientTestBase { + @Test + public void testApprovalRequestRejectTests() { + BinaryData approvalResponseComment = BinaryData.fromString("{\"comment\":\"Thanks for raising this!\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.rejectApprovalTaskWithResponse( + "0f666245-46a7-41a6-96ea-647d8367acba", approvalResponseComment, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/ApprovalTaskApproveTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/ApprovalTaskApproveTests.java new file mode 100644 index 000000000000..5d74d7667e79 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/ApprovalTaskApproveTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class ApprovalTaskApproveTests extends PurviewWorkflowClientTestBase { + @Test + public void testApprovalTaskApproveTests() { + BinaryData approvalResponseComment = BinaryData.fromString("{\"comment\":\"Thanks for raising this!\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.approveApprovalTaskWithResponse( + "69b57a00-f5de-4a17-a44a-6479adae373d", approvalResponseComment, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/PurviewWorkflowClientTestBase.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/PurviewWorkflowClientTestBase.java new file mode 100644 index 000000000000..af7d62fb3f57 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/PurviewWorkflowClientTestBase.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestBase; +import com.azure.core.test.TestMode; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import java.time.OffsetDateTime; + +import com.azure.identity.UsernamePasswordCredentialBuilder; +import reactor.core.publisher.Mono; + +class PurviewWorkflowClientTestBase extends TestBase { + protected PurviewWorkflowClient purviewWorkflowClient; + + @Override + protected void beforeTest() { + PurviewWorkflowClientBuilder purviewWorkflowClientbuilder = + new PurviewWorkflowClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(HttpClient.createDefault()) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + purviewWorkflowClientbuilder + .endpoint("https://REDACTED.purview.azure.com") + .httpClient(interceptorManager.getPlaybackClient()) + .credential(request -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX))); + } else if (getTestMode() == TestMode.RECORD) { + purviewWorkflowClientbuilder + .addPolicy(interceptorManager.getRecordPolicy()) + .credential(new UsernamePasswordCredentialBuilder() + .clientId(Configuration.getGlobalConfiguration().get("CLIENTID", "clientId")) + .tenantId(Configuration.getGlobalConfiguration().get("TENANTID", "tenantId")) + .username(Configuration.getGlobalConfiguration().get("USERNAME", "username")) + .password(Configuration.getGlobalConfiguration().get("PASSWORD", "password")) + .authorityHost(Configuration.getGlobalConfiguration().get("HOST", "host")) + .build()); + } else if (getTestMode() == TestMode.LIVE) { + purviewWorkflowClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + purviewWorkflowClient = purviewWorkflowClientbuilder.buildClient(); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/TaskStatusUpdateTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/TaskStatusUpdateTests.java new file mode 100644 index 000000000000..15aea0e32c6a --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/TaskStatusUpdateTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class TaskStatusUpdateTests extends PurviewWorkflowClientTestBase { + @Test + public void testTaskStatusUpdateTests() { + BinaryData taskUpdateCommand = BinaryData.fromString("{\"comment\":\"Thanks!\",\"newStatus\":\"NotStarted\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.updateTaskStatusWithResponse( + "a8f67c0b-36a6-48b0-9cbb-8fc4a02281d8", taskUpdateCommand, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/UserRequestsSubmitTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/UserRequestsSubmitTests.java new file mode 100644 index 000000000000..f4a90ac3b9cf --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/UserRequestsSubmitTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class UserRequestsSubmitTests extends PurviewWorkflowClientTestBase { + @Test + public void testUserRequestsSubmitTests() { + BinaryData userRequestsPayload = + BinaryData.fromString( + "{\"comment\":\"Thanks!\",\"operations\":[{\"type\":\"CreateTerm\",\"payload\":{\"glossaryTerm\":{\"name\":\"term\",\"anchor\":{\"glossaryGuid\":\"20031e20-b4df-4a66-a61d-1b0716f3fa48\"},\"nickName\":\"term\",\"status\":\"Approved\"}}}]}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.submitUserRequestsWithResponse(userRequestsPayload, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkTaskGetTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkTaskGetTests.java new file mode 100644 index 000000000000..49bd0007fee2 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkTaskGetTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class WorkTaskGetTests extends PurviewWorkflowClientTestBase { + @Test + public void testWorkTaskGetTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.getWorkflowTaskWithResponse( + "69b57a00-f5de-4a17-a44a-6479adae373d", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowCreateOrUpdateTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowCreateOrUpdateTests.java new file mode 100644 index 000000000000..99f741ad3a7a --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowCreateOrUpdateTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class WorkflowCreateOrUpdateTests extends PurviewWorkflowClientTestBase { + @Test + public void testWorkflowCreateOrUpdateTests() { + BinaryData workflowCreateOrUpdateCommand = + BinaryData.fromString( + "{\"name\":\"Create glossary term workflow\",\"description\":\"\",\"triggers\":[{\"type\":\"when_term_creation_is_requested\",\"underGlossaryHierarchy\":\"/glossaries/20031e20-b4df-4a66-a61d-1b0716f3fa48\"}],\"isEnabled\":true,\"actionDag\":{\"actions\":{\"Startandwaitforanapproval\":{\"type\":\"Approval\",\"inputs\":{\"parameters\":{\"approvalType\":\"PendingOnAll\",\"title\":\"ApprovalRequestforCreateGlossaryTerm\",\"assignedTo\":[\"eece94d9-0619-4669-bb8a-d6ecec5220bc\"]}},\"runAfter\":{}},\"Condition\":{\"type\":\"If\",\"expression\":{\"and\":[{\"equals\":[\"@outputs('Startandwaitforanapproval')['body/outcome']\",\"Approved\"]}]},\"actions\":{\"Createglossaryterm\":{\"type\":\"CreateTerm\",\"runAfter\":{}},\"Sendemailnotification\":{\"type\":\"EmailNotification\",\"inputs\":{\"parameters\":{\"emailSubject\":\"GlossaryTermCreate-APPROVED\",\"emailMessage\":\"YourrequestforGlossaryTerm@{triggerBody()['request']['term']['name']}isapproved.\",\"emailRecipients\":[\"@{triggerBody()['request']['requestor']}\"]}},\"runAfter\":{\"Createglossaryterm\":[\"Succeeded\"]}}},\"else\":{\"actions\":{\"Sendrejectemailnotification\":{\"type\":\"EmailNotification\",\"inputs\":{\"parameters\":{\"emailSubject\":\"GlossaryTermCreate-REJECTED\",\"emailMessage\":\"YourrequestforGlossaryTerm@{triggerBody()['request']['term']['name']}isrejected.\",\"emailRecipients\":[\"@{triggerBody()['request']['requestor']}\"]}},\"runAfter\":{}}}},\"runAfter\":{\"Startandwaitforanapproval\":[\"Succeeded\"]}}}}}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.createOrReplaceWorkflowWithResponse( + "4afb5752-e47f-43a1-8ba7-c696bf8d2745", workflowCreateOrUpdateCommand, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowDeleteTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowDeleteTests.java new file mode 100644 index 000000000000..1c83dc7b8a65 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowDeleteTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class WorkflowDeleteTests extends PurviewWorkflowClientTestBase { + @Test + public void testWorkflowDeleteTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.deleteWorkflowWithResponse( + "af1ecae-16ee-4b2d-8972-00d611dd2f99", requestOptions); + Assertions.assertEquals(204, response.getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowGetTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowGetTests.java new file mode 100644 index 000000000000..09510782ba1d --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowGetTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class WorkflowGetTests extends PurviewWorkflowClientTestBase { + @Test + public void testWorkflowGetTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.getWorkflowWithResponse("8af1ecae-16ee-4b2d-8972-00d611dd2f99", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowRunCancelTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowRunCancelTests.java new file mode 100644 index 000000000000..184d4667661c --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowRunCancelTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class WorkflowRunCancelTests extends PurviewWorkflowClientTestBase { + @Test + public void testWorkflowRunCancelTests() { + BinaryData runCancelReply = BinaryData.fromString("{\"comment\":\"Thanks!\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.cancelWorkflowRunWithResponse( + "41b1feae-1f90-4b35-835f-037f39d8ef67", runCancelReply, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowRunGetTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowRunGetTests.java new file mode 100644 index 000000000000..bfc58f6e4cc7 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowRunGetTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class WorkflowRunGetTests extends PurviewWorkflowClientTestBase { + @Test + public void testWorkflowRunGetTests() { + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.getWorkflowRunWithResponse( + "41b1feae-1f90-4b35-835f-037f39d8ef67", requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowRunsListTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowRunsListTests.java new file mode 100644 index 000000000000..287e96505bd0 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowRunsListTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class WorkflowRunsListTests extends PurviewWorkflowClientTestBase { + @Test + public void testWorkflowRunsListTests() { + RequestOptions requestOptions = + new RequestOptions() + .addQueryParam("maxpagesize", "1000") + .addQueryParam("orderby", "startTime desc") + .addQueryParam("timeWindow", "30d"); + PagedIterable response = purviewWorkflowClient.listWorkflowRuns(requestOptions); + Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowTasksListTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowTasksListTests.java new file mode 100644 index 000000000000..6dba6521ea25 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowTasksListTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class WorkflowTasksListTests extends PurviewWorkflowClientTestBase { + @Test + public void testWorkflowTasksListTests() { + RequestOptions requestOptions = + new RequestOptions() + .addQueryParam("maxpagesize", "1000") + .addQueryParam("orderby", "createdTime desc") + .addQueryParam("timeWindow", "30d") + .addQueryParam("viewMode", "sent"); + PagedIterable response = purviewWorkflowClient.listWorkflowTasks(requestOptions); + Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowsListTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowsListTests.java new file mode 100644 index 000000000000..7896a42b9584 --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/WorkflowsListTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class WorkflowsListTests extends PurviewWorkflowClientTestBase { + @Test + public void testWorkflowsListTests() { + RequestOptions requestOptions = new RequestOptions(); + PagedIterable response = purviewWorkflowClient.listWorkflows(requestOptions); + Assertions.assertEquals(200, response.iterableByPage().iterator().next().getStatusCode()); + } +} diff --git a/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/generated/TaskRequestUpdateTests.java b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/generated/TaskRequestUpdateTests.java new file mode 100644 index 000000000000..b01ae57d11ae --- /dev/null +++ b/sdk/purview/azure-analytics-purview-workflow/src/test/java/com/azure/analytics/purview/workflow/generated/TaskRequestUpdateTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.analytics.purview.workflow.generated; + +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class TaskRequestUpdateTests extends PurviewWorkflowClientTestBase { + @Test + @Disabled + public void testTaskRequestUpdateTests() { + BinaryData taskUpdateCommand = BinaryData.fromString("{\"comment\":\"Thanks!\",\"newStatus\":\"InProgress\"}"); + RequestOptions requestOptions = new RequestOptions(); + Response response = + purviewWorkflowClient.updateTaskStatusWithResponse( + "d5bd0215-df84-4245-8e18-3a8f012be376", taskUpdateCommand, requestOptions); + Assertions.assertEquals(200, response.getStatusCode()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildAvailabilityStatusesClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildAvailabilityStatusesClient.java new file mode 100644 index 000000000000..59060cd454f7 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildAvailabilityStatusesClient.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.models.AvailabilityStatusInner; + +/** An instance of this class provides access to all the operations defined in ChildAvailabilityStatusesClient. */ +public interface ChildAvailabilityStatusesClient { + /** + * Gets current availability status for a single resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @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 current availability status for a single resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceWithResponse( + String resourceUri, String filter, String expand, Context context); + + /** + * Gets current availability status for a single resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current availability status for a single resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailabilityStatusInner getByResource(String resourceUri); + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @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 List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, String filter, String expand, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildResourcesClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildResourcesClient.java new file mode 100644 index 000000000000..fb3944f7038b --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ChildResourcesClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcehealth.fluent.models.AvailabilityStatusInner; + +/** An instance of this class provides access to all the operations defined in ChildResourcesClient. */ +public interface ChildResourcesClient { + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @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 List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, String filter, String expand, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EmergingIssuesClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EmergingIssuesClient.java new file mode 100644 index 000000000000..bcd4c3732046 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EmergingIssuesClient.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.models.EmergingIssuesGetResultInner; +import com.azure.resourcemanager.resourcehealth.models.IssueNameParameter; + +/** An instance of this class provides access to all the operations defined in EmergingIssuesClient. */ +public interface EmergingIssuesClient { + /** + * Lists Azure services' emerging issues. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of emerging issues as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists Azure services' emerging issues. + * + * @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 list of emerging issues as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @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 azure services' emerging issues along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(IssueNameParameter issueName, Context context); + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure services' emerging issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EmergingIssuesGetResultInner get(IssueNameParameter issueName); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventOperationsClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventOperationsClient.java new file mode 100644 index 000000000000..499b13a9f452 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventOperationsClient.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; + +/** An instance of this class provides access to all the operations defined in EventOperationsClient. */ +public interface EventOperationsClient { + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @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 service health event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getBySubscriptionIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context); + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EventInner getBySubscriptionIdAndTrackingId(String eventTrackingId); + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @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 service health event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response fetchDetailsBySubscriptionIdAndTrackingIdWithResponse(String eventTrackingId, Context context); + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EventInner fetchDetailsBySubscriptionIdAndTrackingId(String eventTrackingId); + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @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 service health event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByTenantIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context); + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EventInner getByTenantIdAndTrackingId(String eventTrackingId); + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @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 service health event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response fetchDetailsByTenantIdAndTrackingIdWithResponse(String eventTrackingId, Context context); + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EventInner fetchDetailsByTenantIdAndTrackingId(String eventTrackingId); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventsOperationsClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventsOperationsClient.java new file mode 100644 index 000000000000..22a2c066f8b9 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/EventsOperationsClient.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; + +/** An instance of this class provides access to all the operations defined in EventsOperationsClient. */ +public interface EventsOperationsClient { + /** + * Lists service health events in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @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 List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, String queryStartTime, Context context); + + /** + * Lists current service health events in the tenant. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTenantId(); + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @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 List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTenantId(String filter, String queryStartTime, Context context); + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySingleResource(String resourceUri); + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @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 List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySingleResource(String resourceUri, String filter, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ImpactedResourcesClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ImpactedResourcesClient.java new file mode 100644 index 000000000000..bb34248f3221 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/ImpactedResourcesClient.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.models.EventImpactedResourceInner; + +/** An instance of this class provides access to all the operations defined in ImpactedResourcesClient. */ +public interface ImpactedResourcesClient { + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscriptionIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @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 List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscriptionIdAndEventId( + String eventTrackingId, String filter, Context context); + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @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 specific impacted resource in the subscription by an event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String eventTrackingId, String impactedResourceName, Context context); + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EventImpactedResourceInner get(String eventTrackingId, String impactedResourceName); + + /** + * Lists impacted resources in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTenantIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @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 List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context); + + /** + * Gets the specific impacted resource in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @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 specific impacted resource in the tenant by an event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByTenantIdWithResponse( + String eventTrackingId, String impactedResourceName, Context context); + + /** + * Gets the specific impacted resource in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the tenant by an event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EventImpactedResourceInner getByTenantId(String eventTrackingId, String impactedResourceName); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/MetadatasClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/MetadatasClient.java new file mode 100644 index 000000000000..8b047ec2acb4 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/MetadatasClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.models.MetadataEntityInner; + +/** An instance of this class provides access to all the operations defined in MetadatasClient. */ +public interface MetadatasClient { + /** + * Gets the list of metadata entities. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the list of metadata entities. + * + * @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 list of metadata entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @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 list of metadata entities along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getEntityWithResponse(String name, Context context); + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetadataEntityInner getEntity(String name); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/SecurityAdvisoryImpactedResourcesClient.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/SecurityAdvisoryImpactedResourcesClient.java new file mode 100644 index 000000000000..378f9b237623 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/SecurityAdvisoryImpactedResourcesClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; + +/** + * An instance of this class provides access to all the operations defined in SecurityAdvisoryImpactedResourcesClient. + */ +public interface SecurityAdvisoryImpactedResourcesClient { + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscriptionIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @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 List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscriptionIdAndEventId( + String eventTrackingId, String filter, Context context); + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTenantIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @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 List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssue.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssue.java new file mode 100644 index 000000000000..a852e16be602 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssue.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.resourcehealth.models.StatusActiveEvent; +import com.azure.resourcemanager.resourcehealth.models.StatusBanner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** On-going emerging issue from azure status. */ +@Fluent +public final class EmergingIssue { + /* + * Timestamp for when last time refreshed for ongoing emerging issue. + */ + @JsonProperty(value = "refreshTimestamp") + private OffsetDateTime refreshTimestamp; + + /* + * The list of emerging issues of banner type. + */ + @JsonProperty(value = "statusBanners") + private List statusBanners; + + /* + * The list of emerging issues of active event type. + */ + @JsonProperty(value = "statusActiveEvents") + private List statusActiveEvents; + + /** Creates an instance of EmergingIssue class. */ + public EmergingIssue() { + } + + /** + * Get the refreshTimestamp property: Timestamp for when last time refreshed for ongoing emerging issue. + * + * @return the refreshTimestamp value. + */ + public OffsetDateTime refreshTimestamp() { + return this.refreshTimestamp; + } + + /** + * Set the refreshTimestamp property: Timestamp for when last time refreshed for ongoing emerging issue. + * + * @param refreshTimestamp the refreshTimestamp value to set. + * @return the EmergingIssue object itself. + */ + public EmergingIssue withRefreshTimestamp(OffsetDateTime refreshTimestamp) { + this.refreshTimestamp = refreshTimestamp; + return this; + } + + /** + * Get the statusBanners property: The list of emerging issues of banner type. + * + * @return the statusBanners value. + */ + public List statusBanners() { + return this.statusBanners; + } + + /** + * Set the statusBanners property: The list of emerging issues of banner type. + * + * @param statusBanners the statusBanners value to set. + * @return the EmergingIssue object itself. + */ + public EmergingIssue withStatusBanners(List statusBanners) { + this.statusBanners = statusBanners; + return this; + } + + /** + * Get the statusActiveEvents property: The list of emerging issues of active event type. + * + * @return the statusActiveEvents value. + */ + public List statusActiveEvents() { + return this.statusActiveEvents; + } + + /** + * Set the statusActiveEvents property: The list of emerging issues of active event type. + * + * @param statusActiveEvents the statusActiveEvents value to set. + * @return the EmergingIssue object itself. + */ + public EmergingIssue withStatusActiveEvents(List statusActiveEvents) { + this.statusActiveEvents = statusActiveEvents; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (statusBanners() != null) { + statusBanners().forEach(e -> e.validate()); + } + if (statusActiveEvents() != null) { + statusActiveEvents().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssuesGetResultInner.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssuesGetResultInner.java new file mode 100644 index 000000000000..a27d0b9d511a --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EmergingIssuesGetResultInner.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.models.StatusActiveEvent; +import com.azure.resourcemanager.resourcehealth.models.StatusBanner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The Get EmergingIssues operation response. */ +@Fluent +public final class EmergingIssuesGetResultInner extends ProxyResource { + /* + * The emerging issue entity properties. + */ + @JsonProperty(value = "properties") + private EmergingIssue innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of EmergingIssuesGetResultInner class. */ + public EmergingIssuesGetResultInner() { + } + + /** + * Get the innerProperties property: The emerging issue entity properties. + * + * @return the innerProperties value. + */ + private EmergingIssue innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the refreshTimestamp property: Timestamp for when last time refreshed for ongoing emerging issue. + * + * @return the refreshTimestamp value. + */ + public OffsetDateTime refreshTimestamp() { + return this.innerProperties() == null ? null : this.innerProperties().refreshTimestamp(); + } + + /** + * Set the refreshTimestamp property: Timestamp for when last time refreshed for ongoing emerging issue. + * + * @param refreshTimestamp the refreshTimestamp value to set. + * @return the EmergingIssuesGetResultInner object itself. + */ + public EmergingIssuesGetResultInner withRefreshTimestamp(OffsetDateTime refreshTimestamp) { + if (this.innerProperties() == null) { + this.innerProperties = new EmergingIssue(); + } + this.innerProperties().withRefreshTimestamp(refreshTimestamp); + return this; + } + + /** + * Get the statusBanners property: The list of emerging issues of banner type. + * + * @return the statusBanners value. + */ + public List statusBanners() { + return this.innerProperties() == null ? null : this.innerProperties().statusBanners(); + } + + /** + * Set the statusBanners property: The list of emerging issues of banner type. + * + * @param statusBanners the statusBanners value to set. + * @return the EmergingIssuesGetResultInner object itself. + */ + public EmergingIssuesGetResultInner withStatusBanners(List statusBanners) { + if (this.innerProperties() == null) { + this.innerProperties = new EmergingIssue(); + } + this.innerProperties().withStatusBanners(statusBanners); + return this; + } + + /** + * Get the statusActiveEvents property: The list of emerging issues of active event type. + * + * @return the statusActiveEvents value. + */ + public List statusActiveEvents() { + return this.innerProperties() == null ? null : this.innerProperties().statusActiveEvents(); + } + + /** + * Set the statusActiveEvents property: The list of emerging issues of active event type. + * + * @param statusActiveEvents the statusActiveEvents value to set. + * @return the EmergingIssuesGetResultInner object itself. + */ + public EmergingIssuesGetResultInner withStatusActiveEvents(List statusActiveEvents) { + if (this.innerProperties() == null) { + this.innerProperties = new EmergingIssue(); + } + this.innerProperties().withStatusActiveEvents(statusActiveEvents); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceInner.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceInner.java new file mode 100644 index 000000000000..c5e64558d147 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.models.KeyValueItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Impacted resource for an event. */ +@Fluent +public final class EventImpactedResourceInner extends ProxyResource { + /* + * Properties of impacted resource. + */ + @JsonProperty(value = "properties") + private EventImpactedResourceProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of EventImpactedResourceInner class. */ + public EventImpactedResourceInner() { + } + + /** + * Get the innerProperties property: Properties of impacted resource. + * + * @return the innerProperties value. + */ + private EventImpactedResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the targetResourceType property: Resource type within Microsoft cloud. + * + * @return the targetResourceType value. + */ + public String targetResourceType() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceType(); + } + + /** + * Get the targetResourceId property: Identity for resource within Microsoft cloud. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceId(); + } + + /** + * Get the targetRegion property: Impacted resource region name. + * + * @return the targetRegion value. + */ + public String targetRegion() { + return this.innerProperties() == null ? null : this.innerProperties().targetRegion(); + } + + /** + * Get the info property: Additional information. + * + * @return the info value. + */ + public List info() { + return this.innerProperties() == null ? null : this.innerProperties().info(); + } + + /** + * Set the info property: Additional information. + * + * @param info the info value to set. + * @return the EventImpactedResourceInner object itself. + */ + public EventImpactedResourceInner withInfo(List info) { + if (this.innerProperties() == null) { + this.innerProperties = new EventImpactedResourceProperties(); + } + this.innerProperties().withInfo(info); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceProperties.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceProperties.java new file mode 100644 index 000000000000..8aad65ba8a29 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventImpactedResourceProperties.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.resourcehealth.models.KeyValueItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of impacted resource. */ +@Fluent +public final class EventImpactedResourceProperties { + /* + * Resource type within Microsoft cloud. + */ + @JsonProperty(value = "targetResourceType", access = JsonProperty.Access.WRITE_ONLY) + private String targetResourceType; + + /* + * Identity for resource within Microsoft cloud. + */ + @JsonProperty(value = "targetResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String targetResourceId; + + /* + * Impacted resource region name. + */ + @JsonProperty(value = "targetRegion", access = JsonProperty.Access.WRITE_ONLY) + private String targetRegion; + + /* + * Additional information. + */ + @JsonProperty(value = "info") + private List info; + + /** Creates an instance of EventImpactedResourceProperties class. */ + public EventImpactedResourceProperties() { + } + + /** + * Get the targetResourceType property: Resource type within Microsoft cloud. + * + * @return the targetResourceType value. + */ + public String targetResourceType() { + return this.targetResourceType; + } + + /** + * Get the targetResourceId property: Identity for resource within Microsoft cloud. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Get the targetRegion property: Impacted resource region name. + * + * @return the targetRegion value. + */ + public String targetRegion() { + return this.targetRegion; + } + + /** + * Get the info property: Additional information. + * + * @return the info value. + */ + public List info() { + return this.info; + } + + /** + * Set the info property: Additional information. + * + * @param info the info value to set. + * @return the EventImpactedResourceProperties object itself. + */ + public EventImpactedResourceProperties withInfo(List info) { + this.info = info; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (info() != null) { + info().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventInner.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventInner.java new file mode 100644 index 000000000000..aac299cc6d69 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventInner.java @@ -0,0 +1,724 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.models.EventLevelValues; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesAdditionalInformation; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesArticle; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesRecommendedActions; +import com.azure.resourcemanager.resourcehealth.models.EventSourceValues; +import com.azure.resourcemanager.resourcehealth.models.EventStatusValues; +import com.azure.resourcemanager.resourcehealth.models.EventTypeValues; +import com.azure.resourcemanager.resourcehealth.models.Faq; +import com.azure.resourcemanager.resourcehealth.models.Impact; +import com.azure.resourcemanager.resourcehealth.models.LevelValues; +import com.azure.resourcemanager.resourcehealth.models.Link; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Service health event. */ +@Fluent +public final class EventInner extends ProxyResource { + /* + * Properties of event. + */ + @JsonProperty(value = "properties") + private EventProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of EventInner class. */ + public EventInner() { + } + + /** + * Get the innerProperties property: Properties of event. + * + * @return the innerProperties value. + */ + private EventProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the eventType property: Type of event. + * + * @return the eventType value. + */ + public EventTypeValues eventType() { + return this.innerProperties() == null ? null : this.innerProperties().eventType(); + } + + /** + * Set the eventType property: Type of event. + * + * @param eventType the eventType value to set. + * @return the EventInner object itself. + */ + public EventInner withEventType(EventTypeValues eventType) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withEventType(eventType); + return this; + } + + /** + * Get the eventSource property: Source of event. + * + * @return the eventSource value. + */ + public EventSourceValues eventSource() { + return this.innerProperties() == null ? null : this.innerProperties().eventSource(); + } + + /** + * Set the eventSource property: Source of event. + * + * @param eventSource the eventSource value to set. + * @return the EventInner object itself. + */ + public EventInner withEventSource(EventSourceValues eventSource) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withEventSource(eventSource); + return this; + } + + /** + * Get the status property: Current status of event. + * + * @return the status value. + */ + public EventStatusValues status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: Current status of event. + * + * @param status the status value to set. + * @return the EventInner object itself. + */ + public EventInner withStatus(EventStatusValues status) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Get the title property: Title text of event. + * + * @return the title value. + */ + public String title() { + return this.innerProperties() == null ? null : this.innerProperties().title(); + } + + /** + * Set the title property: Title text of event. + * + * @param title the title value to set. + * @return the EventInner object itself. + */ + public EventInner withTitle(String title) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withTitle(title); + return this; + } + + /** + * Get the summary property: Summary text of event. + * + * @return the summary value. + */ + public String summary() { + return this.innerProperties() == null ? null : this.innerProperties().summary(); + } + + /** + * Set the summary property: Summary text of event. + * + * @param summary the summary value to set. + * @return the EventInner object itself. + */ + public EventInner withSummary(String summary) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withSummary(summary); + return this; + } + + /** + * Get the headerProperty property: Header text of event. + * + * @return the headerProperty value. + */ + public String headerProperty() { + return this.innerProperties() == null ? null : this.innerProperties().headerProperty(); + } + + /** + * Set the headerProperty property: Header text of event. + * + * @param headerProperty the headerProperty value to set. + * @return the EventInner object itself. + */ + public EventInner withHeaderProperty(String headerProperty) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withHeaderProperty(headerProperty); + return this; + } + + /** + * Get the level property: Level of insight. + * + * @return the level value. + */ + public LevelValues level() { + return this.innerProperties() == null ? null : this.innerProperties().level(); + } + + /** + * Set the level property: Level of insight. + * + * @param level the level value to set. + * @return the EventInner object itself. + */ + public EventInner withLevel(LevelValues level) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withLevel(level); + return this; + } + + /** + * Get the eventLevel property: Level of event. + * + * @return the eventLevel value. + */ + public EventLevelValues eventLevel() { + return this.innerProperties() == null ? null : this.innerProperties().eventLevel(); + } + + /** + * Set the eventLevel property: Level of event. + * + * @param eventLevel the eventLevel value to set. + * @return the EventInner object itself. + */ + public EventInner withEventLevel(EventLevelValues eventLevel) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withEventLevel(eventLevel); + return this; + } + + /** + * Get the externalIncidentId property: The id of the Incident. + * + * @return the externalIncidentId value. + */ + public String externalIncidentId() { + return this.innerProperties() == null ? null : this.innerProperties().externalIncidentId(); + } + + /** + * Set the externalIncidentId property: The id of the Incident. + * + * @param externalIncidentId the externalIncidentId value to set. + * @return the EventInner object itself. + */ + public EventInner withExternalIncidentId(String externalIncidentId) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withExternalIncidentId(externalIncidentId); + return this; + } + + /** + * Get the reason property: The reason for the Incident. + * + * @return the reason value. + */ + public String reason() { + return this.innerProperties() == null ? null : this.innerProperties().reason(); + } + + /** + * Set the reason property: The reason for the Incident. + * + * @param reason the reason value to set. + * @return the EventInner object itself. + */ + public EventInner withReason(String reason) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withReason(reason); + return this; + } + + /** + * Get the article property: Article of event. + * + * @return the article value. + */ + public EventPropertiesArticle article() { + return this.innerProperties() == null ? null : this.innerProperties().article(); + } + + /** + * Set the article property: Article of event. + * + * @param article the article value to set. + * @return the EventInner object itself. + */ + public EventInner withArticle(EventPropertiesArticle article) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withArticle(article); + return this; + } + + /** + * Get the links property: Useful links of event. + * + * @return the links value. + */ + public List links() { + return this.innerProperties() == null ? null : this.innerProperties().links(); + } + + /** + * Set the links property: Useful links of event. + * + * @param links the links value to set. + * @return the EventInner object itself. + */ + public EventInner withLinks(List links) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withLinks(links); + return this; + } + + /** + * Get the impactStartTime property: It provides the Timestamp for when the health impacting event started. + * + * @return the impactStartTime value. + */ + public OffsetDateTime impactStartTime() { + return this.innerProperties() == null ? null : this.innerProperties().impactStartTime(); + } + + /** + * Set the impactStartTime property: It provides the Timestamp for when the health impacting event started. + * + * @param impactStartTime the impactStartTime value to set. + * @return the EventInner object itself. + */ + public EventInner withImpactStartTime(OffsetDateTime impactStartTime) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withImpactStartTime(impactStartTime); + return this; + } + + /** + * Get the impactMitigationTime property: It provides the Timestamp for when the health impacting event resolved. + * + * @return the impactMitigationTime value. + */ + public OffsetDateTime impactMitigationTime() { + return this.innerProperties() == null ? null : this.innerProperties().impactMitigationTime(); + } + + /** + * Set the impactMitigationTime property: It provides the Timestamp for when the health impacting event resolved. + * + * @param impactMitigationTime the impactMitigationTime value to set. + * @return the EventInner object itself. + */ + public EventInner withImpactMitigationTime(OffsetDateTime impactMitigationTime) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withImpactMitigationTime(impactMitigationTime); + return this; + } + + /** + * Get the impact property: List services impacted by the service health event. + * + * @return the impact value. + */ + public List impact() { + return this.innerProperties() == null ? null : this.innerProperties().impact(); + } + + /** + * Set the impact property: List services impacted by the service health event. + * + * @param impact the impact value to set. + * @return the EventInner object itself. + */ + public EventInner withImpact(List impact) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withImpact(impact); + return this; + } + + /** + * Get the recommendedActions property: Recommended actions of event. + * + * @return the recommendedActions value. + */ + public EventPropertiesRecommendedActions recommendedActions() { + return this.innerProperties() == null ? null : this.innerProperties().recommendedActions(); + } + + /** + * Set the recommendedActions property: Recommended actions of event. + * + * @param recommendedActions the recommendedActions value to set. + * @return the EventInner object itself. + */ + public EventInner withRecommendedActions(EventPropertiesRecommendedActions recommendedActions) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withRecommendedActions(recommendedActions); + return this; + } + + /** + * Get the faqs property: Frequently asked questions for the service health event. + * + * @return the faqs value. + */ + public List faqs() { + return this.innerProperties() == null ? null : this.innerProperties().faqs(); + } + + /** + * Set the faqs property: Frequently asked questions for the service health event. + * + * @param faqs the faqs value to set. + * @return the EventInner object itself. + */ + public EventInner withFaqs(List faqs) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withFaqs(faqs); + return this; + } + + /** + * Get the isHir property: It provides information if the event is High incident rate event or not. + * + * @return the isHir value. + */ + public Boolean isHir() { + return this.innerProperties() == null ? null : this.innerProperties().isHir(); + } + + /** + * Set the isHir property: It provides information if the event is High incident rate event or not. + * + * @param isHir the isHir value to set. + * @return the EventInner object itself. + */ + public EventInner withIsHir(Boolean isHir) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withIsHir(isHir); + return this; + } + + /** + * Get the enableMicrosoftSupport property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @return the enableMicrosoftSupport value. + */ + public Boolean enableMicrosoftSupport() { + return this.innerProperties() == null ? null : this.innerProperties().enableMicrosoftSupport(); + } + + /** + * Set the enableMicrosoftSupport property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @param enableMicrosoftSupport the enableMicrosoftSupport value to set. + * @return the EventInner object itself. + */ + public EventInner withEnableMicrosoftSupport(Boolean enableMicrosoftSupport) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withEnableMicrosoftSupport(enableMicrosoftSupport); + return this; + } + + /** + * Get the description property: Contains the communication message for the event, that could include summary, root + * cause and other details. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Contains the communication message for the event, that could include summary, root + * cause and other details. + * + * @param description the description value to set. + * @return the EventInner object itself. + */ + public EventInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the platformInitiated property: Is true if the event is platform initiated. + * + * @return the platformInitiated value. + */ + public Boolean platformInitiated() { + return this.innerProperties() == null ? null : this.innerProperties().platformInitiated(); + } + + /** + * Set the platformInitiated property: Is true if the event is platform initiated. + * + * @param platformInitiated the platformInitiated value to set. + * @return the EventInner object itself. + */ + public EventInner withPlatformInitiated(Boolean platformInitiated) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withPlatformInitiated(platformInitiated); + return this; + } + + /** + * Get the enableChatWithUs property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @return the enableChatWithUs value. + */ + public Boolean enableChatWithUs() { + return this.innerProperties() == null ? null : this.innerProperties().enableChatWithUs(); + } + + /** + * Set the enableChatWithUs property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @param enableChatWithUs the enableChatWithUs value to set. + * @return the EventInner object itself. + */ + public EventInner withEnableChatWithUs(Boolean enableChatWithUs) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withEnableChatWithUs(enableChatWithUs); + return this; + } + + /** + * Get the priority property: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. + * Service issue events have higher priority followed by planned maintenance and health advisory. Critical events + * have higher priority followed by error, warning and informational. Furthermore, active events have higher + * priority than resolved. + * + * @return the priority value. + */ + public Integer priority() { + return this.innerProperties() == null ? null : this.innerProperties().priority(); + } + + /** + * Set the priority property: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. + * Service issue events have higher priority followed by planned maintenance and health advisory. Critical events + * have higher priority followed by error, warning and informational. Furthermore, active events have higher + * priority than resolved. + * + * @param priority the priority value to set. + * @return the EventInner object itself. + */ + public EventInner withPriority(Integer priority) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withPriority(priority); + return this; + } + + /** + * Get the lastUpdateTime property: It provides the Timestamp for when the health impacting event was last updated. + * + * @return the lastUpdateTime value. + */ + public OffsetDateTime lastUpdateTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdateTime(); + } + + /** + * Set the lastUpdateTime property: It provides the Timestamp for when the health impacting event was last updated. + * + * @param lastUpdateTime the lastUpdateTime value to set. + * @return the EventInner object itself. + */ + public EventInner withLastUpdateTime(OffsetDateTime lastUpdateTime) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withLastUpdateTime(lastUpdateTime); + return this; + } + + /** + * Get the hirStage property: Stage for HIR Document. + * + * @return the hirStage value. + */ + public String hirStage() { + return this.innerProperties() == null ? null : this.innerProperties().hirStage(); + } + + /** + * Set the hirStage property: Stage for HIR Document. + * + * @param hirStage the hirStage value to set. + * @return the EventInner object itself. + */ + public EventInner withHirStage(String hirStage) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withHirStage(hirStage); + return this; + } + + /** + * Get the additionalInformation property: Additional information. + * + * @return the additionalInformation value. + */ + public EventPropertiesAdditionalInformation additionalInformation() { + return this.innerProperties() == null ? null : this.innerProperties().additionalInformation(); + } + + /** + * Set the additionalInformation property: Additional information. + * + * @param additionalInformation the additionalInformation value to set. + * @return the EventInner object itself. + */ + public EventInner withAdditionalInformation(EventPropertiesAdditionalInformation additionalInformation) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withAdditionalInformation(additionalInformation); + return this; + } + + /** + * Get the duration property: duration in seconds. + * + * @return the duration value. + */ + public Integer duration() { + return this.innerProperties() == null ? null : this.innerProperties().duration(); + } + + /** + * Set the duration property: duration in seconds. + * + * @param duration the duration value to set. + * @return the EventInner object itself. + */ + public EventInner withDuration(Integer duration) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withDuration(duration); + return this; + } + + /** + * Get the impactType property: The type of the impact. + * + * @return the impactType value. + */ + public String impactType() { + return this.innerProperties() == null ? null : this.innerProperties().impactType(); + } + + /** + * Set the impactType property: The type of the impact. + * + * @param impactType the impactType value to set. + * @return the EventInner object itself. + */ + public EventInner withImpactType(String impactType) { + if (this.innerProperties() == null) { + this.innerProperties = new EventProperties(); + } + this.innerProperties().withImpactType(impactType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventProperties.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventProperties.java new file mode 100644 index 000000000000..ff31364f2f3a --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/EventProperties.java @@ -0,0 +1,793 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.resourcehealth.models.EventLevelValues; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesAdditionalInformation; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesArticle; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesRecommendedActions; +import com.azure.resourcemanager.resourcehealth.models.EventSourceValues; +import com.azure.resourcemanager.resourcehealth.models.EventStatusValues; +import com.azure.resourcemanager.resourcehealth.models.EventTypeValues; +import com.azure.resourcemanager.resourcehealth.models.Faq; +import com.azure.resourcemanager.resourcehealth.models.Impact; +import com.azure.resourcemanager.resourcehealth.models.LevelValues; +import com.azure.resourcemanager.resourcehealth.models.Link; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of event. */ +@Fluent +public final class EventProperties { + /* + * Type of event. + */ + @JsonProperty(value = "eventType") + private EventTypeValues eventType; + + /* + * Source of event. + */ + @JsonProperty(value = "eventSource") + private EventSourceValues eventSource; + + /* + * Current status of event. + */ + @JsonProperty(value = "status") + private EventStatusValues status; + + /* + * Title text of event. + */ + @JsonProperty(value = "title") + private String title; + + /* + * Summary text of event. + */ + @JsonProperty(value = "summary") + private String summary; + + /* + * Header text of event. + */ + @JsonProperty(value = "header") + private String headerProperty; + + /* + * Level of insight. + */ + @JsonProperty(value = "level") + private LevelValues level; + + /* + * Level of event. + */ + @JsonProperty(value = "eventLevel") + private EventLevelValues eventLevel; + + /* + * The id of the Incident + */ + @JsonProperty(value = "externalIncidentId") + private String externalIncidentId; + + /* + * The reason for the Incident + */ + @JsonProperty(value = "reason") + private String reason; + + /* + * Article of event. + */ + @JsonProperty(value = "article") + private EventPropertiesArticle article; + + /* + * Useful links of event. + */ + @JsonProperty(value = "links") + private List links; + + /* + * It provides the Timestamp for when the health impacting event started. + */ + @JsonProperty(value = "impactStartTime") + private OffsetDateTime impactStartTime; + + /* + * It provides the Timestamp for when the health impacting event resolved. + */ + @JsonProperty(value = "impactMitigationTime") + private OffsetDateTime impactMitigationTime; + + /* + * List services impacted by the service health event. + */ + @JsonProperty(value = "impact") + private List impact; + + /* + * Recommended actions of event. + */ + @JsonProperty(value = "recommendedActions") + private EventPropertiesRecommendedActions recommendedActions; + + /* + * Frequently asked questions for the service health event. + */ + @JsonProperty(value = "faqs") + private List faqs; + + /* + * It provides information if the event is High incident rate event or not. + */ + @JsonProperty(value = "isHIR") + private Boolean isHir; + + /* + * Tells if we want to enable or disable Microsoft Support for this event. + */ + @JsonProperty(value = "enableMicrosoftSupport") + private Boolean enableMicrosoftSupport; + + /* + * Contains the communication message for the event, that could include summary, root cause and other details. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Is true if the event is platform initiated. + */ + @JsonProperty(value = "platformInitiated") + private Boolean platformInitiated; + + /* + * Tells if we want to enable or disable Microsoft Support for this event. + */ + @JsonProperty(value = "enableChatWithUs") + private Boolean enableChatWithUs; + + /* + * Priority level of the event. Has value from 0 to 23. 0 is the highest priority. Service issue events have higher + * priority followed by planned maintenance and health advisory. Critical events have higher priority followed by + * error, warning and informational. Furthermore, active events have higher priority than resolved. + */ + @JsonProperty(value = "priority") + private Integer priority; + + /* + * It provides the Timestamp for when the health impacting event was last updated. + */ + @JsonProperty(value = "lastUpdateTime") + private OffsetDateTime lastUpdateTime; + + /* + * Stage for HIR Document + */ + @JsonProperty(value = "hirStage") + private String hirStage; + + /* + * Additional information + */ + @JsonProperty(value = "additionalInformation") + private EventPropertiesAdditionalInformation additionalInformation; + + /* + * duration in seconds + */ + @JsonProperty(value = "duration") + private Integer duration; + + /* + * The type of the impact + */ + @JsonProperty(value = "impactType") + private String impactType; + + /** Creates an instance of EventProperties class. */ + public EventProperties() { + } + + /** + * Get the eventType property: Type of event. + * + * @return the eventType value. + */ + public EventTypeValues eventType() { + return this.eventType; + } + + /** + * Set the eventType property: Type of event. + * + * @param eventType the eventType value to set. + * @return the EventProperties object itself. + */ + public EventProperties withEventType(EventTypeValues eventType) { + this.eventType = eventType; + return this; + } + + /** + * Get the eventSource property: Source of event. + * + * @return the eventSource value. + */ + public EventSourceValues eventSource() { + return this.eventSource; + } + + /** + * Set the eventSource property: Source of event. + * + * @param eventSource the eventSource value to set. + * @return the EventProperties object itself. + */ + public EventProperties withEventSource(EventSourceValues eventSource) { + this.eventSource = eventSource; + return this; + } + + /** + * Get the status property: Current status of event. + * + * @return the status value. + */ + public EventStatusValues status() { + return this.status; + } + + /** + * Set the status property: Current status of event. + * + * @param status the status value to set. + * @return the EventProperties object itself. + */ + public EventProperties withStatus(EventStatusValues status) { + this.status = status; + return this; + } + + /** + * Get the title property: Title text of event. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: Title text of event. + * + * @param title the title value to set. + * @return the EventProperties object itself. + */ + public EventProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the summary property: Summary text of event. + * + * @return the summary value. + */ + public String summary() { + return this.summary; + } + + /** + * Set the summary property: Summary text of event. + * + * @param summary the summary value to set. + * @return the EventProperties object itself. + */ + public EventProperties withSummary(String summary) { + this.summary = summary; + return this; + } + + /** + * Get the headerProperty property: Header text of event. + * + * @return the headerProperty value. + */ + public String headerProperty() { + return this.headerProperty; + } + + /** + * Set the headerProperty property: Header text of event. + * + * @param headerProperty the headerProperty value to set. + * @return the EventProperties object itself. + */ + public EventProperties withHeaderProperty(String headerProperty) { + this.headerProperty = headerProperty; + return this; + } + + /** + * Get the level property: Level of insight. + * + * @return the level value. + */ + public LevelValues level() { + return this.level; + } + + /** + * Set the level property: Level of insight. + * + * @param level the level value to set. + * @return the EventProperties object itself. + */ + public EventProperties withLevel(LevelValues level) { + this.level = level; + return this; + } + + /** + * Get the eventLevel property: Level of event. + * + * @return the eventLevel value. + */ + public EventLevelValues eventLevel() { + return this.eventLevel; + } + + /** + * Set the eventLevel property: Level of event. + * + * @param eventLevel the eventLevel value to set. + * @return the EventProperties object itself. + */ + public EventProperties withEventLevel(EventLevelValues eventLevel) { + this.eventLevel = eventLevel; + return this; + } + + /** + * Get the externalIncidentId property: The id of the Incident. + * + * @return the externalIncidentId value. + */ + public String externalIncidentId() { + return this.externalIncidentId; + } + + /** + * Set the externalIncidentId property: The id of the Incident. + * + * @param externalIncidentId the externalIncidentId value to set. + * @return the EventProperties object itself. + */ + public EventProperties withExternalIncidentId(String externalIncidentId) { + this.externalIncidentId = externalIncidentId; + return this; + } + + /** + * Get the reason property: The reason for the Incident. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the Incident. + * + * @param reason the reason value to set. + * @return the EventProperties object itself. + */ + public EventProperties withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the article property: Article of event. + * + * @return the article value. + */ + public EventPropertiesArticle article() { + return this.article; + } + + /** + * Set the article property: Article of event. + * + * @param article the article value to set. + * @return the EventProperties object itself. + */ + public EventProperties withArticle(EventPropertiesArticle article) { + this.article = article; + return this; + } + + /** + * Get the links property: Useful links of event. + * + * @return the links value. + */ + public List links() { + return this.links; + } + + /** + * Set the links property: Useful links of event. + * + * @param links the links value to set. + * @return the EventProperties object itself. + */ + public EventProperties withLinks(List links) { + this.links = links; + return this; + } + + /** + * Get the impactStartTime property: It provides the Timestamp for when the health impacting event started. + * + * @return the impactStartTime value. + */ + public OffsetDateTime impactStartTime() { + return this.impactStartTime; + } + + /** + * Set the impactStartTime property: It provides the Timestamp for when the health impacting event started. + * + * @param impactStartTime the impactStartTime value to set. + * @return the EventProperties object itself. + */ + public EventProperties withImpactStartTime(OffsetDateTime impactStartTime) { + this.impactStartTime = impactStartTime; + return this; + } + + /** + * Get the impactMitigationTime property: It provides the Timestamp for when the health impacting event resolved. + * + * @return the impactMitigationTime value. + */ + public OffsetDateTime impactMitigationTime() { + return this.impactMitigationTime; + } + + /** + * Set the impactMitigationTime property: It provides the Timestamp for when the health impacting event resolved. + * + * @param impactMitigationTime the impactMitigationTime value to set. + * @return the EventProperties object itself. + */ + public EventProperties withImpactMitigationTime(OffsetDateTime impactMitigationTime) { + this.impactMitigationTime = impactMitigationTime; + return this; + } + + /** + * Get the impact property: List services impacted by the service health event. + * + * @return the impact value. + */ + public List impact() { + return this.impact; + } + + /** + * Set the impact property: List services impacted by the service health event. + * + * @param impact the impact value to set. + * @return the EventProperties object itself. + */ + public EventProperties withImpact(List impact) { + this.impact = impact; + return this; + } + + /** + * Get the recommendedActions property: Recommended actions of event. + * + * @return the recommendedActions value. + */ + public EventPropertiesRecommendedActions recommendedActions() { + return this.recommendedActions; + } + + /** + * Set the recommendedActions property: Recommended actions of event. + * + * @param recommendedActions the recommendedActions value to set. + * @return the EventProperties object itself. + */ + public EventProperties withRecommendedActions(EventPropertiesRecommendedActions recommendedActions) { + this.recommendedActions = recommendedActions; + return this; + } + + /** + * Get the faqs property: Frequently asked questions for the service health event. + * + * @return the faqs value. + */ + public List faqs() { + return this.faqs; + } + + /** + * Set the faqs property: Frequently asked questions for the service health event. + * + * @param faqs the faqs value to set. + * @return the EventProperties object itself. + */ + public EventProperties withFaqs(List faqs) { + this.faqs = faqs; + return this; + } + + /** + * Get the isHir property: It provides information if the event is High incident rate event or not. + * + * @return the isHir value. + */ + public Boolean isHir() { + return this.isHir; + } + + /** + * Set the isHir property: It provides information if the event is High incident rate event or not. + * + * @param isHir the isHir value to set. + * @return the EventProperties object itself. + */ + public EventProperties withIsHir(Boolean isHir) { + this.isHir = isHir; + return this; + } + + /** + * Get the enableMicrosoftSupport property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @return the enableMicrosoftSupport value. + */ + public Boolean enableMicrosoftSupport() { + return this.enableMicrosoftSupport; + } + + /** + * Set the enableMicrosoftSupport property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @param enableMicrosoftSupport the enableMicrosoftSupport value to set. + * @return the EventProperties object itself. + */ + public EventProperties withEnableMicrosoftSupport(Boolean enableMicrosoftSupport) { + this.enableMicrosoftSupport = enableMicrosoftSupport; + return this; + } + + /** + * Get the description property: Contains the communication message for the event, that could include summary, root + * cause and other details. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Contains the communication message for the event, that could include summary, root + * cause and other details. + * + * @param description the description value to set. + * @return the EventProperties object itself. + */ + public EventProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the platformInitiated property: Is true if the event is platform initiated. + * + * @return the platformInitiated value. + */ + public Boolean platformInitiated() { + return this.platformInitiated; + } + + /** + * Set the platformInitiated property: Is true if the event is platform initiated. + * + * @param platformInitiated the platformInitiated value to set. + * @return the EventProperties object itself. + */ + public EventProperties withPlatformInitiated(Boolean platformInitiated) { + this.platformInitiated = platformInitiated; + return this; + } + + /** + * Get the enableChatWithUs property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @return the enableChatWithUs value. + */ + public Boolean enableChatWithUs() { + return this.enableChatWithUs; + } + + /** + * Set the enableChatWithUs property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @param enableChatWithUs the enableChatWithUs value to set. + * @return the EventProperties object itself. + */ + public EventProperties withEnableChatWithUs(Boolean enableChatWithUs) { + this.enableChatWithUs = enableChatWithUs; + return this; + } + + /** + * Get the priority property: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. + * Service issue events have higher priority followed by planned maintenance and health advisory. Critical events + * have higher priority followed by error, warning and informational. Furthermore, active events have higher + * priority than resolved. + * + * @return the priority value. + */ + public Integer priority() { + return this.priority; + } + + /** + * Set the priority property: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. + * Service issue events have higher priority followed by planned maintenance and health advisory. Critical events + * have higher priority followed by error, warning and informational. Furthermore, active events have higher + * priority than resolved. + * + * @param priority the priority value to set. + * @return the EventProperties object itself. + */ + public EventProperties withPriority(Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get the lastUpdateTime property: It provides the Timestamp for when the health impacting event was last updated. + * + * @return the lastUpdateTime value. + */ + public OffsetDateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set the lastUpdateTime property: It provides the Timestamp for when the health impacting event was last updated. + * + * @param lastUpdateTime the lastUpdateTime value to set. + * @return the EventProperties object itself. + */ + public EventProperties withLastUpdateTime(OffsetDateTime lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + + /** + * Get the hirStage property: Stage for HIR Document. + * + * @return the hirStage value. + */ + public String hirStage() { + return this.hirStage; + } + + /** + * Set the hirStage property: Stage for HIR Document. + * + * @param hirStage the hirStage value to set. + * @return the EventProperties object itself. + */ + public EventProperties withHirStage(String hirStage) { + this.hirStage = hirStage; + return this; + } + + /** + * Get the additionalInformation property: Additional information. + * + * @return the additionalInformation value. + */ + public EventPropertiesAdditionalInformation additionalInformation() { + return this.additionalInformation; + } + + /** + * Set the additionalInformation property: Additional information. + * + * @param additionalInformation the additionalInformation value to set. + * @return the EventProperties object itself. + */ + public EventProperties withAdditionalInformation(EventPropertiesAdditionalInformation additionalInformation) { + this.additionalInformation = additionalInformation; + return this; + } + + /** + * Get the duration property: duration in seconds. + * + * @return the duration value. + */ + public Integer duration() { + return this.duration; + } + + /** + * Set the duration property: duration in seconds. + * + * @param duration the duration value to set. + * @return the EventProperties object itself. + */ + public EventProperties withDuration(Integer duration) { + this.duration = duration; + return this; + } + + /** + * Get the impactType property: The type of the impact. + * + * @return the impactType value. + */ + public String impactType() { + return this.impactType; + } + + /** + * Set the impactType property: The type of the impact. + * + * @param impactType the impactType value to set. + * @return the EventProperties object itself. + */ + public EventProperties withImpactType(String impactType) { + this.impactType = impactType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (article() != null) { + article().validate(); + } + if (links() != null) { + links().forEach(e -> e.validate()); + } + if (impact() != null) { + impact().forEach(e -> e.validate()); + } + if (recommendedActions() != null) { + recommendedActions().validate(); + } + if (faqs() != null) { + faqs().forEach(e -> e.validate()); + } + if (additionalInformation() != null) { + additionalInformation().validate(); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/MetadataEntityInner.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/MetadataEntityInner.java new file mode 100644 index 000000000000..e21596fda4ee --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/MetadataEntityInner.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.models.MetadataSupportedValueDetail; +import com.azure.resourcemanager.resourcehealth.models.Scenario; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The metadata entity contract. */ +@Fluent +public final class MetadataEntityInner extends ProxyResource { + /* + * The metadata entity properties. + */ + @JsonProperty(value = "properties") + private MetadataEntityProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of MetadataEntityInner class. */ + public MetadataEntityInner() { + } + + /** + * Get the innerProperties property: The metadata entity properties. + * + * @return the innerProperties value. + */ + private MetadataEntityProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the displayName property: The display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name. + * + * @param displayName the displayName value to set. + * @return the MetadataEntityInner object itself. + */ + public MetadataEntityInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataEntityProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the dependsOn property: The list of keys on which this entity depends on. + * + * @return the dependsOn value. + */ + public List dependsOn() { + return this.innerProperties() == null ? null : this.innerProperties().dependsOn(); + } + + /** + * Set the dependsOn property: The list of keys on which this entity depends on. + * + * @param dependsOn the dependsOn value to set. + * @return the MetadataEntityInner object itself. + */ + public MetadataEntityInner withDependsOn(List dependsOn) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataEntityProperties(); + } + this.innerProperties().withDependsOn(dependsOn); + return this; + } + + /** + * Get the applicableScenarios property: The list of scenarios applicable to this metadata entity. + * + * @return the applicableScenarios value. + */ + public List applicableScenarios() { + return this.innerProperties() == null ? null : this.innerProperties().applicableScenarios(); + } + + /** + * Set the applicableScenarios property: The list of scenarios applicable to this metadata entity. + * + * @param applicableScenarios the applicableScenarios value to set. + * @return the MetadataEntityInner object itself. + */ + public MetadataEntityInner withApplicableScenarios(List applicableScenarios) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataEntityProperties(); + } + this.innerProperties().withApplicableScenarios(applicableScenarios); + return this; + } + + /** + * Get the supportedValues property: The list of supported values. + * + * @return the supportedValues value. + */ + public List supportedValues() { + return this.innerProperties() == null ? null : this.innerProperties().supportedValues(); + } + + /** + * Set the supportedValues property: The list of supported values. + * + * @param supportedValues the supportedValues value to set. + * @return the MetadataEntityInner object itself. + */ + public MetadataEntityInner withSupportedValues(List supportedValues) { + if (this.innerProperties() == null) { + this.innerProperties = new MetadataEntityProperties(); + } + this.innerProperties().withSupportedValues(supportedValues); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/MetadataEntityProperties.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/MetadataEntityProperties.java new file mode 100644 index 000000000000..37af7118aae0 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/fluent/models/MetadataEntityProperties.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.resourcehealth.models.MetadataSupportedValueDetail; +import com.azure.resourcemanager.resourcehealth.models.Scenario; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The metadata entity properties. */ +@Fluent +public final class MetadataEntityProperties { + /* + * The display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The list of keys on which this entity depends on. + */ + @JsonProperty(value = "dependsOn") + private List dependsOn; + + /* + * The list of scenarios applicable to this metadata entity. + */ + @JsonProperty(value = "applicableScenarios") + private List applicableScenarios; + + /* + * The list of supported values. + */ + @JsonProperty(value = "supportedValues") + private List supportedValues; + + /** Creates an instance of MetadataEntityProperties class. */ + public MetadataEntityProperties() { + } + + /** + * Get the displayName property: The display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name. + * + * @param displayName the displayName value to set. + * @return the MetadataEntityProperties object itself. + */ + public MetadataEntityProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the dependsOn property: The list of keys on which this entity depends on. + * + * @return the dependsOn value. + */ + public List dependsOn() { + return this.dependsOn; + } + + /** + * Set the dependsOn property: The list of keys on which this entity depends on. + * + * @param dependsOn the dependsOn value to set. + * @return the MetadataEntityProperties object itself. + */ + public MetadataEntityProperties withDependsOn(List dependsOn) { + this.dependsOn = dependsOn; + return this; + } + + /** + * Get the applicableScenarios property: The list of scenarios applicable to this metadata entity. + * + * @return the applicableScenarios value. + */ + public List applicableScenarios() { + return this.applicableScenarios; + } + + /** + * Set the applicableScenarios property: The list of scenarios applicable to this metadata entity. + * + * @param applicableScenarios the applicableScenarios value to set. + * @return the MetadataEntityProperties object itself. + */ + public MetadataEntityProperties withApplicableScenarios(List applicableScenarios) { + this.applicableScenarios = applicableScenarios; + return this; + } + + /** + * Get the supportedValues property: The list of supported values. + * + * @return the supportedValues value. + */ + public List supportedValues() { + return this.supportedValues; + } + + /** + * Set the supportedValues property: The list of supported values. + * + * @param supportedValues the supportedValues value to set. + * @return the MetadataEntityProperties object itself. + */ + public MetadataEntityProperties withSupportedValues(List supportedValues) { + this.supportedValues = supportedValues; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedValues() != null) { + supportedValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesClientImpl.java new file mode 100644 index 000000000000..1c7a14bd4b82 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesClientImpl.java @@ -0,0 +1,511 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.ChildAvailabilityStatusesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.AvailabilityStatusInner; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatusListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ChildAvailabilityStatusesClient. */ +public final class ChildAvailabilityStatusesClientImpl implements ChildAvailabilityStatusesClient { + /** The proxy service used to perform REST calls. */ + private final ChildAvailabilityStatusesService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of ChildAvailabilityStatusesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ChildAvailabilityStatusesClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy + .create( + ChildAvailabilityStatusesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthChildAvailabilityStatuses to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface ChildAvailabilityStatusesService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets current availability status for a single resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current availability status for a single resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceWithResponseAsync( + String resourceUri, String filter, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResource( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + filter, + expand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets current availability status for a single resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current availability status for a single resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceWithResponseAsync( + String resourceUri, String filter, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResource( + this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), filter, expand, accept, context); + } + + /** + * Gets current availability status for a single resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current availability status for a single resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceAsync(String resourceUri) { + final String filter = null; + final String expand = null; + return getByResourceWithResponseAsync(resourceUri, filter, expand) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets current availability status for a single resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current availability status for a single resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceWithResponse( + String resourceUri, String filter, String expand, Context context) { + return getByResourceWithResponseAsync(resourceUri, filter, expand, context).block(); + } + + /** + * Gets current availability status for a single resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current availability status for a single resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailabilityStatusInner getByResource(String resourceUri) { + final String filter = null; + final String expand = null; + return getByResourceWithResponse(resourceUri, filter, expand, Context.NONE).getValue(); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, String filter, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + filter, + expand, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, String filter, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), filter, expand, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, String filter, String expand) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, filter, expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + final String filter = null; + final String expand = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, filter, expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceUri, String filter, String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, filter, expand, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + final String filter = null; + final String expand = null; + return new PagedIterable<>(listAsync(resourceUri, filter, expand)); + } + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceUri, String filter, String expand, Context context) { + return new PagedIterable<>(listAsync(resourceUri, filter, expand, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesImpl.java new file mode 100644 index 000000000000..6291c177321e --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildAvailabilityStatusesImpl.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.ChildAvailabilityStatusesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.AvailabilityStatusInner; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatus; +import com.azure.resourcemanager.resourcehealth.models.ChildAvailabilityStatuses; + +public final class ChildAvailabilityStatusesImpl implements ChildAvailabilityStatuses { + private static final ClientLogger LOGGER = new ClientLogger(ChildAvailabilityStatusesImpl.class); + + private final ChildAvailabilityStatusesClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public ChildAvailabilityStatusesImpl( + ChildAvailabilityStatusesClient innerClient, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceWithResponse( + String resourceUri, String filter, String expand, Context context) { + Response inner = + this.serviceClient().getByResourceWithResponse(resourceUri, filter, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AvailabilityStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AvailabilityStatus getByResource(String resourceUri) { + AvailabilityStatusInner inner = this.serviceClient().getByResource(resourceUri); + if (inner != null) { + return new AvailabilityStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return Utils.mapPage(inner, inner1 -> new AvailabilityStatusImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, String filter, String expand, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, filter, expand, context); + return Utils.mapPage(inner, inner1 -> new AvailabilityStatusImpl(inner1, this.manager())); + } + + private ChildAvailabilityStatusesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildResourcesClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildResourcesClientImpl.java new file mode 100644 index 000000000000..e58dbdbb60ba --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildResourcesClientImpl.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.ChildResourcesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.AvailabilityStatusInner; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatusListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ChildResourcesClient. */ +public final class ChildResourcesClientImpl implements ChildResourcesClient { + /** The proxy service used to perform REST calls. */ + private final ChildResourcesService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of ChildResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ChildResourcesClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy.create(ChildResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthChildResources to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface ChildResourcesService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.ResourceHealth/childResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, String filter, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + filter, + expand, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, String filter, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), filter, expand, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, String filter, String expand) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, filter, expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + final String filter = null; + final String expand = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, filter, expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceUri, String filter, String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, filter, expand, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + final String filter = null; + final String expand = null; + return new PagedIterable<>(listAsync(resourceUri, filter, expand)); + } + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceUri, String filter, String expand, Context context) { + return new PagedIterable<>(listAsync(resourceUri, filter, expand, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildResourcesImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildResourcesImpl.java new file mode 100644 index 000000000000..2f7ed118d0c5 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ChildResourcesImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcehealth.fluent.ChildResourcesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.AvailabilityStatusInner; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatus; +import com.azure.resourcemanager.resourcehealth.models.ChildResources; + +public final class ChildResourcesImpl implements ChildResources { + private static final ClientLogger LOGGER = new ClientLogger(ChildResourcesImpl.class); + + private final ChildResourcesClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public ChildResourcesImpl( + ChildResourcesClient innerClient, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return Utils.mapPage(inner, inner1 -> new AvailabilityStatusImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, String filter, String expand, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, filter, expand, context); + return Utils.mapPage(inner, inner1 -> new AvailabilityStatusImpl(inner1, this.manager())); + } + + private ChildResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesClientImpl.java new file mode 100644 index 000000000000..38b9fa4b4391 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesClientImpl.java @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.EmergingIssuesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssueListResult; +import com.azure.resourcemanager.resourcehealth.models.IssueNameParameter; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EmergingIssuesClient. */ +public final class EmergingIssuesClientImpl implements EmergingIssuesClient { + /** The proxy service used to perform REST calls. */ + private final EmergingIssuesService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of EmergingIssuesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EmergingIssuesClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy.create(EmergingIssuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthEmergingIssues to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface EmergingIssuesService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/emergingIssues") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("issueName") IssueNameParameter issueName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists Azure services' emerging issues. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of emerging issues along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists Azure services' emerging issues. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of emerging issues along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists Azure services' emerging issues. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of emerging issues as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists Azure services' emerging issues. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of emerging issues as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists Azure services' emerging issues. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of emerging issues as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists Azure services' emerging issues. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of emerging issues as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure services' emerging issues along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(IssueNameParameter issueName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (issueName == null) { + return Mono.error(new IllegalArgumentException("Parameter issueName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.get(this.client.getEndpoint(), issueName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure services' emerging issues along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + IssueNameParameter issueName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (issueName == null) { + return Mono.error(new IllegalArgumentException("Parameter issueName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), issueName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure services' emerging issues on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(IssueNameParameter issueName) { + return getWithResponseAsync(issueName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure services' emerging issues along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(IssueNameParameter issueName, Context context) { + return getWithResponseAsync(issueName, context).block(); + } + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure services' emerging issues. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EmergingIssuesGetResultInner get(IssueNameParameter issueName) { + return getWithResponse(issueName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of emerging issues along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of emerging issues along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesGetResultImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesGetResultImpl.java new file mode 100644 index 000000000000..a72dc6153694 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesGetResultImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssuesGetResult; +import com.azure.resourcemanager.resourcehealth.models.StatusActiveEvent; +import com.azure.resourcemanager.resourcehealth.models.StatusBanner; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class EmergingIssuesGetResultImpl implements EmergingIssuesGetResult { + private EmergingIssuesGetResultInner innerObject; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + EmergingIssuesGetResultImpl( + EmergingIssuesGetResultInner innerObject, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public OffsetDateTime refreshTimestamp() { + return this.innerModel().refreshTimestamp(); + } + + public List statusBanners() { + List inner = this.innerModel().statusBanners(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List statusActiveEvents() { + List inner = this.innerModel().statusActiveEvents(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EmergingIssuesGetResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesImpl.java new file mode 100644 index 000000000000..f1e6458d47a6 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EmergingIssuesImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.EmergingIssuesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssues; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssuesGetResult; +import com.azure.resourcemanager.resourcehealth.models.IssueNameParameter; + +public final class EmergingIssuesImpl implements EmergingIssues { + private static final ClientLogger LOGGER = new ClientLogger(EmergingIssuesImpl.class); + + private final EmergingIssuesClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public EmergingIssuesImpl( + EmergingIssuesClient innerClient, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new EmergingIssuesGetResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new EmergingIssuesGetResultImpl(inner1, this.manager())); + } + + public Response getWithResponse(IssueNameParameter issueName, Context context) { + Response inner = this.serviceClient().getWithResponse(issueName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EmergingIssuesGetResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EmergingIssuesGetResult get(IssueNameParameter issueName) { + EmergingIssuesGetResultInner inner = this.serviceClient().get(issueName); + if (inner != null) { + return new EmergingIssuesGetResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private EmergingIssuesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpactedResourceImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpactedResourceImpl.java new file mode 100644 index 000000000000..86d7682e0ea2 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpactedResourceImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResource; +import com.azure.resourcemanager.resourcehealth.models.KeyValueItem; +import java.util.Collections; +import java.util.List; + +public final class EventImpactedResourceImpl implements EventImpactedResource { + private EventImpactedResourceInner innerObject; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + EventImpactedResourceImpl( + EventImpactedResourceInner innerObject, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String targetResourceType() { + return this.innerModel().targetResourceType(); + } + + public String targetResourceId() { + return this.innerModel().targetResourceId(); + } + + public String targetRegion() { + return this.innerModel().targetRegion(); + } + + public List info() { + List inner = this.innerModel().info(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EventImpactedResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpl.java new file mode 100644 index 000000000000..01b3c0c02481 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventImpl.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import com.azure.resourcemanager.resourcehealth.models.Event; +import com.azure.resourcemanager.resourcehealth.models.EventLevelValues; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesAdditionalInformation; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesArticle; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesRecommendedActions; +import com.azure.resourcemanager.resourcehealth.models.EventSourceValues; +import com.azure.resourcemanager.resourcehealth.models.EventStatusValues; +import com.azure.resourcemanager.resourcehealth.models.EventTypeValues; +import com.azure.resourcemanager.resourcehealth.models.Faq; +import com.azure.resourcemanager.resourcehealth.models.Impact; +import com.azure.resourcemanager.resourcehealth.models.LevelValues; +import com.azure.resourcemanager.resourcehealth.models.Link; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class EventImpl implements Event { + private EventInner innerObject; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + EventImpl(EventInner innerObject, com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public EventTypeValues eventType() { + return this.innerModel().eventType(); + } + + public EventSourceValues eventSource() { + return this.innerModel().eventSource(); + } + + public EventStatusValues status() { + return this.innerModel().status(); + } + + public String title() { + return this.innerModel().title(); + } + + public String summary() { + return this.innerModel().summary(); + } + + public String headerProperty() { + return this.innerModel().headerProperty(); + } + + public LevelValues level() { + return this.innerModel().level(); + } + + public EventLevelValues eventLevel() { + return this.innerModel().eventLevel(); + } + + public String externalIncidentId() { + return this.innerModel().externalIncidentId(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public EventPropertiesArticle article() { + return this.innerModel().article(); + } + + public List links() { + List inner = this.innerModel().links(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime impactStartTime() { + return this.innerModel().impactStartTime(); + } + + public OffsetDateTime impactMitigationTime() { + return this.innerModel().impactMitigationTime(); + } + + public List impact() { + List inner = this.innerModel().impact(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EventPropertiesRecommendedActions recommendedActions() { + return this.innerModel().recommendedActions(); + } + + public List faqs() { + List inner = this.innerModel().faqs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean isHir() { + return this.innerModel().isHir(); + } + + public Boolean enableMicrosoftSupport() { + return this.innerModel().enableMicrosoftSupport(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean platformInitiated() { + return this.innerModel().platformInitiated(); + } + + public Boolean enableChatWithUs() { + return this.innerModel().enableChatWithUs(); + } + + public Integer priority() { + return this.innerModel().priority(); + } + + public OffsetDateTime lastUpdateTime() { + return this.innerModel().lastUpdateTime(); + } + + public String hirStage() { + return this.innerModel().hirStage(); + } + + public EventPropertiesAdditionalInformation additionalInformation() { + return this.innerModel().additionalInformation(); + } + + public Integer duration() { + return this.innerModel().duration(); + } + + public String impactType() { + return this.innerModel().impactType(); + } + + public EventInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsClientImpl.java new file mode 100644 index 000000000000..017b2d09932e --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsClientImpl.java @@ -0,0 +1,637 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.resourcehealth.fluent.EventOperationsClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EventOperationsClient. */ +public final class EventOperationsClientImpl implements EventOperationsClient { + /** The proxy service used to perform REST calls. */ + private final EventOperationsService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of EventOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EventOperationsClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy.create(EventOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthEventOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface EventOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getBySubscriptionIdAndTrackingId( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("queryStartTime") String queryStartTime, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("eventTrackingId") String eventTrackingId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> fetchDetailsBySubscriptionIdAndTrackingId( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("eventTrackingId") String eventTrackingId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByTenantIdAndTrackingId( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("queryStartTime") String queryStartTime, + @PathParam("eventTrackingId") String eventTrackingId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> fetchDetailsByTenantIdAndTrackingId( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("eventTrackingId") String eventTrackingId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBySubscriptionIdAndTrackingIdWithResponseAsync( + String eventTrackingId, String filter, String queryStartTime) { + 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 (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getBySubscriptionIdAndTrackingId( + this.client.getEndpoint(), + this.client.getApiVersion(), + filter, + queryStartTime, + this.client.getSubscriptionId(), + eventTrackingId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBySubscriptionIdAndTrackingIdWithResponseAsync( + String eventTrackingId, String filter, String queryStartTime, 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 (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getBySubscriptionIdAndTrackingId( + this.client.getEndpoint(), + this.client.getApiVersion(), + filter, + queryStartTime, + this.client.getSubscriptionId(), + eventTrackingId, + accept, + context); + } + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getBySubscriptionIdAndTrackingIdAsync(String eventTrackingId) { + final String filter = null; + final String queryStartTime = null; + return getBySubscriptionIdAndTrackingIdWithResponseAsync(eventTrackingId, filter, queryStartTime) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getBySubscriptionIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context) { + return getBySubscriptionIdAndTrackingIdWithResponseAsync(eventTrackingId, filter, queryStartTime, context) + .block(); + } + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventInner getBySubscriptionIdAndTrackingId(String eventTrackingId) { + final String filter = null; + final String queryStartTime = null; + return getBySubscriptionIdAndTrackingIdWithResponse(eventTrackingId, filter, queryStartTime, Context.NONE) + .getValue(); + } + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> fetchDetailsBySubscriptionIdAndTrackingIdWithResponseAsync( + String eventTrackingId) { + 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 (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .fetchDetailsBySubscriptionIdAndTrackingId( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + eventTrackingId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> fetchDetailsBySubscriptionIdAndTrackingIdWithResponseAsync( + String eventTrackingId, 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 (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .fetchDetailsBySubscriptionIdAndTrackingId( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + eventTrackingId, + accept, + context); + } + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono fetchDetailsBySubscriptionIdAndTrackingIdAsync(String eventTrackingId) { + return fetchDetailsBySubscriptionIdAndTrackingIdWithResponseAsync(eventTrackingId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fetchDetailsBySubscriptionIdAndTrackingIdWithResponse( + String eventTrackingId, Context context) { + return fetchDetailsBySubscriptionIdAndTrackingIdWithResponseAsync(eventTrackingId, context).block(); + } + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventInner fetchDetailsBySubscriptionIdAndTrackingId(String eventTrackingId) { + return fetchDetailsBySubscriptionIdAndTrackingIdWithResponse(eventTrackingId, Context.NONE).getValue(); + } + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByTenantIdAndTrackingIdWithResponseAsync( + String eventTrackingId, String filter, String queryStartTime) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByTenantIdAndTrackingId( + this.client.getEndpoint(), + this.client.getApiVersion(), + filter, + queryStartTime, + eventTrackingId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByTenantIdAndTrackingIdWithResponseAsync( + String eventTrackingId, String filter, String queryStartTime, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByTenantIdAndTrackingId( + this.client.getEndpoint(), + this.client.getApiVersion(), + filter, + queryStartTime, + eventTrackingId, + accept, + context); + } + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByTenantIdAndTrackingIdAsync(String eventTrackingId) { + final String filter = null; + final String queryStartTime = null; + return getByTenantIdAndTrackingIdWithResponseAsync(eventTrackingId, filter, queryStartTime) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByTenantIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context) { + return getByTenantIdAndTrackingIdWithResponseAsync(eventTrackingId, filter, queryStartTime, context).block(); + } + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventInner getByTenantIdAndTrackingId(String eventTrackingId) { + final String filter = null; + final String queryStartTime = null; + return getByTenantIdAndTrackingIdWithResponse(eventTrackingId, filter, queryStartTime, Context.NONE).getValue(); + } + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> fetchDetailsByTenantIdAndTrackingIdWithResponseAsync(String eventTrackingId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .fetchDetailsByTenantIdAndTrackingId( + this.client.getEndpoint(), this.client.getApiVersion(), eventTrackingId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> fetchDetailsByTenantIdAndTrackingIdWithResponseAsync( + String eventTrackingId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .fetchDetailsByTenantIdAndTrackingId( + this.client.getEndpoint(), this.client.getApiVersion(), eventTrackingId, accept, context); + } + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono fetchDetailsByTenantIdAndTrackingIdAsync(String eventTrackingId) { + return fetchDetailsByTenantIdAndTrackingIdWithResponseAsync(eventTrackingId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fetchDetailsByTenantIdAndTrackingIdWithResponse( + String eventTrackingId, Context context) { + return fetchDetailsByTenantIdAndTrackingIdWithResponseAsync(eventTrackingId, context).block(); + } + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventInner fetchDetailsByTenantIdAndTrackingId(String eventTrackingId) { + return fetchDetailsByTenantIdAndTrackingIdWithResponse(eventTrackingId, Context.NONE).getValue(); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsImpl.java new file mode 100644 index 000000000000..a381bbb2838a --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventOperationsImpl.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcehealth.fluent.EventOperationsClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import com.azure.resourcemanager.resourcehealth.models.Event; +import com.azure.resourcemanager.resourcehealth.models.EventOperations; + +public final class EventOperationsImpl implements EventOperations { + private static final ClientLogger LOGGER = new ClientLogger(EventOperationsImpl.class); + + private final EventOperationsClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public EventOperationsImpl( + EventOperationsClient innerClient, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getBySubscriptionIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context) { + Response inner = + this + .serviceClient() + .getBySubscriptionIdAndTrackingIdWithResponse(eventTrackingId, filter, queryStartTime, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EventImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Event getBySubscriptionIdAndTrackingId(String eventTrackingId) { + EventInner inner = this.serviceClient().getBySubscriptionIdAndTrackingId(eventTrackingId); + if (inner != null) { + return new EventImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response fetchDetailsBySubscriptionIdAndTrackingIdWithResponse( + String eventTrackingId, Context context) { + Response inner = + this.serviceClient().fetchDetailsBySubscriptionIdAndTrackingIdWithResponse(eventTrackingId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EventImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Event fetchDetailsBySubscriptionIdAndTrackingId(String eventTrackingId) { + EventInner inner = this.serviceClient().fetchDetailsBySubscriptionIdAndTrackingId(eventTrackingId); + if (inner != null) { + return new EventImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByTenantIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context) { + Response inner = + this + .serviceClient() + .getByTenantIdAndTrackingIdWithResponse(eventTrackingId, filter, queryStartTime, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EventImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Event getByTenantIdAndTrackingId(String eventTrackingId) { + EventInner inner = this.serviceClient().getByTenantIdAndTrackingId(eventTrackingId); + if (inner != null) { + return new EventImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response fetchDetailsByTenantIdAndTrackingIdWithResponse(String eventTrackingId, Context context) { + Response inner = + this.serviceClient().fetchDetailsByTenantIdAndTrackingIdWithResponse(eventTrackingId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EventImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Event fetchDetailsByTenantIdAndTrackingId(String eventTrackingId) { + EventInner inner = this.serviceClient().fetchDetailsByTenantIdAndTrackingId(eventTrackingId); + if (inner != null) { + return new EventImpl(inner, this.manager()); + } else { + return null; + } + } + + private EventOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsClientImpl.java new file mode 100644 index 000000000000..8f5557f58bfa --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsClientImpl.java @@ -0,0 +1,915 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.EventsOperationsClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import com.azure.resourcemanager.resourcehealth.models.Events; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EventsOperationsClient. */ +public final class EventsOperationsClientImpl implements EventsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final EventsOperationsService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of EventsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EventsOperationsClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy.create(EventsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthEventsOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface EventsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("queryStartTime") String queryStartTime, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/events") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantId( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("queryStartTime") String queryStartTime, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.ResourceHealth/events") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySingleResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionIdNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantIdNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySingleResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, String queryStartTime) { + 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(), + filter, + queryStartTime, + 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())); + } + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, String queryStartTime, 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(), + filter, + queryStartTime, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String queryStartTime) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, queryStartTime), + nextLink -> listBySubscriptionIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists service health events in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + final String queryStartTime = null; + return new PagedFlux<>( + () -> listSinglePageAsync(filter, queryStartTime), + nextLink -> listBySubscriptionIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String queryStartTime, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, queryStartTime, context), + nextLink -> listBySubscriptionIdNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists service health events in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + final String queryStartTime = null; + return new PagedIterable<>(listAsync(filter, queryStartTime)); + } + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, String queryStartTime, Context context) { + return new PagedIterable<>(listAsync(filter, queryStartTime, context)); + } + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdSinglePageAsync(String filter, String queryStartTime) { + 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 + .listByTenantId( + this.client.getEndpoint(), + this.client.getApiVersion(), + filter, + queryStartTime, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdSinglePageAsync( + String filter, String queryStartTime, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByTenantId( + this.client.getEndpoint(), this.client.getApiVersion(), filter, queryStartTime, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantIdAsync(String filter, String queryStartTime) { + return new PagedFlux<>( + () -> listByTenantIdSinglePageAsync(filter, queryStartTime), + nextLink -> listByTenantIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists current service health events in the tenant. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantIdAsync() { + final String filter = null; + final String queryStartTime = null; + return new PagedFlux<>( + () -> listByTenantIdSinglePageAsync(filter, queryStartTime), + nextLink -> listByTenantIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantIdAsync(String filter, String queryStartTime, Context context) { + return new PagedFlux<>( + () -> listByTenantIdSinglePageAsync(filter, queryStartTime, context), + nextLink -> listByTenantIdNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists current service health events in the tenant. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTenantId() { + final String filter = null; + final String queryStartTime = null; + return new PagedIterable<>(listByTenantIdAsync(filter, queryStartTime)); + } + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTenantId(String filter, String queryStartTime, Context context) { + return new PagedIterable<>(listByTenantIdAsync(filter, queryStartTime, context)); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySingleResourceSinglePageAsync(String resourceUri, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySingleResource( + this.client.getEndpoint(), + resourceUri, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySingleResourceSinglePageAsync( + String resourceUri, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySingleResource( + this.client.getEndpoint(), resourceUri, this.client.getApiVersion(), filter, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySingleResourceAsync(String resourceUri, String filter) { + return new PagedFlux<>( + () -> listBySingleResourceSinglePageAsync(resourceUri, filter), + nextLink -> listBySingleResourceNextSinglePageAsync(nextLink)); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySingleResourceAsync(String resourceUri) { + final String filter = null; + return new PagedFlux<>( + () -> listBySingleResourceSinglePageAsync(resourceUri, filter), + nextLink -> listBySingleResourceNextSinglePageAsync(nextLink)); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySingleResourceAsync(String resourceUri, String filter, Context context) { + return new PagedFlux<>( + () -> listBySingleResourceSinglePageAsync(resourceUri, filter, context), + nextLink -> listBySingleResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySingleResource(String resourceUri) { + final String filter = null; + return new PagedIterable<>(listBySingleResourceAsync(resourceUri, filter)); + } + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySingleResource(String resourceUri, String filter, Context context) { + return new PagedIterable<>(listBySingleResourceAsync(resourceUri, filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdNextSinglePageAsync(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.listBySubscriptionIdNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdNextSinglePageAsync(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 + .listBySubscriptionIdNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdNextSinglePageAsync(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.listByTenantIdNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdNextSinglePageAsync(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 + .listByTenantIdNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySingleResourceNextSinglePageAsync(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.listBySingleResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySingleResourceNextSinglePageAsync(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 + .listBySingleResourceNext(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/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsImpl.java new file mode 100644 index 000000000000..92e0ba02b5e2 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/EventsOperationsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcehealth.fluent.EventsOperationsClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import com.azure.resourcemanager.resourcehealth.models.Event; +import com.azure.resourcemanager.resourcehealth.models.EventsOperations; + +public final class EventsOperationsImpl implements EventsOperations { + private static final ClientLogger LOGGER = new ClientLogger(EventsOperationsImpl.class); + + private final EventsOperationsClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public EventsOperationsImpl( + EventsOperationsClient innerClient, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, String queryStartTime, Context context) { + PagedIterable inner = this.serviceClient().list(filter, queryStartTime, context); + return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager())); + } + + public PagedIterable listByTenantId() { + PagedIterable inner = this.serviceClient().listByTenantId(); + return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager())); + } + + public PagedIterable listByTenantId(String filter, String queryStartTime, Context context) { + PagedIterable inner = this.serviceClient().listByTenantId(filter, queryStartTime, context); + return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager())); + } + + public PagedIterable listBySingleResource(String resourceUri) { + PagedIterable inner = this.serviceClient().listBySingleResource(resourceUri); + return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager())); + } + + public PagedIterable listBySingleResource(String resourceUri, String filter, Context context) { + PagedIterable inner = this.serviceClient().listBySingleResource(resourceUri, filter, context); + return Utils.mapPage(inner, inner1 -> new EventImpl(inner1, this.manager())); + } + + private EventsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesClientImpl.java new file mode 100644 index 000000000000..e03343120cf9 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesClientImpl.java @@ -0,0 +1,944 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.ImpactedResourcesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResourceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ImpactedResourcesClient. */ +public final class ImpactedResourcesClientImpl implements ImpactedResourcesClient { + /** The proxy service used to perform REST calls. */ + private final ImpactedResourcesService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of ImpactedResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ImpactedResourcesClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy.create(ImpactedResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthImpactedResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface ImpactedResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionIdAndEventId( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("eventTrackingId") String eventTrackingId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("eventTrackingId") String eventTrackingId, + @PathParam("impactedResourceName") String impactedResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantIdAndEventId( + @HostParam("$host") String endpoint, + @PathParam("eventTrackingId") String eventTrackingId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByTenantId( + @HostParam("$host") String endpoint, + @PathParam("eventTrackingId") String eventTrackingId, + @PathParam("impactedResourceName") String impactedResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionIdAndEventIdNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantIdAndEventIdNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdAndEventIdSinglePageAsync( + String eventTrackingId, String filter) { + 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 (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySubscriptionIdAndEventId( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + eventTrackingId, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdAndEventIdSinglePageAsync( + String eventTrackingId, String filter, 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 (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionIdAndEventId( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + eventTrackingId, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionIdAndEventIdAsync( + String eventTrackingId, String filter) { + return new PagedFlux<>( + () -> listBySubscriptionIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listBySubscriptionIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionIdAndEventIdAsync(String eventTrackingId) { + final String filter = null; + return new PagedFlux<>( + () -> listBySubscriptionIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listBySubscriptionIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionIdAndEventIdAsync( + String eventTrackingId, String filter, Context context) { + return new PagedFlux<>( + () -> listBySubscriptionIdAndEventIdSinglePageAsync(eventTrackingId, filter, context), + nextLink -> listBySubscriptionIdAndEventIdNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscriptionIdAndEventId(String eventTrackingId) { + final String filter = null; + return new PagedIterable<>(listBySubscriptionIdAndEventIdAsync(eventTrackingId, filter)); + } + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscriptionIdAndEventId( + String eventTrackingId, String filter, Context context) { + return new PagedIterable<>(listBySubscriptionIdAndEventIdAsync(eventTrackingId, filter, context)); + } + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String eventTrackingId, String impactedResourceName) { + 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 (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + if (impactedResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter impactedResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + eventTrackingId, + impactedResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String eventTrackingId, String impactedResourceName, 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 (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + if (impactedResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter impactedResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + eventTrackingId, + impactedResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String eventTrackingId, String impactedResourceName) { + return getWithResponseAsync(eventTrackingId, impactedResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String eventTrackingId, String impactedResourceName, Context context) { + return getWithResponseAsync(eventTrackingId, impactedResourceName, context).block(); + } + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventImpactedResourceInner get(String eventTrackingId, String impactedResourceName) { + return getWithResponse(eventTrackingId, impactedResourceName, Context.NONE).getValue(); + } + + /** + * Lists impacted resources in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdAndEventIdSinglePageAsync( + String eventTrackingId, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByTenantIdAndEventId( + this.client.getEndpoint(), + eventTrackingId, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists impacted resources in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdAndEventIdSinglePageAsync( + String eventTrackingId, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByTenantIdAndEventId( + this.client.getEndpoint(), eventTrackingId, this.client.getApiVersion(), filter, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists impacted resources in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantIdAndEventIdAsync(String eventTrackingId, String filter) { + return new PagedFlux<>( + () -> listByTenantIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listByTenantIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantIdAndEventIdAsync(String eventTrackingId) { + final String filter = null; + return new PagedFlux<>( + () -> listByTenantIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listByTenantIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantIdAndEventIdAsync( + String eventTrackingId, String filter, Context context) { + return new PagedFlux<>( + () -> listByTenantIdAndEventIdSinglePageAsync(eventTrackingId, filter, context), + nextLink -> listByTenantIdAndEventIdNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists impacted resources in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTenantIdAndEventId(String eventTrackingId) { + final String filter = null; + return new PagedIterable<>(listByTenantIdAndEventIdAsync(eventTrackingId, filter)); + } + + /** + * Lists impacted resources in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context) { + return new PagedIterable<>(listByTenantIdAndEventIdAsync(eventTrackingId, filter, context)); + } + + /** + * Gets the specific impacted resource in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the tenant by an event along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByTenantIdWithResponseAsync( + String eventTrackingId, String impactedResourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + if (impactedResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter impactedResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByTenantId( + this.client.getEndpoint(), + eventTrackingId, + impactedResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specific impacted resource in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the tenant by an event along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByTenantIdWithResponseAsync( + String eventTrackingId, String impactedResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + if (impactedResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter impactedResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByTenantId( + this.client.getEndpoint(), + eventTrackingId, + impactedResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the specific impacted resource in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the tenant by an event on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByTenantIdAsync(String eventTrackingId, String impactedResourceName) { + return getByTenantIdWithResponseAsync(eventTrackingId, impactedResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specific impacted resource in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the tenant by an event along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByTenantIdWithResponse( + String eventTrackingId, String impactedResourceName, Context context) { + return getByTenantIdWithResponseAsync(eventTrackingId, impactedResourceName, context).block(); + } + + /** + * Gets the specific impacted resource in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the tenant by an event. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventImpactedResourceInner getByTenantId(String eventTrackingId, String impactedResourceName) { + return getByTenantIdWithResponse(eventTrackingId, impactedResourceName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdAndEventIdNextSinglePageAsync( + 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.listBySubscriptionIdAndEventIdNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdAndEventIdNextSinglePageAsync( + 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 + .listBySubscriptionIdAndEventIdNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdAndEventIdNextSinglePageAsync( + 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.listByTenantIdAndEventIdNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdAndEventIdNextSinglePageAsync( + 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 + .listByTenantIdAndEventIdNext(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/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesImpl.java new file mode 100644 index 000000000000..69920bd10a29 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/ImpactedResourcesImpl.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.ImpactedResourcesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResource; +import com.azure.resourcemanager.resourcehealth.models.ImpactedResources; + +public final class ImpactedResourcesImpl implements ImpactedResources { + private static final ClientLogger LOGGER = new ClientLogger(ImpactedResourcesImpl.class); + + private final ImpactedResourcesClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public ImpactedResourcesImpl( + ImpactedResourcesClient innerClient, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySubscriptionIdAndEventId(String eventTrackingId) { + PagedIterable inner = + this.serviceClient().listBySubscriptionIdAndEventId(eventTrackingId); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscriptionIdAndEventId( + String eventTrackingId, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listBySubscriptionIdAndEventId(eventTrackingId, filter, context); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String eventTrackingId, String impactedResourceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(eventTrackingId, impactedResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EventImpactedResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EventImpactedResource get(String eventTrackingId, String impactedResourceName) { + EventImpactedResourceInner inner = this.serviceClient().get(eventTrackingId, impactedResourceName); + if (inner != null) { + return new EventImpactedResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByTenantIdAndEventId(String eventTrackingId) { + PagedIterable inner = + this.serviceClient().listByTenantIdAndEventId(eventTrackingId); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByTenantIdAndEventId(eventTrackingId, filter, context); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + public Response getByTenantIdWithResponse( + String eventTrackingId, String impactedResourceName, Context context) { + Response inner = + this.serviceClient().getByTenantIdWithResponse(eventTrackingId, impactedResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EventImpactedResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EventImpactedResource getByTenantId(String eventTrackingId, String impactedResourceName) { + EventImpactedResourceInner inner = this.serviceClient().getByTenantId(eventTrackingId, impactedResourceName); + if (inner != null) { + return new EventImpactedResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + private ImpactedResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadataEntityImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadataEntityImpl.java new file mode 100644 index 000000000000..d0627220448c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadataEntityImpl.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.fluent.models.MetadataEntityInner; +import com.azure.resourcemanager.resourcehealth.models.MetadataEntity; +import com.azure.resourcemanager.resourcehealth.models.MetadataSupportedValueDetail; +import com.azure.resourcemanager.resourcehealth.models.Scenario; +import java.util.Collections; +import java.util.List; + +public final class MetadataEntityImpl implements MetadataEntity { + private MetadataEntityInner innerObject; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + MetadataEntityImpl( + MetadataEntityInner innerObject, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public List dependsOn() { + List inner = this.innerModel().dependsOn(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List applicableScenarios() { + List inner = this.innerModel().applicableScenarios(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List supportedValues() { + List inner = this.innerModel().supportedValues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MetadataEntityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadatasClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadatasClientImpl.java new file mode 100644 index 000000000000..3d1f6e56c500 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadatasClientImpl.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.MetadatasClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.MetadataEntityInner; +import com.azure.resourcemanager.resourcehealth.models.MetadataEntityListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MetadatasClient. */ +public final class MetadatasClientImpl implements MetadatasClient { + /** The proxy service used to perform REST calls. */ + private final MetadatasService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of MetadatasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MetadatasClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy.create(MetadatasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthMetadatas to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface MetadatasService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/metadata") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceHealth/metadata/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getEntity( + @HostParam("$host") String endpoint, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the list of metadata entities. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of metadata entities. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of metadata entities. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of metadata entities. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of metadata entities. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets the list of metadata entities. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getEntityWithResponseAsync(String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.getEntity(this.client.getEndpoint(), name, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getEntityWithResponseAsync(String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getEntity(this.client.getEndpoint(), name, this.client.getApiVersion(), accept, context); + } + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getEntityAsync(String name) { + return getEntityWithResponseAsync(name).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getEntityWithResponse(String name, Context context) { + return getEntityWithResponseAsync(name, context).block(); + } + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetadataEntityInner getEntity(String name) { + return getEntityWithResponse(name, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadatasImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadatasImpl.java new file mode 100644 index 000000000000..05b14251f38c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/MetadatasImpl.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.resourcehealth.fluent.MetadatasClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.MetadataEntityInner; +import com.azure.resourcemanager.resourcehealth.models.MetadataEntity; +import com.azure.resourcemanager.resourcehealth.models.Metadatas; + +public final class MetadatasImpl implements Metadatas { + private static final ClientLogger LOGGER = new ClientLogger(MetadatasImpl.class); + + private final MetadatasClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public MetadatasImpl( + MetadatasClient innerClient, com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new MetadataEntityImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new MetadataEntityImpl(inner1, this.manager())); + } + + public Response getEntityWithResponse(String name, Context context) { + Response inner = this.serviceClient().getEntityWithResponse(name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MetadataEntityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MetadataEntity getEntity(String name) { + MetadataEntityInner inner = this.serviceClient().getEntity(name); + if (inner != null) { + return new MetadataEntityImpl(inner, this.manager()); + } else { + return null; + } + } + + private MetadatasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesClientImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesClientImpl.java new file mode 100644 index 000000000000..e3120085004b --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesClientImpl.java @@ -0,0 +1,647 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.resourcehealth.fluent.SecurityAdvisoryImpactedResourcesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResourceListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SecurityAdvisoryImpactedResourcesClient. + */ +public final class SecurityAdvisoryImpactedResourcesClientImpl implements SecurityAdvisoryImpactedResourcesClient { + /** The proxy service used to perform REST calls. */ + private final SecurityAdvisoryImpactedResourcesService service; + + /** The service client containing this operation class. */ + private final MicrosoftResourceHealthImpl client; + + /** + * Initializes an instance of SecurityAdvisoryImpactedResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecurityAdvisoryImpactedResourcesClientImpl(MicrosoftResourceHealthImpl client) { + this.service = + RestProxy + .create( + SecurityAdvisoryImpactedResourcesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftResourceHealthSecurityAdvisoryImpactedResources to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftResourceHea") + public interface SecurityAdvisoryImpactedResourcesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionIdAndEventId( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("eventTrackingId") String eventTrackingId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantIdAndEventId( + @HostParam("$host") String endpoint, + @PathParam("eventTrackingId") String eventTrackingId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionIdAndEventIdNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantIdAndEventIdNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdAndEventIdSinglePageAsync( + String eventTrackingId, String filter) { + 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 (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySubscriptionIdAndEventId( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + eventTrackingId, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdAndEventIdSinglePageAsync( + String eventTrackingId, String filter, 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 (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionIdAndEventId( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + eventTrackingId, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionIdAndEventIdAsync( + String eventTrackingId, String filter) { + return new PagedFlux<>( + () -> listBySubscriptionIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listBySubscriptionIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionIdAndEventIdAsync(String eventTrackingId) { + final String filter = null; + return new PagedFlux<>( + () -> listBySubscriptionIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listBySubscriptionIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionIdAndEventIdAsync( + String eventTrackingId, String filter, Context context) { + return new PagedFlux<>( + () -> listBySubscriptionIdAndEventIdSinglePageAsync(eventTrackingId, filter, context), + nextLink -> listBySubscriptionIdAndEventIdNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscriptionIdAndEventId(String eventTrackingId) { + final String filter = null; + return new PagedIterable<>(listBySubscriptionIdAndEventIdAsync(eventTrackingId, filter)); + } + + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscriptionIdAndEventId( + String eventTrackingId, String filter, Context context) { + return new PagedIterable<>(listBySubscriptionIdAndEventIdAsync(eventTrackingId, filter, context)); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdAndEventIdSinglePageAsync( + String eventTrackingId, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByTenantIdAndEventId( + this.client.getEndpoint(), + eventTrackingId, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdAndEventIdSinglePageAsync( + String eventTrackingId, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (eventTrackingId == null) { + return Mono + .error(new IllegalArgumentException("Parameter eventTrackingId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByTenantIdAndEventId( + this.client.getEndpoint(), eventTrackingId, this.client.getApiVersion(), filter, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantIdAndEventIdAsync(String eventTrackingId, String filter) { + return new PagedFlux<>( + () -> listByTenantIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listByTenantIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantIdAndEventIdAsync(String eventTrackingId) { + final String filter = null; + return new PagedFlux<>( + () -> listByTenantIdAndEventIdSinglePageAsync(eventTrackingId, filter), + nextLink -> listByTenantIdAndEventIdNextSinglePageAsync(nextLink)); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantIdAndEventIdAsync( + String eventTrackingId, String filter, Context context) { + return new PagedFlux<>( + () -> listByTenantIdAndEventIdSinglePageAsync(eventTrackingId, filter, context), + nextLink -> listByTenantIdAndEventIdNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTenantIdAndEventId(String eventTrackingId) { + final String filter = null; + return new PagedIterable<>(listByTenantIdAndEventIdAsync(eventTrackingId, filter)); + } + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context) { + return new PagedIterable<>(listByTenantIdAndEventIdAsync(eventTrackingId, filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdAndEventIdNextSinglePageAsync( + 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.listBySubscriptionIdAndEventIdNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdAndEventIdNextSinglePageAsync( + 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 + .listBySubscriptionIdAndEventIdNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdAndEventIdNextSinglePageAsync( + 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.listByTenantIdAndEventIdNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantIdAndEventIdNextSinglePageAsync( + 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 + .listByTenantIdAndEventIdNext(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/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesImpl.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesImpl.java new file mode 100644 index 000000000000..13c2f1fec7f3 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/implementation/SecurityAdvisoryImpactedResourcesImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcehealth.fluent.SecurityAdvisoryImpactedResourcesClient; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResource; +import com.azure.resourcemanager.resourcehealth.models.SecurityAdvisoryImpactedResources; + +public final class SecurityAdvisoryImpactedResourcesImpl implements SecurityAdvisoryImpactedResources { + private static final ClientLogger LOGGER = new ClientLogger(SecurityAdvisoryImpactedResourcesImpl.class); + + private final SecurityAdvisoryImpactedResourcesClient innerClient; + + private final com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager; + + public SecurityAdvisoryImpactedResourcesImpl( + SecurityAdvisoryImpactedResourcesClient innerClient, + com.azure.resourcemanager.resourcehealth.ResourceHealthManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySubscriptionIdAndEventId(String eventTrackingId) { + PagedIterable inner = + this.serviceClient().listBySubscriptionIdAndEventId(eventTrackingId); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscriptionIdAndEventId( + String eventTrackingId, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listBySubscriptionIdAndEventId(eventTrackingId, filter, context); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByTenantIdAndEventId(String eventTrackingId) { + PagedIterable inner = + this.serviceClient().listByTenantIdAndEventId(eventTrackingId); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByTenantIdAndEventId(eventTrackingId, filter, context); + return Utils.mapPage(inner, inner1 -> new EventImpactedResourceImpl(inner1, this.manager())); + } + + private SecurityAdvisoryImpactedResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ChildAvailabilityStatuses.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ChildAvailabilityStatuses.java new file mode 100644 index 000000000000..c94c0c88af5c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ChildAvailabilityStatuses.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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 ChildAvailabilityStatuses. */ +public interface ChildAvailabilityStatuses { + /** + * Gets current availability status for a single resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @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 current availability status for a single resource along with {@link Response}. + */ + Response getByResourceWithResponse( + String resourceUri, String filter, String expand, Context context); + + /** + * Gets current availability status for a single resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current availability status for a single resource. + */ + AvailabilityStatus getByResource(String resourceUri); + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * Lists the historical availability statuses for a single child resource. Use the nextLink property in the response + * to get the next page of availability status. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @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 List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri, String filter, String expand, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ChildResources.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ChildResources.java new file mode 100644 index 000000000000..3f350225c5ca --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ChildResources.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ChildResources. */ +public interface ChildResources { + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * Lists the all the children and its current health status for a parent resource. Use the nextLink property in the + * response to get the next page of children current health. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API only support not nested parent resource type: + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param expand Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + * @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 List availabilityStatus operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri, String filter, String expand, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueImpact.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueImpact.java new file mode 100644 index 000000000000..c5c26313b29a --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueImpact.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Object of the emerging issue impact on services and regions. */ +@Fluent +public final class EmergingIssueImpact { + /* + * The impacted service id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The impacted service name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The list of impacted regions for corresponding emerging issues. + */ + @JsonProperty(value = "regions") + private List regions; + + /** Creates an instance of EmergingIssueImpact class. */ + public EmergingIssueImpact() { + } + + /** + * Get the id property: The impacted service id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The impacted service id. + * + * @param id the id value to set. + * @return the EmergingIssueImpact object itself. + */ + public EmergingIssueImpact withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The impacted service name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The impacted service name. + * + * @param name the name value to set. + * @return the EmergingIssueImpact object itself. + */ + public EmergingIssueImpact withName(String name) { + this.name = name; + return this; + } + + /** + * Get the regions property: The list of impacted regions for corresponding emerging issues. + * + * @return the regions value. + */ + public List regions() { + return this.regions; + } + + /** + * Set the regions property: The list of impacted regions for corresponding emerging issues. + * + * @param regions the regions value to set. + * @return the EmergingIssueImpact object itself. + */ + public EmergingIssueImpact withRegions(List regions) { + this.regions = regions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (regions() != null) { + regions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueListResult.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueListResult.java new file mode 100644 index 000000000000..9922320551a0 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssueListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of emerging issues. */ +@Fluent +public final class EmergingIssueListResult { + /* + * The list of emerging issues. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of emerging issues. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of EmergingIssueListResult class. */ + public EmergingIssueListResult() { + } + + /** + * Get the value property: The list of emerging issues. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of emerging issues. + * + * @param value the value value to set. + * @return the EmergingIssueListResult object itself. + */ + public EmergingIssueListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of emerging issues. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of emerging issues. + * + * @param nextLink the nextLink value to set. + * @return the EmergingIssueListResult object itself. + */ + public EmergingIssueListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssues.java new file mode 100644 index 000000000000..e4f75aef3edc --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssues.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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 EmergingIssues. */ +public interface EmergingIssues { + /** + * Lists Azure services' emerging issues. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of emerging issues as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists Azure services' emerging issues. + * + * @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 list of emerging issues as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @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 azure services' emerging issues along with {@link Response}. + */ + Response getWithResponse(IssueNameParameter issueName, Context context); + + /** + * Gets Azure services' emerging issues. + * + * @param issueName The name of the emerging issue. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure services' emerging issues. + */ + EmergingIssuesGetResult get(IssueNameParameter issueName); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssuesGetResult.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssuesGetResult.java new file mode 100644 index 000000000000..90239235eb33 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EmergingIssuesGetResult.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of EmergingIssuesGetResult. */ +public interface EmergingIssuesGetResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the refreshTimestamp property: Timestamp for when last time refreshed for ongoing emerging issue. + * + * @return the refreshTimestamp value. + */ + OffsetDateTime refreshTimestamp(); + + /** + * Gets the statusBanners property: The list of emerging issues of banner type. + * + * @return the statusBanners value. + */ + List statusBanners(); + + /** + * Gets the statusActiveEvents property: The list of emerging issues of active event type. + * + * @return the statusActiveEvents value. + */ + List statusActiveEvents(); + + /** + * Gets the inner com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner object. + * + * @return the inner object. + */ + EmergingIssuesGetResultInner innerModel(); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Event.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Event.java new file mode 100644 index 000000000000..04289b9b2d5f --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Event.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Event. */ +public interface Event { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the eventType property: Type of event. + * + * @return the eventType value. + */ + EventTypeValues eventType(); + + /** + * Gets the eventSource property: Source of event. + * + * @return the eventSource value. + */ + EventSourceValues eventSource(); + + /** + * Gets the status property: Current status of event. + * + * @return the status value. + */ + EventStatusValues status(); + + /** + * Gets the title property: Title text of event. + * + * @return the title value. + */ + String title(); + + /** + * Gets the summary property: Summary text of event. + * + * @return the summary value. + */ + String summary(); + + /** + * Gets the headerProperty property: Header text of event. + * + * @return the headerProperty value. + */ + String headerProperty(); + + /** + * Gets the level property: Level of insight. + * + * @return the level value. + */ + LevelValues level(); + + /** + * Gets the eventLevel property: Level of event. + * + * @return the eventLevel value. + */ + EventLevelValues eventLevel(); + + /** + * Gets the externalIncidentId property: The id of the Incident. + * + * @return the externalIncidentId value. + */ + String externalIncidentId(); + + /** + * Gets the reason property: The reason for the Incident. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the article property: Article of event. + * + * @return the article value. + */ + EventPropertiesArticle article(); + + /** + * Gets the links property: Useful links of event. + * + * @return the links value. + */ + List links(); + + /** + * Gets the impactStartTime property: It provides the Timestamp for when the health impacting event started. + * + * @return the impactStartTime value. + */ + OffsetDateTime impactStartTime(); + + /** + * Gets the impactMitigationTime property: It provides the Timestamp for when the health impacting event resolved. + * + * @return the impactMitigationTime value. + */ + OffsetDateTime impactMitigationTime(); + + /** + * Gets the impact property: List services impacted by the service health event. + * + * @return the impact value. + */ + List impact(); + + /** + * Gets the recommendedActions property: Recommended actions of event. + * + * @return the recommendedActions value. + */ + EventPropertiesRecommendedActions recommendedActions(); + + /** + * Gets the faqs property: Frequently asked questions for the service health event. + * + * @return the faqs value. + */ + List faqs(); + + /** + * Gets the isHir property: It provides information if the event is High incident rate event or not. + * + * @return the isHir value. + */ + Boolean isHir(); + + /** + * Gets the enableMicrosoftSupport property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @return the enableMicrosoftSupport value. + */ + Boolean enableMicrosoftSupport(); + + /** + * Gets the description property: Contains the communication message for the event, that could include summary, root + * cause and other details. + * + * @return the description value. + */ + String description(); + + /** + * Gets the platformInitiated property: Is true if the event is platform initiated. + * + * @return the platformInitiated value. + */ + Boolean platformInitiated(); + + /** + * Gets the enableChatWithUs property: Tells if we want to enable or disable Microsoft Support for this event. + * + * @return the enableChatWithUs value. + */ + Boolean enableChatWithUs(); + + /** + * Gets the priority property: Priority level of the event. Has value from 0 to 23. 0 is the highest priority. + * Service issue events have higher priority followed by planned maintenance and health advisory. Critical events + * have higher priority followed by error, warning and informational. Furthermore, active events have higher + * priority than resolved. + * + * @return the priority value. + */ + Integer priority(); + + /** + * Gets the lastUpdateTime property: It provides the Timestamp for when the health impacting event was last updated. + * + * @return the lastUpdateTime value. + */ + OffsetDateTime lastUpdateTime(); + + /** + * Gets the hirStage property: Stage for HIR Document. + * + * @return the hirStage value. + */ + String hirStage(); + + /** + * Gets the additionalInformation property: Additional information. + * + * @return the additionalInformation value. + */ + EventPropertiesAdditionalInformation additionalInformation(); + + /** + * Gets the duration property: duration in seconds. + * + * @return the duration value. + */ + Integer duration(); + + /** + * Gets the impactType property: The type of the impact. + * + * @return the impactType value. + */ + String impactType(); + + /** + * Gets the inner com.azure.resourcemanager.resourcehealth.fluent.models.EventInner object. + * + * @return the inner object. + */ + EventInner innerModel(); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResource.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResource.java new file mode 100644 index 000000000000..f1ca85bc835c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResource.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import java.util.List; + +/** An immutable client-side representation of EventImpactedResource. */ +public interface EventImpactedResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the targetResourceType property: Resource type within Microsoft cloud. + * + * @return the targetResourceType value. + */ + String targetResourceType(); + + /** + * Gets the targetResourceId property: Identity for resource within Microsoft cloud. + * + * @return the targetResourceId value. + */ + String targetResourceId(); + + /** + * Gets the targetRegion property: Impacted resource region name. + * + * @return the targetRegion value. + */ + String targetRegion(); + + /** + * Gets the info property: Additional information. + * + * @return the info value. + */ + List info(); + + /** + * Gets the inner com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner object. + * + * @return the inner object. + */ + EventImpactedResourceInner innerModel(); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResourceListResult.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResourceListResult.java new file mode 100644 index 000000000000..0e448b224ff1 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventImpactedResourceListResult.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List of eventImpactedResources operation response. */ +@Fluent +public final class EventImpactedResourceListResult { + /* + * The list of eventImpactedResources. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of impacted + * resource. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of EventImpactedResourceListResult class. */ + public EventImpactedResourceListResult() { + } + + /** + * Get the value property: The list of eventImpactedResources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of eventImpactedResources. + * + * @param value the value value to set. + * @return the EventImpactedResourceListResult object itself. + */ + public EventImpactedResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of events. Call ListNext() with this URI to fetch the + * next page of impacted resource. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of events. Call ListNext() with this URI to fetch the + * next page of impacted resource. + * + * @param nextLink the nextLink value to set. + * @return the EventImpactedResourceListResult object itself. + */ + public EventImpactedResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model EventImpactedResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EventImpactedResourceListResult.class); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventLevelValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventLevelValues.java new file mode 100644 index 000000000000..f593bd0f815b --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventLevelValues.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Level of event. */ +public final class EventLevelValues extends ExpandableStringEnum { + /** Static value Critical for EventLevelValues. */ + public static final EventLevelValues CRITICAL = fromString("Critical"); + + /** Static value Error for EventLevelValues. */ + public static final EventLevelValues ERROR = fromString("Error"); + + /** Static value Warning for EventLevelValues. */ + public static final EventLevelValues WARNING = fromString("Warning"); + + /** Static value Informational for EventLevelValues. */ + public static final EventLevelValues INFORMATIONAL = fromString("Informational"); + + /** + * Creates a new instance of EventLevelValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EventLevelValues() { + } + + /** + * Creates or finds a EventLevelValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding EventLevelValues. + */ + @JsonCreator + public static EventLevelValues fromString(String name) { + return fromString(name, EventLevelValues.class); + } + + /** + * Gets known EventLevelValues values. + * + * @return known EventLevelValues values. + */ + public static Collection values() { + return values(EventLevelValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventOperations.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventOperations.java new file mode 100644 index 000000000000..369e787c7103 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventOperations.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of EventOperations. */ +public interface EventOperations { + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @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 service health event along with {@link Response}. + */ + Response getBySubscriptionIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context); + + /** + * Service health event in the subscription by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + Event getBySubscriptionIdAndTrackingId(String eventTrackingId); + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @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 service health event along with {@link Response}. + */ + Response fetchDetailsBySubscriptionIdAndTrackingIdWithResponse(String eventTrackingId, Context context); + + /** + * Service health event details in the subscription by event tracking id. This can be used to fetch sensitive + * properties for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + Event fetchDetailsBySubscriptionIdAndTrackingId(String eventTrackingId); + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @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 service health event along with {@link Response}. + */ + Response getByTenantIdAndTrackingIdWithResponse( + String eventTrackingId, String filter, String queryStartTime, Context context); + + /** + * Service health event in the tenant by event tracking id. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + Event getByTenantIdAndTrackingId(String eventTrackingId); + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @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 service health event along with {@link Response}. + */ + Response fetchDetailsByTenantIdAndTrackingIdWithResponse(String eventTrackingId, Context context); + + /** + * Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties + * for Security Advisory events. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service health event. + */ + Event fetchDetailsByTenantIdAndTrackingId(String eventTrackingId); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesAdditionalInformation.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesAdditionalInformation.java new file mode 100644 index 000000000000..c48d5cba6b41 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesAdditionalInformation.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Additional information. */ +@Fluent +public final class EventPropertiesAdditionalInformation { + /* + * Additional information Message + */ + @JsonProperty(value = "message") + private String message; + + /** Creates an instance of EventPropertiesAdditionalInformation class. */ + public EventPropertiesAdditionalInformation() { + } + + /** + * Get the message property: Additional information Message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Additional information Message. + * + * @param message the message value to set. + * @return the EventPropertiesAdditionalInformation object itself. + */ + public EventPropertiesAdditionalInformation withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesArticle.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesArticle.java new file mode 100644 index 000000000000..e728964eb8d0 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesArticle.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Article of event. */ +@Fluent +public final class EventPropertiesArticle { + /* + * Article content of event. + */ + @JsonProperty(value = "articleContent") + private String articleContent; + + /* + * Article Id + */ + @JsonProperty(value = "articleId") + private String articleId; + + /* + * It provides a map of parameter name and value + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /** Creates an instance of EventPropertiesArticle class. */ + public EventPropertiesArticle() { + } + + /** + * Get the articleContent property: Article content of event. + * + * @return the articleContent value. + */ + public String articleContent() { + return this.articleContent; + } + + /** + * Set the articleContent property: Article content of event. + * + * @param articleContent the articleContent value to set. + * @return the EventPropertiesArticle object itself. + */ + public EventPropertiesArticle withArticleContent(String articleContent) { + this.articleContent = articleContent; + return this; + } + + /** + * Get the articleId property: Article Id. + * + * @return the articleId value. + */ + public String articleId() { + return this.articleId; + } + + /** + * Set the articleId property: Article Id. + * + * @param articleId the articleId value to set. + * @return the EventPropertiesArticle object itself. + */ + public EventPropertiesArticle withArticleId(String articleId) { + this.articleId = articleId; + return this; + } + + /** + * Get the parameters property: It provides a map of parameter name and value. + * + * @return the parameters value. + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set the parameters property: It provides a map of parameter name and value. + * + * @param parameters the parameters value to set. + * @return the EventPropertiesArticle object itself. + */ + public EventPropertiesArticle withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActions.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActions.java new file mode 100644 index 000000000000..faafb8efce10 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActions.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Recommended actions of event. */ +@Fluent +public final class EventPropertiesRecommendedActions { + /* + * Recommended action title for the service health event. + */ + @JsonProperty(value = "message") + private String message; + + /* + * Recommended actions for the service health event. + */ + @JsonProperty(value = "actions") + private List actions; + + /* + * Recommended action locale for the service health event. + */ + @JsonProperty(value = "localeCode") + private String localeCode; + + /** Creates an instance of EventPropertiesRecommendedActions class. */ + public EventPropertiesRecommendedActions() { + } + + /** + * Get the message property: Recommended action title for the service health event. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Recommended action title for the service health event. + * + * @param message the message value to set. + * @return the EventPropertiesRecommendedActions object itself. + */ + public EventPropertiesRecommendedActions withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the actions property: Recommended actions for the service health event. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions property: Recommended actions for the service health event. + * + * @param actions the actions value to set. + * @return the EventPropertiesRecommendedActions object itself. + */ + public EventPropertiesRecommendedActions withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the localeCode property: Recommended action locale for the service health event. + * + * @return the localeCode value. + */ + public String localeCode() { + return this.localeCode; + } + + /** + * Set the localeCode property: Recommended action locale for the service health event. + * + * @param localeCode the localeCode value to set. + * @return the EventPropertiesRecommendedActions object itself. + */ + public EventPropertiesRecommendedActions withLocaleCode(String localeCode) { + this.localeCode = localeCode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (actions() != null) { + actions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActionsItem.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActionsItem.java new file mode 100644 index 000000000000..eeac97d0cfa8 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventPropertiesRecommendedActionsItem.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Recommended action for the service health event. */ +@Fluent +public final class EventPropertiesRecommendedActionsItem { + /* + * Recommended action group Id for the service health event. + */ + @JsonProperty(value = "groupId") + private Integer groupId; + + /* + * Recommended action text + */ + @JsonProperty(value = "actionText") + private String actionText; + + /** Creates an instance of EventPropertiesRecommendedActionsItem class. */ + public EventPropertiesRecommendedActionsItem() { + } + + /** + * Get the groupId property: Recommended action group Id for the service health event. + * + * @return the groupId value. + */ + public Integer groupId() { + return this.groupId; + } + + /** + * Set the groupId property: Recommended action group Id for the service health event. + * + * @param groupId the groupId value to set. + * @return the EventPropertiesRecommendedActionsItem object itself. + */ + public EventPropertiesRecommendedActionsItem withGroupId(Integer groupId) { + this.groupId = groupId; + return this; + } + + /** + * Get the actionText property: Recommended action text. + * + * @return the actionText value. + */ + public String actionText() { + return this.actionText; + } + + /** + * Set the actionText property: Recommended action text. + * + * @param actionText the actionText value to set. + * @return the EventPropertiesRecommendedActionsItem object itself. + */ + public EventPropertiesRecommendedActionsItem withActionText(String actionText) { + this.actionText = actionText; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventSourceValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventSourceValues.java new file mode 100644 index 000000000000..fb20dfd88f91 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventSourceValues.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Source of event. */ +public final class EventSourceValues extends ExpandableStringEnum { + /** Static value ResourceHealth for EventSourceValues. */ + public static final EventSourceValues RESOURCE_HEALTH = fromString("ResourceHealth"); + + /** Static value ServiceHealth for EventSourceValues. */ + public static final EventSourceValues SERVICE_HEALTH = fromString("ServiceHealth"); + + /** + * Creates a new instance of EventSourceValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EventSourceValues() { + } + + /** + * Creates or finds a EventSourceValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding EventSourceValues. + */ + @JsonCreator + public static EventSourceValues fromString(String name) { + return fromString(name, EventSourceValues.class); + } + + /** + * Gets known EventSourceValues values. + * + * @return known EventSourceValues values. + */ + public static Collection values() { + return values(EventSourceValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventStatusValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventStatusValues.java new file mode 100644 index 000000000000..a9cf2aba9cea --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventStatusValues.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Current status of event. */ +public final class EventStatusValues extends ExpandableStringEnum { + /** Static value Active for EventStatusValues. */ + public static final EventStatusValues ACTIVE = fromString("Active"); + + /** Static value Resolved for EventStatusValues. */ + public static final EventStatusValues RESOLVED = fromString("Resolved"); + + /** + * Creates a new instance of EventStatusValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EventStatusValues() { + } + + /** + * Creates or finds a EventStatusValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding EventStatusValues. + */ + @JsonCreator + public static EventStatusValues fromString(String name) { + return fromString(name, EventStatusValues.class); + } + + /** + * Gets known EventStatusValues values. + * + * @return known EventStatusValues values. + */ + public static Collection values() { + return values(EventStatusValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventTypeValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventTypeValues.java new file mode 100644 index 000000000000..bead23ec5642 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventTypeValues.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of event. */ +public final class EventTypeValues extends ExpandableStringEnum { + /** Static value ServiceIssue for EventTypeValues. */ + public static final EventTypeValues SERVICE_ISSUE = fromString("ServiceIssue"); + + /** Static value PlannedMaintenance for EventTypeValues. */ + public static final EventTypeValues PLANNED_MAINTENANCE = fromString("PlannedMaintenance"); + + /** Static value HealthAdvisory for EventTypeValues. */ + public static final EventTypeValues HEALTH_ADVISORY = fromString("HealthAdvisory"); + + /** Static value RCA for EventTypeValues. */ + public static final EventTypeValues RCA = fromString("RCA"); + + /** Static value EmergingIssues for EventTypeValues. */ + public static final EventTypeValues EMERGING_ISSUES = fromString("EmergingIssues"); + + /** Static value SecurityAdvisory for EventTypeValues. */ + public static final EventTypeValues SECURITY_ADVISORY = fromString("SecurityAdvisory"); + + /** + * Creates a new instance of EventTypeValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EventTypeValues() { + } + + /** + * Creates or finds a EventTypeValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding EventTypeValues. + */ + @JsonCreator + public static EventTypeValues fromString(String name) { + return fromString(name, EventTypeValues.class); + } + + /** + * Gets known EventTypeValues values. + * + * @return known EventTypeValues values. + */ + public static Collection values() { + return values(EventTypeValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Events.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Events.java new file mode 100644 index 000000000000..2e3125b3caf7 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Events.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List events operation response. */ +@Fluent +public final class Events { + /* + * The list of event. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of events. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of Events class. */ + public Events() { + } + + /** + * Get the value property: The list of event. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of event. + * + * @param value the value value to set. + * @return the Events object itself. + */ + public Events withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of events. Call ListNext() with this URI to fetch the + * next page of events. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of events. Call ListNext() with this URI to fetch the + * next page of events. + * + * @param nextLink the nextLink value to set. + * @return the Events object itself. + */ + public Events withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property value in model Events")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Events.class); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventsOperations.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventsOperations.java new file mode 100644 index 000000000000..1d24892adbf7 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/EventsOperations.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of EventsOperations. */ +public interface EventsOperations { + /** + * Lists service health events in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists service health events in the subscription. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @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 List events operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String filter, String queryStartTime, Context context); + + /** + * Lists current service health events in the tenant. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTenantId(); + + /** + * Lists current service health events in the tenant. + * + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @param queryStartTime Specifies from when to return events, based on the lastUpdateTime property. For example, + * queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + * @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 List events operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTenantId(String filter, String queryStartTime, Context context); + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List events operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySingleResource(String resourceUri); + + /** + * Lists current service health events for given resource. + * + * @param resourceUri The fully qualified ID of the resource, including the resource name and resource type. + * Currently the API support not nested and one nesting level resource types : + * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} + * and + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @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 List events operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySingleResource(String resourceUri, String filter, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Faq.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Faq.java new file mode 100644 index 000000000000..5d6a21f7fd07 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Faq.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Frequently asked question for the service health event. */ +@Fluent +public final class Faq { + /* + * FAQ question for the service health event. + */ + @JsonProperty(value = "question") + private String question; + + /* + * FAQ answer for the service health event. + */ + @JsonProperty(value = "answer") + private String answer; + + /* + * FAQ locale for the service health event. + */ + @JsonProperty(value = "localeCode") + private String localeCode; + + /** Creates an instance of Faq class. */ + public Faq() { + } + + /** + * Get the question property: FAQ question for the service health event. + * + * @return the question value. + */ + public String question() { + return this.question; + } + + /** + * Set the question property: FAQ question for the service health event. + * + * @param question the question value to set. + * @return the Faq object itself. + */ + public Faq withQuestion(String question) { + this.question = question; + return this; + } + + /** + * Get the answer property: FAQ answer for the service health event. + * + * @return the answer value. + */ + public String answer() { + return this.answer; + } + + /** + * Set the answer property: FAQ answer for the service health event. + * + * @param answer the answer value to set. + * @return the Faq object itself. + */ + public Faq withAnswer(String answer) { + this.answer = answer; + return this; + } + + /** + * Get the localeCode property: FAQ locale for the service health event. + * + * @return the localeCode value. + */ + public String localeCode() { + return this.localeCode; + } + + /** + * Set the localeCode property: FAQ locale for the service health event. + * + * @param localeCode the localeCode value to set. + * @return the Faq object itself. + */ + public Faq withLocaleCode(String localeCode) { + this.localeCode = localeCode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Impact.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Impact.java new file mode 100644 index 000000000000..1ea271eef974 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Impact.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Azure service impacted by the service health event. */ +@Fluent +public final class Impact { + /* + * Impacted service name. + */ + @JsonProperty(value = "impactedService") + private String impactedService; + + /* + * List regions impacted by the service health event. + */ + @JsonProperty(value = "impactedRegions") + private List impactedRegions; + + /** Creates an instance of Impact class. */ + public Impact() { + } + + /** + * Get the impactedService property: Impacted service name. + * + * @return the impactedService value. + */ + public String impactedService() { + return this.impactedService; + } + + /** + * Set the impactedService property: Impacted service name. + * + * @param impactedService the impactedService value to set. + * @return the Impact object itself. + */ + public Impact withImpactedService(String impactedService) { + this.impactedService = impactedService; + return this; + } + + /** + * Get the impactedRegions property: List regions impacted by the service health event. + * + * @return the impactedRegions value. + */ + public List impactedRegions() { + return this.impactedRegions; + } + + /** + * Set the impactedRegions property: List regions impacted by the service health event. + * + * @param impactedRegions the impactedRegions value to set. + * @return the Impact object itself. + */ + public Impact withImpactedRegions(List impactedRegions) { + this.impactedRegions = impactedRegions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (impactedRegions() != null) { + impactedRegions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedRegion.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedRegion.java new file mode 100644 index 000000000000..18435366560f --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedRegion.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Object of impacted region. */ +@Fluent +public final class ImpactedRegion { + /* + * The impacted region id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The impacted region name. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of ImpactedRegion class. */ + public ImpactedRegion() { + } + + /** + * Get the id property: The impacted region id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The impacted region id. + * + * @param id the id value to set. + * @return the ImpactedRegion object itself. + */ + public ImpactedRegion withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The impacted region name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The impacted region name. + * + * @param name the name value to set. + * @return the ImpactedRegion object itself. + */ + public ImpactedRegion withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedResources.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedResources.java new file mode 100644 index 000000000000..e7cc441f2c7a --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedResources.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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 ImpactedResources. */ +public interface ImpactedResources { + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscriptionIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @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 List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscriptionIdAndEventId( + String eventTrackingId, String filter, Context context); + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @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 specific impacted resource in the subscription by an event along with {@link Response}. + */ + Response getWithResponse( + String eventTrackingId, String impactedResourceName, Context context); + + /** + * Gets the specific impacted resource in the subscription by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the subscription by an event. + */ + EventImpactedResource get(String eventTrackingId, String impactedResourceName); + + /** + * Lists impacted resources in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTenantIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @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 List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context); + + /** + * Gets the specific impacted resource in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @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 specific impacted resource in the tenant by an event along with {@link Response}. + */ + Response getByTenantIdWithResponse( + String eventTrackingId, String impactedResourceName, Context context); + + /** + * Gets the specific impacted resource in the tenant by an event. + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param impactedResourceName Name of the Impacted Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specific impacted resource in the tenant by an event. + */ + EventImpactedResource getByTenantId(String eventTrackingId, String impactedResourceName); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedServiceRegion.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedServiceRegion.java new file mode 100644 index 000000000000..c27aa373a5e0 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/ImpactedServiceRegion.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Azure region impacted by the service health event. */ +@Fluent +public final class ImpactedServiceRegion { + /* + * Impacted region name. + */ + @JsonProperty(value = "impactedRegion") + private String impactedRegion; + + /* + * Current status of event in the region. + */ + @JsonProperty(value = "status") + private EventStatusValues status; + + /* + * List subscription impacted by the service health event. + */ + @JsonProperty(value = "impactedSubscriptions") + private List impactedSubscriptions; + + /* + * List tenant impacted by the service health event. + */ + @JsonProperty(value = "impactedTenants") + private List impactedTenants; + + /* + * It provides the Timestamp for when the last update for the service health event. + */ + @JsonProperty(value = "lastUpdateTime") + private OffsetDateTime lastUpdateTime; + + /* + * List of updates for given service health event. + */ + @JsonProperty(value = "updates") + private List updates; + + /** Creates an instance of ImpactedServiceRegion class. */ + public ImpactedServiceRegion() { + } + + /** + * Get the impactedRegion property: Impacted region name. + * + * @return the impactedRegion value. + */ + public String impactedRegion() { + return this.impactedRegion; + } + + /** + * Set the impactedRegion property: Impacted region name. + * + * @param impactedRegion the impactedRegion value to set. + * @return the ImpactedServiceRegion object itself. + */ + public ImpactedServiceRegion withImpactedRegion(String impactedRegion) { + this.impactedRegion = impactedRegion; + return this; + } + + /** + * Get the status property: Current status of event in the region. + * + * @return the status value. + */ + public EventStatusValues status() { + return this.status; + } + + /** + * Set the status property: Current status of event in the region. + * + * @param status the status value to set. + * @return the ImpactedServiceRegion object itself. + */ + public ImpactedServiceRegion withStatus(EventStatusValues status) { + this.status = status; + return this; + } + + /** + * Get the impactedSubscriptions property: List subscription impacted by the service health event. + * + * @return the impactedSubscriptions value. + */ + public List impactedSubscriptions() { + return this.impactedSubscriptions; + } + + /** + * Set the impactedSubscriptions property: List subscription impacted by the service health event. + * + * @param impactedSubscriptions the impactedSubscriptions value to set. + * @return the ImpactedServiceRegion object itself. + */ + public ImpactedServiceRegion withImpactedSubscriptions(List impactedSubscriptions) { + this.impactedSubscriptions = impactedSubscriptions; + return this; + } + + /** + * Get the impactedTenants property: List tenant impacted by the service health event. + * + * @return the impactedTenants value. + */ + public List impactedTenants() { + return this.impactedTenants; + } + + /** + * Set the impactedTenants property: List tenant impacted by the service health event. + * + * @param impactedTenants the impactedTenants value to set. + * @return the ImpactedServiceRegion object itself. + */ + public ImpactedServiceRegion withImpactedTenants(List impactedTenants) { + this.impactedTenants = impactedTenants; + return this; + } + + /** + * Get the lastUpdateTime property: It provides the Timestamp for when the last update for the service health event. + * + * @return the lastUpdateTime value. + */ + public OffsetDateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Set the lastUpdateTime property: It provides the Timestamp for when the last update for the service health event. + * + * @param lastUpdateTime the lastUpdateTime value to set. + * @return the ImpactedServiceRegion object itself. + */ + public ImpactedServiceRegion withLastUpdateTime(OffsetDateTime lastUpdateTime) { + this.lastUpdateTime = lastUpdateTime; + return this; + } + + /** + * Get the updates property: List of updates for given service health event. + * + * @return the updates value. + */ + public List updates() { + return this.updates; + } + + /** + * Set the updates property: List of updates for given service health event. + * + * @param updates the updates value to set. + * @return the ImpactedServiceRegion object itself. + */ + public ImpactedServiceRegion withUpdates(List updates) { + this.updates = updates; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (updates() != null) { + updates().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/IssueNameParameter.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/IssueNameParameter.java new file mode 100644 index 000000000000..439b42f18acd --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/IssueNameParameter.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IssueNameParameter. */ +public final class IssueNameParameter extends ExpandableStringEnum { + /** Static value default for IssueNameParameter. */ + public static final IssueNameParameter DEFAULT = fromString("default"); + + /** + * Creates a new instance of IssueNameParameter value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IssueNameParameter() { + } + + /** + * Creates or finds a IssueNameParameter from its string representation. + * + * @param name a name to look for. + * @return the corresponding IssueNameParameter. + */ + @JsonCreator + public static IssueNameParameter fromString(String name) { + return fromString(name, IssueNameParameter.class); + } + + /** + * Gets known IssueNameParameter values. + * + * @return known IssueNameParameter values. + */ + public static Collection values() { + return values(IssueNameParameter.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/KeyValueItem.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/KeyValueItem.java new file mode 100644 index 000000000000..4fea7218ff7d --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/KeyValueItem.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Key value tuple. */ +@Immutable +public final class KeyValueItem { + /* + * Key of tuple. + */ + @JsonProperty(value = "key", access = JsonProperty.Access.WRITE_ONLY) + private String key; + + /* + * Value of tuple. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** Creates an instance of KeyValueItem class. */ + public KeyValueItem() { + } + + /** + * Get the key property: Key of tuple. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Get the value property: Value of tuple. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LevelValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LevelValues.java new file mode 100644 index 000000000000..54fe25745149 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LevelValues.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Level of insight. */ +public final class LevelValues extends ExpandableStringEnum { + /** Static value Critical for LevelValues. */ + public static final LevelValues CRITICAL = fromString("Critical"); + + /** Static value Warning for LevelValues. */ + public static final LevelValues WARNING = fromString("Warning"); + + /** + * Creates a new instance of LevelValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LevelValues() { + } + + /** + * Creates or finds a LevelValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding LevelValues. + */ + @JsonCreator + public static LevelValues fromString(String name) { + return fromString(name, LevelValues.class); + } + + /** + * Gets known LevelValues values. + * + * @return known LevelValues values. + */ + public static Collection values() { + return values(LevelValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Link.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Link.java new file mode 100644 index 000000000000..80383e2e5ca4 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Link.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Useful links for service health event. */ +@Fluent +public final class Link { + /* + * Type of link. + */ + @JsonProperty(value = "type") + private LinkTypeValues type; + + /* + * Display text of link. + */ + @JsonProperty(value = "displayText") + private LinkDisplayText displayText; + + /* + * It provides the name of portal extension to produce link for given service health event. + */ + @JsonProperty(value = "extensionName") + private String extensionName; + + /* + * It provides the name of portal extension blade to produce link for given service health event. + */ + @JsonProperty(value = "bladeName") + private String bladeName; + + /* + * It provides a map of parameter name and value for portal extension blade to produce lik for given service health + * event. + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /** Creates an instance of Link class. */ + public Link() { + } + + /** + * Get the type property: Type of link. + * + * @return the type value. + */ + public LinkTypeValues type() { + return this.type; + } + + /** + * Set the type property: Type of link. + * + * @param type the type value to set. + * @return the Link object itself. + */ + public Link withType(LinkTypeValues type) { + this.type = type; + return this; + } + + /** + * Get the displayText property: Display text of link. + * + * @return the displayText value. + */ + public LinkDisplayText displayText() { + return this.displayText; + } + + /** + * Set the displayText property: Display text of link. + * + * @param displayText the displayText value to set. + * @return the Link object itself. + */ + public Link withDisplayText(LinkDisplayText displayText) { + this.displayText = displayText; + return this; + } + + /** + * Get the extensionName property: It provides the name of portal extension to produce link for given service health + * event. + * + * @return the extensionName value. + */ + public String extensionName() { + return this.extensionName; + } + + /** + * Set the extensionName property: It provides the name of portal extension to produce link for given service health + * event. + * + * @param extensionName the extensionName value to set. + * @return the Link object itself. + */ + public Link withExtensionName(String extensionName) { + this.extensionName = extensionName; + return this; + } + + /** + * Get the bladeName property: It provides the name of portal extension blade to produce link for given service + * health event. + * + * @return the bladeName value. + */ + public String bladeName() { + return this.bladeName; + } + + /** + * Set the bladeName property: It provides the name of portal extension blade to produce link for given service + * health event. + * + * @param bladeName the bladeName value to set. + * @return the Link object itself. + */ + public Link withBladeName(String bladeName) { + this.bladeName = bladeName; + return this; + } + + /** + * Get the parameters property: It provides a map of parameter name and value for portal extension blade to produce + * lik for given service health event. + * + * @return the parameters value. + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set the parameters property: It provides a map of parameter name and value for portal extension blade to produce + * lik for given service health event. + * + * @param parameters the parameters value to set. + * @return the Link object itself. + */ + public Link withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (displayText() != null) { + displayText().validate(); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkDisplayText.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkDisplayText.java new file mode 100644 index 000000000000..99a5715978fd --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkDisplayText.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display text of link. */ +@Fluent +public final class LinkDisplayText { + /* + * Display text of link. + */ + @JsonProperty(value = "value") + private String value; + + /* + * Localized display text of link. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** Creates an instance of LinkDisplayText class. */ + public LinkDisplayText() { + } + + /** + * Get the value property: Display text of link. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Display text of link. + * + * @param value the value value to set. + * @return the LinkDisplayText object itself. + */ + public LinkDisplayText withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localizedValue property: Localized display text of link. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localizedValue property: Localized display text of link. + * + * @param localizedValue the localizedValue value to set. + * @return the LinkDisplayText object itself. + */ + public LinkDisplayText withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkTypeValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkTypeValues.java new file mode 100644 index 000000000000..3629b35caf7d --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/LinkTypeValues.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of link. */ +public final class LinkTypeValues extends ExpandableStringEnum { + /** Static value Button for LinkTypeValues. */ + public static final LinkTypeValues BUTTON = fromString("Button"); + + /** Static value Hyperlink for LinkTypeValues. */ + public static final LinkTypeValues HYPERLINK = fromString("Hyperlink"); + + /** + * Creates a new instance of LinkTypeValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LinkTypeValues() { + } + + /** + * Creates or finds a LinkTypeValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding LinkTypeValues. + */ + @JsonCreator + public static LinkTypeValues fromString(String name) { + return fromString(name, LinkTypeValues.class); + } + + /** + * Gets known LinkTypeValues values. + * + * @return known LinkTypeValues values. + */ + public static Collection values() { + return values(LinkTypeValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntity.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntity.java new file mode 100644 index 000000000000..a43f930009d5 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntity.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.resourcehealth.fluent.models.MetadataEntityInner; +import java.util.List; + +/** An immutable client-side representation of MetadataEntity. */ +public interface MetadataEntity { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the displayName property: The display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the dependsOn property: The list of keys on which this entity depends on. + * + * @return the dependsOn value. + */ + List dependsOn(); + + /** + * Gets the applicableScenarios property: The list of scenarios applicable to this metadata entity. + * + * @return the applicableScenarios value. + */ + List applicableScenarios(); + + /** + * Gets the supportedValues property: The list of supported values. + * + * @return the supportedValues value. + */ + List supportedValues(); + + /** + * Gets the inner com.azure.resourcemanager.resourcehealth.fluent.models.MetadataEntityInner object. + * + * @return the inner object. + */ + MetadataEntityInner innerModel(); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntityListResult.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntityListResult.java new file mode 100644 index 000000000000..40b5ac7a1132 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataEntityListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.resourcehealth.fluent.models.MetadataEntityInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of metadata entities. */ +@Fluent +public final class MetadataEntityListResult { + /* + * The list of metadata entities. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The link used to get the next page of metadata. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of MetadataEntityListResult class. */ + public MetadataEntityListResult() { + } + + /** + * Get the value property: The list of metadata entities. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of metadata entities. + * + * @param value the value value to set. + * @return the MetadataEntityListResult object itself. + */ + public MetadataEntityListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link used to get the next page of metadata. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link used to get the next page of metadata. + * + * @param nextLink the nextLink value to set. + * @return the MetadataEntityListResult object itself. + */ + public MetadataEntityListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataSupportedValueDetail.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataSupportedValueDetail.java new file mode 100644 index 000000000000..8ea6e745f897 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/MetadataSupportedValueDetail.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The metadata supported value detail. */ +@Fluent +public final class MetadataSupportedValueDetail { + /* + * The id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The list of associated resource types. + */ + @JsonProperty(value = "resourceTypes") + private List resourceTypes; + + /** Creates an instance of MetadataSupportedValueDetail class. */ + public MetadataSupportedValueDetail() { + } + + /** + * Get the id property: The id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The id. + * + * @param id the id value to set. + * @return the MetadataSupportedValueDetail object itself. + */ + public MetadataSupportedValueDetail withId(String id) { + this.id = id; + return this; + } + + /** + * Get the displayName property: The display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name. + * + * @param displayName the displayName value to set. + * @return the MetadataSupportedValueDetail object itself. + */ + public MetadataSupportedValueDetail withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the resourceTypes property: The list of associated resource types. + * + * @return the resourceTypes value. + */ + public List resourceTypes() { + return this.resourceTypes; + } + + /** + * Set the resourceTypes property: The list of associated resource types. + * + * @param resourceTypes the resourceTypes value to set. + * @return the MetadataSupportedValueDetail object itself. + */ + public MetadataSupportedValueDetail withResourceTypes(List resourceTypes) { + this.resourceTypes = resourceTypes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Metadatas.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Metadatas.java new file mode 100644 index 000000000000..0453d241d8a6 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Metadatas.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.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 Metadatas. */ +public interface Metadatas { + /** + * Gets the list of metadata entities. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets the list of metadata entities. + * + * @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 list of metadata entities as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @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 list of metadata entities along with {@link Response}. + */ + Response getEntityWithResponse(String name, Context context); + + /** + * Gets the list of metadata entities. + * + * @param name Name of metadata entity. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of metadata entities. + */ + MetadataEntity getEntity(String name); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Scenario.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Scenario.java new file mode 100644 index 000000000000..e080ffde5d2c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Scenario.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Scenario. */ +public final class Scenario extends ExpandableStringEnum { + /** Static value Alerts for Scenario. */ + public static final Scenario ALERTS = fromString("Alerts"); + + /** + * Creates a new instance of Scenario value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Scenario() { + } + + /** + * Creates or finds a Scenario from its string representation. + * + * @param name a name to look for. + * @return the corresponding Scenario. + */ + @JsonCreator + public static Scenario fromString(String name) { + return fromString(name, Scenario.class); + } + + /** + * Gets known Scenario values. + * + * @return known Scenario values. + */ + public static Collection values() { + return values(Scenario.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SecurityAdvisoryImpactedResources.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SecurityAdvisoryImpactedResources.java new file mode 100644 index 000000000000..c5597104630b --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SecurityAdvisoryImpactedResources.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of SecurityAdvisoryImpactedResources. */ +public interface SecurityAdvisoryImpactedResources { + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscriptionIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the subscription by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @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 List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscriptionIdAndEventId( + String eventTrackingId, String filter, Context context); + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTenantIdAndEventId(String eventTrackingId); + + /** + * Lists impacted resources in the tenant by an event (Security Advisory). + * + * @param eventTrackingId Event Id which uniquely identifies ServiceHealth event. + * @param filter The filter to apply on the operation. For more information please see + * https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + * @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 List of eventImpactedResources operation response as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTenantIdAndEventId( + String eventTrackingId, String filter, Context context); +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SeverityValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SeverityValues.java new file mode 100644 index 000000000000..94cc08012b84 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/SeverityValues.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The severity level of this active event. */ +public final class SeverityValues extends ExpandableStringEnum { + /** Static value Information for SeverityValues. */ + public static final SeverityValues INFORMATION = fromString("Information"); + + /** Static value Warning for SeverityValues. */ + public static final SeverityValues WARNING = fromString("Warning"); + + /** Static value Error for SeverityValues. */ + public static final SeverityValues ERROR = fromString("Error"); + + /** + * Creates a new instance of SeverityValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SeverityValues() { + } + + /** + * Creates or finds a SeverityValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding SeverityValues. + */ + @JsonCreator + public static SeverityValues fromString(String name) { + return fromString(name, SeverityValues.class); + } + + /** + * Gets known SeverityValues values. + * + * @return known SeverityValues values. + */ + public static Collection values() { + return values(SeverityValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StageValues.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StageValues.java new file mode 100644 index 000000000000..2563885b0044 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StageValues.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The stage of this active event. */ +public final class StageValues extends ExpandableStringEnum { + /** Static value Active for StageValues. */ + public static final StageValues ACTIVE = fromString("Active"); + + /** Static value Resolve for StageValues. */ + public static final StageValues RESOLVE = fromString("Resolve"); + + /** Static value Archived for StageValues. */ + public static final StageValues ARCHIVED = fromString("Archived"); + + /** + * Creates a new instance of StageValues value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StageValues() { + } + + /** + * Creates or finds a StageValues from its string representation. + * + * @param name a name to look for. + * @return the corresponding StageValues. + */ + @JsonCreator + public static StageValues fromString(String name) { + return fromString(name, StageValues.class); + } + + /** + * Gets known StageValues values. + * + * @return known StageValues values. + */ + public static Collection values() { + return values(StageValues.class); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusActiveEvent.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusActiveEvent.java new file mode 100644 index 000000000000..290c05b09914 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusActiveEvent.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Active event type of emerging issue. */ +@Fluent +public final class StatusActiveEvent { + /* + * The active event title. + */ + @JsonProperty(value = "title") + private String title; + + /* + * The details of active event. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The tracking id of this active event. + */ + @JsonProperty(value = "trackingId") + private String trackingId; + + /* + * The impact start time on this active event. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * The cloud type of this active event. + */ + @JsonProperty(value = "cloud") + private String cloud; + + /* + * The severity level of this active event. + */ + @JsonProperty(value = "severity") + private SeverityValues severity; + + /* + * The stage of this active event. + */ + @JsonProperty(value = "stage") + private StageValues stage; + + /* + * The boolean value of this active event if published or not. + */ + @JsonProperty(value = "published") + private Boolean published; + + /* + * The last time modified on this banner. + */ + @JsonProperty(value = "lastModifiedTime") + private OffsetDateTime lastModifiedTime; + + /* + * The list of emerging issues impacts. + */ + @JsonProperty(value = "impacts") + private List impacts; + + /** Creates an instance of StatusActiveEvent class. */ + public StatusActiveEvent() { + } + + /** + * Get the title property: The active event title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The active event title. + * + * @param title the title value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description property: The details of active event. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The details of active event. + * + * @param description the description value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the trackingId property: The tracking id of this active event. + * + * @return the trackingId value. + */ + public String trackingId() { + return this.trackingId; + } + + /** + * Set the trackingId property: The tracking id of this active event. + * + * @param trackingId the trackingId value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withTrackingId(String trackingId) { + this.trackingId = trackingId; + return this; + } + + /** + * Get the startTime property: The impact start time on this active event. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The impact start time on this active event. + * + * @param startTime the startTime value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the cloud property: The cloud type of this active event. + * + * @return the cloud value. + */ + public String cloud() { + return this.cloud; + } + + /** + * Set the cloud property: The cloud type of this active event. + * + * @param cloud the cloud value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withCloud(String cloud) { + this.cloud = cloud; + return this; + } + + /** + * Get the severity property: The severity level of this active event. + * + * @return the severity value. + */ + public SeverityValues severity() { + return this.severity; + } + + /** + * Set the severity property: The severity level of this active event. + * + * @param severity the severity value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withSeverity(SeverityValues severity) { + this.severity = severity; + return this; + } + + /** + * Get the stage property: The stage of this active event. + * + * @return the stage value. + */ + public StageValues stage() { + return this.stage; + } + + /** + * Set the stage property: The stage of this active event. + * + * @param stage the stage value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withStage(StageValues stage) { + this.stage = stage; + return this; + } + + /** + * Get the published property: The boolean value of this active event if published or not. + * + * @return the published value. + */ + public Boolean published() { + return this.published; + } + + /** + * Set the published property: The boolean value of this active event if published or not. + * + * @param published the published value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withPublished(Boolean published) { + this.published = published; + return this; + } + + /** + * Get the lastModifiedTime property: The last time modified on this banner. + * + * @return the lastModifiedTime value. + */ + public OffsetDateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Set the lastModifiedTime property: The last time modified on this banner. + * + * @param lastModifiedTime the lastModifiedTime value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withLastModifiedTime(OffsetDateTime lastModifiedTime) { + this.lastModifiedTime = lastModifiedTime; + return this; + } + + /** + * Get the impacts property: The list of emerging issues impacts. + * + * @return the impacts value. + */ + public List impacts() { + return this.impacts; + } + + /** + * Set the impacts property: The list of emerging issues impacts. + * + * @param impacts the impacts value to set. + * @return the StatusActiveEvent object itself. + */ + public StatusActiveEvent withImpacts(List impacts) { + this.impacts = impacts; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (impacts() != null) { + impacts().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusBanner.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusBanner.java new file mode 100644 index 000000000000..8ec124824428 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/StatusBanner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Banner type of emerging issue. */ +@Fluent +public final class StatusBanner { + /* + * The banner title. + */ + @JsonProperty(value = "title") + private String title; + + /* + * The details of banner. + */ + @JsonProperty(value = "message") + private String message; + + /* + * The cloud type of this banner. + */ + @JsonProperty(value = "cloud") + private String cloud; + + /* + * The last time modified on this banner. + */ + @JsonProperty(value = "lastModifiedTime") + private OffsetDateTime lastModifiedTime; + + /** Creates an instance of StatusBanner class. */ + public StatusBanner() { + } + + /** + * Get the title property: The banner title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The banner title. + * + * @param title the title value to set. + * @return the StatusBanner object itself. + */ + public StatusBanner withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the message property: The details of banner. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The details of banner. + * + * @param message the message value to set. + * @return the StatusBanner object itself. + */ + public StatusBanner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the cloud property: The cloud type of this banner. + * + * @return the cloud value. + */ + public String cloud() { + return this.cloud; + } + + /** + * Set the cloud property: The cloud type of this banner. + * + * @param cloud the cloud value to set. + * @return the StatusBanner object itself. + */ + public StatusBanner withCloud(String cloud) { + this.cloud = cloud; + return this; + } + + /** + * Get the lastModifiedTime property: The last time modified on this banner. + * + * @return the lastModifiedTime value. + */ + public OffsetDateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Set the lastModifiedTime property: The last time modified on this banner. + * + * @param lastModifiedTime the lastModifiedTime value to set. + * @return the StatusBanner object itself. + */ + public StatusBanner withLastModifiedTime(OffsetDateTime lastModifiedTime) { + this.lastModifiedTime = lastModifiedTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Update.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Update.java new file mode 100644 index 000000000000..54ab9b05a0fc --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/main/java/com/azure/resourcemanager/resourcehealth/models/Update.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Update for service health event. */ +@Fluent +public final class Update { + /* + * Summary text for the given update for the service health event. + */ + @JsonProperty(value = "summary") + private String summary; + + /* + * It provides the Timestamp for the given update for the service health event. + */ + @JsonProperty(value = "updateDateTime") + private OffsetDateTime updateDateTime; + + /** Creates an instance of Update class. */ + public Update() { + } + + /** + * Get the summary property: Summary text for the given update for the service health event. + * + * @return the summary value. + */ + public String summary() { + return this.summary; + } + + /** + * Set the summary property: Summary text for the given update for the service health event. + * + * @param summary the summary value to set. + * @return the Update object itself. + */ + public Update withSummary(String summary) { + this.summary = summary; + return this; + } + + /** + * Get the updateDateTime property: It provides the Timestamp for the given update for the service health event. + * + * @return the updateDateTime value. + */ + public OffsetDateTime updateDateTime() { + return this.updateDateTime; + } + + /** + * Set the updateDateTime property: It provides the Timestamp for the given update for the service health event. + * + * @param updateDateTime the updateDateTime value to set. + * @return the Update object itself. + */ + public Update withUpdateDateTime(OffsetDateTime updateDateTime) { + this.updateDateTime = updateDateTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesGetByResourceSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesGetByResourceSamples.java new file mode 100644 index 000000000000..c8d484425692 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesGetByResourceSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for ChildAvailabilityStatuses GetByResource. */ +public final class ChildAvailabilityStatusesGetByResourceSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatus_GetByResource.json + */ + /** + * Sample code: GetChildCurrentHealthByResource. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getChildCurrentHealthByResource( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .childAvailabilityStatuses() + .getByResourceWithResponse( + "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4", + null, + "recommendedactions", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesListSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesListSamples.java new file mode 100644 index 000000000000..5f0c684c6a42 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesListSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for ChildAvailabilityStatuses List. */ +public final class ChildAvailabilityStatusesListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildAvailabilityStatuses_List.json + */ + /** + * Sample code: GetChildHealthHistoryByResource. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getChildHealthHistoryByResource( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .childAvailabilityStatuses() + .list( + "subscriptions/227b734f-e14f-4de6-b7fc-3190c21e69f6/resourceGroups/JUHACKETRHCTEST/providers/Microsoft.Compute/virtualMachineScaleSets/rhctest/virtualMachines/4", + null, + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildResourcesListSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildResourcesListSamples.java new file mode 100644 index 000000000000..ed897190281c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ChildResourcesListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for ChildResources List. */ +public final class ChildResourcesListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ChildResources_List.json + */ + /** + * Sample code: GetCurrentChildHealthByResource. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getCurrentChildHealthByResource( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.childResources().list("resourceUri", null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetSamples.java new file mode 100644 index 000000000000..0db74f25b0dc --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.resourcemanager.resourcehealth.models.IssueNameParameter; + +/** Samples for EmergingIssues Get. */ +public final class EmergingIssuesGetSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_Get.json + */ + /** + * Sample code: GetEmergingIssues. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getEmergingIssues(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.emergingIssues().getWithResponse(IssueNameParameter.DEFAULT, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesListSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesListSamples.java new file mode 100644 index 000000000000..b7b1cbfa6e99 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for EmergingIssues List. */ +public final class EmergingIssuesListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json + */ + /** + * Sample code: GetEmergingIssues. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getEmergingIssues(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.emergingIssues().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsBySubscriptionIdAndTrackingIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsBySubscriptionIdAndTrackingIdSamples.java new file mode 100644 index 000000000000..cb29283681fe --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsBySubscriptionIdAndTrackingIdSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for EventOperation FetchDetailsBySubscriptionIdAndTrackingId. */ +public final class EventOperationFetchDetailsBySubscriptionIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json + */ + /** + * Sample code: EventDetailsBySubscriptionIdAndTrackingId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void eventDetailsBySubscriptionIdAndTrackingId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventOperations() + .fetchDetailsBySubscriptionIdAndTrackingIdWithResponse("eventTrackingId", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsByTenantIdAndTrackingIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsByTenantIdAndTrackingIdSamples.java new file mode 100644 index 000000000000..1c9785590a07 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationFetchDetailsByTenantIdAndTrackingIdSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for EventOperation FetchDetailsByTenantIdAndTrackingId. */ +public final class EventOperationFetchDetailsByTenantIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_fetchDetailsByTenantIdAndTrackingId.json + */ + /** + * Sample code: EventDetailsByTenantIdAndTrackingId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void eventDetailsByTenantIdAndTrackingId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventOperations() + .fetchDetailsByTenantIdAndTrackingIdWithResponse("eventTrackingId", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetBySubscriptionIdAndTrackingIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetBySubscriptionIdAndTrackingIdSamples.java new file mode 100644 index 000000000000..d86822c705eb --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetBySubscriptionIdAndTrackingIdSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for EventOperation GetBySubscriptionIdAndTrackingId. */ +public final class EventOperationGetBySubscriptionIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetBySubscriptionIdAndTrackingId.json + */ + /** + * Sample code: SecurityAdvisoriesEventBySubscriptionIdAndTrackingId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void securityAdvisoriesEventBySubscriptionIdAndTrackingId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventOperations() + .getBySubscriptionIdAndTrackingIdWithResponse( + "eventTrackingId", "properties/status eq 'Active'", "7/10/2022", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetByTenantIdAndTrackingIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetByTenantIdAndTrackingIdSamples.java new file mode 100644 index 000000000000..f71ef111579b --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventOperationGetByTenantIdAndTrackingIdSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for EventOperation GetByTenantIdAndTrackingId. */ +public final class EventOperationGetByTenantIdAndTrackingIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Event_GetByTenantIdAndTrackingId.json + */ + /** + * Sample code: EventByTenantIdAndTrackingId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void eventByTenantIdAndTrackingId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventOperations() + .getByTenantIdAndTrackingIdWithResponse( + "eventTrackingId", "properties/status eq 'Active'", "7/10/2022", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListBySingleResourceSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListBySingleResourceSamples.java new file mode 100644 index 000000000000..349fd359f661 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListBySingleResourceSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for EventsOperation ListBySingleResource. */ +public final class EventsOperationListBySingleResourceSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySingleResource.json + */ + /** + * Sample code: ListEventsBySingleResource. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listEventsBySingleResource( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventsOperations() + .listBySingleResource( + "subscriptions/4abcdefgh-ijkl-mnop-qrstuvwxyz/resourceGroups/rhctestenv/providers/Microsoft.Compute/virtualMachines/rhctestenvV1PI", + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListByTenantIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListByTenantIdSamples.java new file mode 100644 index 000000000000..48ec5b4df008 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListByTenantIdSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for EventsOperation ListByTenantId. */ +public final class EventsOperationListByTenantIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListByTenantId.json + */ + /** + * Sample code: ListEventsByTenantId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listEventsByTenantId(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventsOperations() + .listByTenantId( + "service eq 'Virtual Machines' or region eq 'West US'", "7/24/2020", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListSamples.java new file mode 100644 index 000000000000..117ee38090c8 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/EventsOperationListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for EventsOperation List. */ +public final class EventsOperationListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Events_ListBySubscriptionId.json + */ + /** + * Sample code: ListEventsBySubscriptionId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listEventsBySubscriptionId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .eventsOperations() + .list( + "service eq 'Virtual Machines' or region eq 'West US'", "7/24/2020", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetByTenantIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetByTenantIdSamples.java new file mode 100644 index 000000000000..5c5c026ab89c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetByTenantIdSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for ImpactedResources GetByTenantId. */ +public final class ImpactedResourcesGetByTenantIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_GetByTenantId.json + */ + /** + * Sample code: ImpactedResourcesGet. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void impactedResourcesGet(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .impactedResources() + .getByTenantIdWithResponse("BC_1-FXZ", "abc-123-ghj-456", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetSamples.java new file mode 100644 index 000000000000..ac28fa587d22 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for ImpactedResources Get. */ +public final class ImpactedResourcesGetSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_Get.json + */ + /** + * Sample code: ImpactedResourcesGet. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void impactedResourcesGet(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.impactedResources().getWithResponse("BC_1-FXZ", "abc-123-ghj-456", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListBySubscriptionIdAndEventIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListBySubscriptionIdAndEventIdSamples.java new file mode 100644 index 000000000000..cee1e82fe2ce --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListBySubscriptionIdAndEventIdSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for ImpactedResources ListBySubscriptionIdAndEventId. */ +public final class ImpactedResourcesListBySubscriptionIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json + */ + /** + * Sample code: ListImpactedResourcesBySubscriptionId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listImpactedResourcesBySubscriptionId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .impactedResources() + .listBySubscriptionIdAndEventId("BC_1-FXZ", "targetRegion eq 'westus'", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListByTenantIdAndEventIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListByTenantIdAndEventIdSamples.java new file mode 100644 index 000000000000..bf50e9560c8f --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListByTenantIdAndEventIdSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for ImpactedResources ListByTenantIdAndEventId. */ +public final class ImpactedResourcesListByTenantIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/ImpactedResources_ListByTenantId_ListByEventId.json + */ + /** + * Sample code: ListEventsByTenantId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listEventsByTenantId(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .impactedResources() + .listByTenantIdAndEventId("BC_1-FXZ", "targetRegion eq 'westus'", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataGetEntitySamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataGetEntitySamples.java new file mode 100644 index 000000000000..bf5324d6cbec --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataGetEntitySamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for Metadata GetEntity. */ +public final class MetadataGetEntitySamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_GetEntity.json + */ + /** + * Sample code: GetMetadata. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getMetadata(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.metadatas().getEntityWithResponse("status", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataListSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataListSamples.java new file mode 100644 index 000000000000..a27f7d3d66cf --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/MetadataListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for Metadata List. */ +public final class MetadataListSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/Metadata_List.json + */ + /** + * Sample code: GetMetadata. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void getMetadata(com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager.metadatas().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSamples.java new file mode 100644 index 000000000000..cc1e87860458 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for SecurityAdvisoryImpactedResources ListBySubscriptionIdAndEventId. */ +public final class SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json + */ + /** + * Sample code: ListSecurityAdvisoryImpactedResourcesBySubscriptionId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listSecurityAdvisoryImpactedResourcesBySubscriptionId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .securityAdvisoryImpactedResources() + .listBySubscriptionIdAndEventId("BC_1-FXZ", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdSamples.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdSamples.java new file mode 100644 index 000000000000..c876674bfb18 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/samples/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +/** Samples for SecurityAdvisoryImpactedResources ListByTenantIdAndEventId. */ +public final class SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdSamples { + /* + * x-ms-original-file: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json + */ + /** + * Sample code: ListSecurityAdvisoryImpactedResourcesByTenantId. + * + * @param manager Entry point to ResourceHealthManager. + */ + public static void listSecurityAdvisoryImpactedResourcesByTenantId( + com.azure.resourcemanager.resourcehealth.ResourceHealthManager manager) { + manager + .securityAdvisoryImpactedResources() + .listByTenantIdAndEventId("BC_1-FXZ", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesGetByResourceWithResponseMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesGetByResourceWithResponseMockTests.java new file mode 100644 index 000000000000..f63ec19656e0 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesGetByResourceWithResponseMockTests.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStateValues; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatus; +import com.azure.resourcemanager.resourcehealth.models.ReasonChronicityTypes; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ChildAvailabilityStatusesGetByResourceWithResponseMockTests { + @Test + public void testGetByResourceWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"id\":\"tawfsdjpvkvp\",\"name\":\"xbkzbzkdvncj\",\"type\":\"udurgkakmokz\",\"location\":\"jk\",\"properties\":{\"availabilityState\":\"Unknown\",\"title\":\"ouw\",\"summary\":\"gzrf\",\"detailedStatus\":\"eyebizikayuhql\",\"reasonType\":\"bs\",\"context\":\"bqwrvtldgm\",\"category\":\"gvmpipaslthaqfx\",\"articleId\":\"mwutwbdsre\",\"rootCauseAttributionTime\":\"2021-03-19T15:07:21Z\",\"healthEventType\":\"hneuyowqkd\",\"healthEventCause\":\"t\",\"healthEventCategory\":\"ib\",\"healthEventId\":\"cgpik\",\"resolutionETA\":\"2021-11-09T05:31:13Z\",\"occuredTime\":\"2021-04-11T09:56:20Z\",\"reasonChronicity\":\"Transient\",\"reportedTime\":\"2021-11-14T04:35:06Z\",\"recentlyResolved\":{\"unavailableOccuredTime\":\"2020-12-28T15:25:21Z\",\"resolvedTime\":\"2021-05-28T04:48:51Z\",\"unavailableSummary\":\"vrmbzono\"},\"recommendedActions\":[],\"serviceImpactingEvents\":[]}}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + AvailabilityStatus response = + manager + .childAvailabilityStatuses() + .getByResourceWithResponse( + "mkrefajpjorwkq", "yhgbijtjivfx", "sjabibs", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("tawfsdjpvkvp", response.id()); + Assertions.assertEquals("xbkzbzkdvncj", response.name()); + Assertions.assertEquals("udurgkakmokz", response.type()); + Assertions.assertEquals("jk", response.location()); + Assertions.assertEquals(AvailabilityStateValues.UNKNOWN, response.properties().availabilityState()); + Assertions.assertEquals("ouw", response.properties().title()); + Assertions.assertEquals("gzrf", response.properties().summary()); + Assertions.assertEquals("eyebizikayuhql", response.properties().detailedStatus()); + Assertions.assertEquals("bs", response.properties().reasonType()); + Assertions.assertEquals("bqwrvtldgm", response.properties().context()); + Assertions.assertEquals("gvmpipaslthaqfx", response.properties().category()); + Assertions.assertEquals("mwutwbdsre", response.properties().articleId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-03-19T15:07:21Z"), response.properties().rootCauseAttributionTime()); + Assertions.assertEquals("hneuyowqkd", response.properties().healthEventType()); + Assertions.assertEquals("t", response.properties().healthEventCause()); + Assertions.assertEquals("ib", response.properties().healthEventCategory()); + Assertions.assertEquals("cgpik", response.properties().healthEventId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-09T05:31:13Z"), response.properties().resolutionEta()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-11T09:56:20Z"), response.properties().occuredTime()); + Assertions.assertEquals(ReasonChronicityTypes.TRANSIENT, response.properties().reasonChronicity()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-14T04:35:06Z"), response.properties().reportedTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2020-12-28T15:25:21Z"), + response.properties().recentlyResolved().unavailableOccuredTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-05-28T04:48:51Z"), response.properties().recentlyResolved().resolvedTime()); + Assertions.assertEquals("vrmbzono", response.properties().recentlyResolved().unavailableSummary()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesListMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesListMockTests.java new file mode 100644 index 000000000000..8bae6cfc283e --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ChildAvailabilityStatusesListMockTests.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStateValues; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatus; +import com.azure.resourcemanager.resourcehealth.models.ReasonChronicityTypes; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ChildAvailabilityStatusesListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"id\":\"indfpwpjyl\",\"name\":\"tlhflsjcdhszf\",\"type\":\"fbgofeljagrqmqh\",\"location\":\"vriiio\",\"properties\":{\"availabilityState\":\"Available\",\"title\":\"hfkvtvsexsowuel\",\"summary\":\"hhahhxvrhmzkwpjg\",\"detailedStatus\":\"spughftqsxhq\",\"reasonType\":\"j\",\"context\":\"kndxdigrjgu\",\"category\":\"zdmsyqtfi\",\"articleId\":\"hbotzingamvppho\",\"rootCauseAttributionTime\":\"2021-03-18T11:58:55Z\",\"healthEventType\":\"udphqamvdkfwyn\",\"healthEventCause\":\"vtbvkayh\",\"healthEventCategory\":\"nvyq\",\"healthEventId\":\"tkzwpcnpwzc\",\"resolutionETA\":\"2021-05-22T23:16:36Z\",\"occuredTime\":\"2021-02-06T15:24:08Z\",\"reasonChronicity\":\"Transient\",\"reportedTime\":\"2021-02-07T07:30:38Z\",\"recentlyResolved\":{\"unavailableOccuredTime\":\"2021-03-29T04:52:48Z\",\"resolvedTime\":\"2021-01-01T20:15:01Z\",\"unavailableSummary\":\"qfhwyg\"},\"recommendedActions\":[],\"serviceImpactingEvents\":[]}}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.childAvailabilityStatuses().list("q", "irgzp", "rlazszrnw", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("indfpwpjyl", response.iterator().next().id()); + Assertions.assertEquals("tlhflsjcdhszf", response.iterator().next().name()); + Assertions.assertEquals("fbgofeljagrqmqh", response.iterator().next().type()); + Assertions.assertEquals("vriiio", response.iterator().next().location()); + Assertions + .assertEquals( + AvailabilityStateValues.AVAILABLE, response.iterator().next().properties().availabilityState()); + Assertions.assertEquals("hfkvtvsexsowuel", response.iterator().next().properties().title()); + Assertions.assertEquals("hhahhxvrhmzkwpjg", response.iterator().next().properties().summary()); + Assertions.assertEquals("spughftqsxhq", response.iterator().next().properties().detailedStatus()); + Assertions.assertEquals("j", response.iterator().next().properties().reasonType()); + Assertions.assertEquals("kndxdigrjgu", response.iterator().next().properties().context()); + Assertions.assertEquals("zdmsyqtfi", response.iterator().next().properties().category()); + Assertions.assertEquals("hbotzingamvppho", response.iterator().next().properties().articleId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-03-18T11:58:55Z"), + response.iterator().next().properties().rootCauseAttributionTime()); + Assertions.assertEquals("udphqamvdkfwyn", response.iterator().next().properties().healthEventType()); + Assertions.assertEquals("vtbvkayh", response.iterator().next().properties().healthEventCause()); + Assertions.assertEquals("nvyq", response.iterator().next().properties().healthEventCategory()); + Assertions.assertEquals("tkzwpcnpwzc", response.iterator().next().properties().healthEventId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-05-22T23:16:36Z"), response.iterator().next().properties().resolutionEta()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-02-06T15:24:08Z"), response.iterator().next().properties().occuredTime()); + Assertions + .assertEquals(ReasonChronicityTypes.TRANSIENT, response.iterator().next().properties().reasonChronicity()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-02-07T07:30:38Z"), response.iterator().next().properties().reportedTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-03-29T04:52:48Z"), + response.iterator().next().properties().recentlyResolved().unavailableOccuredTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-01-01T20:15:01Z"), + response.iterator().next().properties().recentlyResolved().resolvedTime()); + Assertions + .assertEquals("qfhwyg", response.iterator().next().properties().recentlyResolved().unavailableSummary()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ChildResourcesListMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ChildResourcesListMockTests.java new file mode 100644 index 000000000000..03a32a3e95b3 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ChildResourcesListMockTests.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStateValues; +import com.azure.resourcemanager.resourcehealth.models.AvailabilityStatus; +import com.azure.resourcemanager.resourcehealth.models.ReasonChronicityTypes; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ChildResourcesListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"id\":\"psvuoymgc\",\"name\":\"lvez\",\"type\":\"pqlmfe\",\"location\":\"erqwkyhkobopg\",\"properties\":{\"availabilityState\":\"Available\",\"title\":\"wep\",\"summary\":\"pc\",\"detailedStatus\":\"kbwcc\",\"reasonType\":\"jvcdwxlpqekf\",\"context\":\"khtj\",\"category\":\"i\",\"articleId\":\"wfqatmtd\",\"rootCauseAttributionTime\":\"2021-01-16T13:50:23Z\",\"healthEventType\":\"vypgikdg\",\"healthEventCause\":\"ywkbirryuzhlhkjo\",\"healthEventCategory\":\"vqqaatjinrvgo\",\"healthEventId\":\"mfiibfggj\",\"resolutionETA\":\"2021-04-08T04:20:38Z\",\"occuredTime\":\"2021-04-15T19:39:33Z\",\"reasonChronicity\":\"Persistent\",\"reportedTime\":\"2021-01-31T00:57:49Z\",\"recentlyResolved\":{\"unavailableOccuredTime\":\"2021-07-25T08:46:43Z\",\"resolvedTime\":\"2021-04-24T02:16:24Z\",\"unavailableSummary\":\"lqwjygvjayvblm\"},\"recommendedActions\":[],\"serviceImpactingEvents\":[]}}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.childResources().list("kfxu", "emdwzrmuhapfc", "dpsqx", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("psvuoymgc", response.iterator().next().id()); + Assertions.assertEquals("lvez", response.iterator().next().name()); + Assertions.assertEquals("pqlmfe", response.iterator().next().type()); + Assertions.assertEquals("erqwkyhkobopg", response.iterator().next().location()); + Assertions + .assertEquals( + AvailabilityStateValues.AVAILABLE, response.iterator().next().properties().availabilityState()); + Assertions.assertEquals("wep", response.iterator().next().properties().title()); + Assertions.assertEquals("pc", response.iterator().next().properties().summary()); + Assertions.assertEquals("kbwcc", response.iterator().next().properties().detailedStatus()); + Assertions.assertEquals("jvcdwxlpqekf", response.iterator().next().properties().reasonType()); + Assertions.assertEquals("khtj", response.iterator().next().properties().context()); + Assertions.assertEquals("i", response.iterator().next().properties().category()); + Assertions.assertEquals("wfqatmtd", response.iterator().next().properties().articleId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-01-16T13:50:23Z"), + response.iterator().next().properties().rootCauseAttributionTime()); + Assertions.assertEquals("vypgikdg", response.iterator().next().properties().healthEventType()); + Assertions.assertEquals("ywkbirryuzhlhkjo", response.iterator().next().properties().healthEventCause()); + Assertions.assertEquals("vqqaatjinrvgo", response.iterator().next().properties().healthEventCategory()); + Assertions.assertEquals("mfiibfggj", response.iterator().next().properties().healthEventId()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-08T04:20:38Z"), response.iterator().next().properties().resolutionEta()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-15T19:39:33Z"), response.iterator().next().properties().occuredTime()); + Assertions + .assertEquals(ReasonChronicityTypes.PERSISTENT, response.iterator().next().properties().reasonChronicity()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-01-31T00:57:49Z"), response.iterator().next().properties().reportedTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-07-25T08:46:43Z"), + response.iterator().next().properties().recentlyResolved().unavailableOccuredTime()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-24T02:16:24Z"), + response.iterator().next().properties().recentlyResolved().resolvedTime()); + Assertions + .assertEquals( + "lqwjygvjayvblm", response.iterator().next().properties().recentlyResolved().unavailableSummary()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssueImpactTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssueImpactTests.java new file mode 100644 index 000000000000..f76788b42536 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssueImpactTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssueImpact; +import com.azure.resourcemanager.resourcehealth.models.ImpactedRegion; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EmergingIssueImpactTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EmergingIssueImpact model = + BinaryData + .fromString( + "{\"id\":\"fxoblytkb\",\"name\":\"pe\",\"regions\":[{\"id\":\"bkrvrnsvshqj\",\"name\":\"xc\"},{\"id\":\"bfovasrruvwbhsq\",\"name\":\"ubcgjbirxb\"},{\"id\":\"bsrfbj\",\"name\":\"twss\"}]}") + .toObject(EmergingIssueImpact.class); + Assertions.assertEquals("fxoblytkb", model.id()); + Assertions.assertEquals("pe", model.name()); + Assertions.assertEquals("bkrvrnsvshqj", model.regions().get(0).id()); + Assertions.assertEquals("xc", model.regions().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EmergingIssueImpact model = + new EmergingIssueImpact() + .withId("fxoblytkb") + .withName("pe") + .withRegions( + Arrays + .asList( + new ImpactedRegion().withId("bkrvrnsvshqj").withName("xc"), + new ImpactedRegion().withId("bfovasrruvwbhsq").withName("ubcgjbirxb"), + new ImpactedRegion().withId("bsrfbj").withName("twss"))); + model = BinaryData.fromObject(model).toObject(EmergingIssueImpact.class); + Assertions.assertEquals("fxoblytkb", model.id()); + Assertions.assertEquals("pe", model.name()); + Assertions.assertEquals("bkrvrnsvshqj", model.regions().get(0).id()); + Assertions.assertEquals("xc", model.regions().get(0).name()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssueListResultTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssueListResultTests.java new file mode 100644 index 000000000000..d80b316e2193 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssueListResultTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssueListResult; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EmergingIssueListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EmergingIssueListResult model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"refreshTimestamp\":\"2021-05-16T16:57:57Z\",\"statusBanners\":[],\"statusActiveEvents\":[]},\"id\":\"mwsrcrgvxpvgo\",\"name\":\"zlfmisgwbnbbeld\",\"type\":\"wkz\"},{\"properties\":{\"refreshTimestamp\":\"2021-02-02T16:45:23Z\",\"statusBanners\":[],\"statusActiveEvents\":[]},\"id\":\"qhakauhashsf\",\"name\":\"xosow\",\"type\":\"xcug\"},{\"properties\":{\"refreshTimestamp\":\"2020-12-22T21:46:37Z\",\"statusBanners\":[],\"statusActiveEvents\":[]},\"id\":\"j\",\"name\":\"bwpucwwfvovbv\",\"type\":\"euecivyhzceuoj\"}],\"nextLink\":\"rw\"}") + .toObject(EmergingIssueListResult.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-16T16:57:57Z"), model.value().get(0).refreshTimestamp()); + Assertions.assertEquals("rw", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EmergingIssueListResult model = + new EmergingIssueListResult() + .withValue( + Arrays + .asList( + new EmergingIssuesGetResultInner() + .withRefreshTimestamp(OffsetDateTime.parse("2021-05-16T16:57:57Z")) + .withStatusBanners(Arrays.asList()) + .withStatusActiveEvents(Arrays.asList()), + new EmergingIssuesGetResultInner() + .withRefreshTimestamp(OffsetDateTime.parse("2021-02-02T16:45:23Z")) + .withStatusBanners(Arrays.asList()) + .withStatusActiveEvents(Arrays.asList()), + new EmergingIssuesGetResultInner() + .withRefreshTimestamp(OffsetDateTime.parse("2020-12-22T21:46:37Z")) + .withStatusBanners(Arrays.asList()) + .withStatusActiveEvents(Arrays.asList()))) + .withNextLink("rw"); + model = BinaryData.fromObject(model).toObject(EmergingIssueListResult.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-16T16:57:57Z"), model.value().get(0).refreshTimestamp()); + Assertions.assertEquals("rw", model.nextLink()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssueTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssueTests.java new file mode 100644 index 000000000000..e1bf09b670ec --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssueTests.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssue; +import com.azure.resourcemanager.resourcehealth.models.SeverityValues; +import com.azure.resourcemanager.resourcehealth.models.StageValues; +import com.azure.resourcemanager.resourcehealth.models.StatusActiveEvent; +import com.azure.resourcemanager.resourcehealth.models.StatusBanner; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EmergingIssueTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EmergingIssue model = + BinaryData + .fromString( + "{\"refreshTimestamp\":\"2021-11-26T08:31:17Z\",\"statusBanners\":[{\"title\":\"umveekgpwozuhkf\",\"message\":\"sjyofdx\",\"cloud\":\"us\",\"lastModifiedTime\":\"2021-04-08T00:20:33Z\"},{\"title\":\"uwaboekqvke\",\"message\":\"smv\",\"cloud\":\"wyjsflhhcaalnjix\",\"lastModifiedTime\":\"2021-07-17T12:41:40Z\"},{\"title\":\"awjoyaqcslyjp\",\"message\":\"idzyexznelixhnr\",\"cloud\":\"folhbnxknal\",\"lastModifiedTime\":\"2021-06-16T03:28:56Z\"}],\"statusActiveEvents\":[{\"title\":\"gdtpnapnyiro\",\"description\":\"hpigv\",\"trackingId\":\"ylgqgitxmedjvcsl\",\"startTime\":\"2021-02-07T09:50:45Z\",\"cloud\":\"wncwzzhxgktrmg\",\"severity\":\"Error\",\"stage\":\"Resolve\",\"published\":false,\"lastModifiedTime\":\"2021-10-09T08:24:24Z\",\"impacts\":[]}]}") + .toObject(EmergingIssue.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-26T08:31:17Z"), model.refreshTimestamp()); + Assertions.assertEquals("umveekgpwozuhkf", model.statusBanners().get(0).title()); + Assertions.assertEquals("sjyofdx", model.statusBanners().get(0).message()); + Assertions.assertEquals("us", model.statusBanners().get(0).cloud()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-08T00:20:33Z"), model.statusBanners().get(0).lastModifiedTime()); + Assertions.assertEquals("gdtpnapnyiro", model.statusActiveEvents().get(0).title()); + Assertions.assertEquals("hpigv", model.statusActiveEvents().get(0).description()); + Assertions.assertEquals("ylgqgitxmedjvcsl", model.statusActiveEvents().get(0).trackingId()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-02-07T09:50:45Z"), model.statusActiveEvents().get(0).startTime()); + Assertions.assertEquals("wncwzzhxgktrmg", model.statusActiveEvents().get(0).cloud()); + Assertions.assertEquals(SeverityValues.ERROR, model.statusActiveEvents().get(0).severity()); + Assertions.assertEquals(StageValues.RESOLVE, model.statusActiveEvents().get(0).stage()); + Assertions.assertEquals(false, model.statusActiveEvents().get(0).published()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-10-09T08:24:24Z"), model.statusActiveEvents().get(0).lastModifiedTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EmergingIssue model = + new EmergingIssue() + .withRefreshTimestamp(OffsetDateTime.parse("2021-11-26T08:31:17Z")) + .withStatusBanners( + Arrays + .asList( + new StatusBanner() + .withTitle("umveekgpwozuhkf") + .withMessage("sjyofdx") + .withCloud("us") + .withLastModifiedTime(OffsetDateTime.parse("2021-04-08T00:20:33Z")), + new StatusBanner() + .withTitle("uwaboekqvke") + .withMessage("smv") + .withCloud("wyjsflhhcaalnjix") + .withLastModifiedTime(OffsetDateTime.parse("2021-07-17T12:41:40Z")), + new StatusBanner() + .withTitle("awjoyaqcslyjp") + .withMessage("idzyexznelixhnr") + .withCloud("folhbnxknal") + .withLastModifiedTime(OffsetDateTime.parse("2021-06-16T03:28:56Z")))) + .withStatusActiveEvents( + Arrays + .asList( + new StatusActiveEvent() + .withTitle("gdtpnapnyiro") + .withDescription("hpigv") + .withTrackingId("ylgqgitxmedjvcsl") + .withStartTime(OffsetDateTime.parse("2021-02-07T09:50:45Z")) + .withCloud("wncwzzhxgktrmg") + .withSeverity(SeverityValues.ERROR) + .withStage(StageValues.RESOLVE) + .withPublished(false) + .withLastModifiedTime(OffsetDateTime.parse("2021-10-09T08:24:24Z")) + .withImpacts(Arrays.asList()))); + model = BinaryData.fromObject(model).toObject(EmergingIssue.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-26T08:31:17Z"), model.refreshTimestamp()); + Assertions.assertEquals("umveekgpwozuhkf", model.statusBanners().get(0).title()); + Assertions.assertEquals("sjyofdx", model.statusBanners().get(0).message()); + Assertions.assertEquals("us", model.statusBanners().get(0).cloud()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-08T00:20:33Z"), model.statusBanners().get(0).lastModifiedTime()); + Assertions.assertEquals("gdtpnapnyiro", model.statusActiveEvents().get(0).title()); + Assertions.assertEquals("hpigv", model.statusActiveEvents().get(0).description()); + Assertions.assertEquals("ylgqgitxmedjvcsl", model.statusActiveEvents().get(0).trackingId()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-02-07T09:50:45Z"), model.statusActiveEvents().get(0).startTime()); + Assertions.assertEquals("wncwzzhxgktrmg", model.statusActiveEvents().get(0).cloud()); + Assertions.assertEquals(SeverityValues.ERROR, model.statusActiveEvents().get(0).severity()); + Assertions.assertEquals(StageValues.RESOLVE, model.statusActiveEvents().get(0).stage()); + Assertions.assertEquals(false, model.statusActiveEvents().get(0).published()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-10-09T08:24:24Z"), model.statusActiveEvents().get(0).lastModifiedTime()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetResultInnerTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetResultInnerTests.java new file mode 100644 index 000000000000..3e80d16396dd --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetResultInnerTests.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EmergingIssuesGetResultInner; +import com.azure.resourcemanager.resourcehealth.models.SeverityValues; +import com.azure.resourcemanager.resourcehealth.models.StageValues; +import com.azure.resourcemanager.resourcehealth.models.StatusActiveEvent; +import com.azure.resourcemanager.resourcehealth.models.StatusBanner; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EmergingIssuesGetResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EmergingIssuesGetResultInner model = + BinaryData + .fromString( + "{\"properties\":{\"refreshTimestamp\":\"2021-01-05T12:33:20Z\",\"statusBanners\":[{\"title\":\"mcdytdxwitxnrj\",\"message\":\"gqwgxhniskxfbkp\",\"cloud\":\"gklwn\",\"lastModifiedTime\":\"2021-09-10T01:27:47Z\"}],\"statusActiveEvents\":[{\"title\":\"uwhvylwzbtdhxujz\",\"description\":\"mpowuwpr\",\"trackingId\":\"lve\",\"startTime\":\"2021-01-24T13:59:26Z\",\"cloud\":\"pjmkhfxobbc\",\"severity\":\"Warning\",\"stage\":\"Active\",\"published\":true,\"lastModifiedTime\":\"2021-04-01T12:50:08Z\",\"impacts\":[]},{\"title\":\"bpbewtghfgb\",\"description\":\"gw\",\"trackingId\":\"vlvqhjkbegi\",\"startTime\":\"2021-03-26T15:32:51Z\",\"cloud\":\"xiebwwaloayqcg\",\"severity\":\"Warning\",\"stage\":\"Active\",\"published\":false,\"lastModifiedTime\":\"2021-08-18T20:27:18Z\",\"impacts\":[]},{\"title\":\"mhtxongmtsavjcb\",\"description\":\"xqpsrknftguv\",\"trackingId\":\"uhprwmdyvxqt\",\"startTime\":\"2021-09-21T09:24:54Z\",\"cloud\":\"ww\",\"severity\":\"Error\",\"stage\":\"Active\",\"published\":true,\"lastModifiedTime\":\"2021-06-25T11:51:15Z\",\"impacts\":[]},{\"title\":\"ibycno\",\"description\":\"knme\",\"trackingId\":\"sgzvahapjyzhpv\",\"startTime\":\"2021-11-12T18:49:52Z\",\"cloud\":\"j\",\"severity\":\"Information\",\"stage\":\"Archived\",\"published\":true,\"lastModifiedTime\":\"2021-11-01T21:36:12Z\",\"impacts\":[]}]},\"id\":\"kvugfhzovawjvzun\",\"name\":\"uthnnprnxipeilpj\",\"type\":\"uaejxdultsk\"}") + .toObject(EmergingIssuesGetResultInner.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-05T12:33:20Z"), model.refreshTimestamp()); + Assertions.assertEquals("mcdytdxwitxnrj", model.statusBanners().get(0).title()); + Assertions.assertEquals("gqwgxhniskxfbkp", model.statusBanners().get(0).message()); + Assertions.assertEquals("gklwn", model.statusBanners().get(0).cloud()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-09-10T01:27:47Z"), model.statusBanners().get(0).lastModifiedTime()); + Assertions.assertEquals("uwhvylwzbtdhxujz", model.statusActiveEvents().get(0).title()); + Assertions.assertEquals("mpowuwpr", model.statusActiveEvents().get(0).description()); + Assertions.assertEquals("lve", model.statusActiveEvents().get(0).trackingId()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-01-24T13:59:26Z"), model.statusActiveEvents().get(0).startTime()); + Assertions.assertEquals("pjmkhfxobbc", model.statusActiveEvents().get(0).cloud()); + Assertions.assertEquals(SeverityValues.WARNING, model.statusActiveEvents().get(0).severity()); + Assertions.assertEquals(StageValues.ACTIVE, model.statusActiveEvents().get(0).stage()); + Assertions.assertEquals(true, model.statusActiveEvents().get(0).published()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-01T12:50:08Z"), model.statusActiveEvents().get(0).lastModifiedTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EmergingIssuesGetResultInner model = + new EmergingIssuesGetResultInner() + .withRefreshTimestamp(OffsetDateTime.parse("2021-01-05T12:33:20Z")) + .withStatusBanners( + Arrays + .asList( + new StatusBanner() + .withTitle("mcdytdxwitxnrj") + .withMessage("gqwgxhniskxfbkp") + .withCloud("gklwn") + .withLastModifiedTime(OffsetDateTime.parse("2021-09-10T01:27:47Z")))) + .withStatusActiveEvents( + Arrays + .asList( + new StatusActiveEvent() + .withTitle("uwhvylwzbtdhxujz") + .withDescription("mpowuwpr") + .withTrackingId("lve") + .withStartTime(OffsetDateTime.parse("2021-01-24T13:59:26Z")) + .withCloud("pjmkhfxobbc") + .withSeverity(SeverityValues.WARNING) + .withStage(StageValues.ACTIVE) + .withPublished(true) + .withLastModifiedTime(OffsetDateTime.parse("2021-04-01T12:50:08Z")) + .withImpacts(Arrays.asList()), + new StatusActiveEvent() + .withTitle("bpbewtghfgb") + .withDescription("gw") + .withTrackingId("vlvqhjkbegi") + .withStartTime(OffsetDateTime.parse("2021-03-26T15:32:51Z")) + .withCloud("xiebwwaloayqcg") + .withSeverity(SeverityValues.WARNING) + .withStage(StageValues.ACTIVE) + .withPublished(false) + .withLastModifiedTime(OffsetDateTime.parse("2021-08-18T20:27:18Z")) + .withImpacts(Arrays.asList()), + new StatusActiveEvent() + .withTitle("mhtxongmtsavjcb") + .withDescription("xqpsrknftguv") + .withTrackingId("uhprwmdyvxqt") + .withStartTime(OffsetDateTime.parse("2021-09-21T09:24:54Z")) + .withCloud("ww") + .withSeverity(SeverityValues.ERROR) + .withStage(StageValues.ACTIVE) + .withPublished(true) + .withLastModifiedTime(OffsetDateTime.parse("2021-06-25T11:51:15Z")) + .withImpacts(Arrays.asList()), + new StatusActiveEvent() + .withTitle("ibycno") + .withDescription("knme") + .withTrackingId("sgzvahapjyzhpv") + .withStartTime(OffsetDateTime.parse("2021-11-12T18:49:52Z")) + .withCloud("j") + .withSeverity(SeverityValues.INFORMATION) + .withStage(StageValues.ARCHIVED) + .withPublished(true) + .withLastModifiedTime(OffsetDateTime.parse("2021-11-01T21:36:12Z")) + .withImpacts(Arrays.asList()))); + model = BinaryData.fromObject(model).toObject(EmergingIssuesGetResultInner.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-05T12:33:20Z"), model.refreshTimestamp()); + Assertions.assertEquals("mcdytdxwitxnrj", model.statusBanners().get(0).title()); + Assertions.assertEquals("gqwgxhniskxfbkp", model.statusBanners().get(0).message()); + Assertions.assertEquals("gklwn", model.statusBanners().get(0).cloud()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-09-10T01:27:47Z"), model.statusBanners().get(0).lastModifiedTime()); + Assertions.assertEquals("uwhvylwzbtdhxujz", model.statusActiveEvents().get(0).title()); + Assertions.assertEquals("mpowuwpr", model.statusActiveEvents().get(0).description()); + Assertions.assertEquals("lve", model.statusActiveEvents().get(0).trackingId()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-01-24T13:59:26Z"), model.statusActiveEvents().get(0).startTime()); + Assertions.assertEquals("pjmkhfxobbc", model.statusActiveEvents().get(0).cloud()); + Assertions.assertEquals(SeverityValues.WARNING, model.statusActiveEvents().get(0).severity()); + Assertions.assertEquals(StageValues.ACTIVE, model.statusActiveEvents().get(0).stage()); + Assertions.assertEquals(true, model.statusActiveEvents().get(0).published()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-01T12:50:08Z"), model.statusActiveEvents().get(0).lastModifiedTime()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetWithResponseMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetWithResponseMockTests.java new file mode 100644 index 000000000000..042674e6f0e4 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesGetWithResponseMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssuesGetResult; +import com.azure.resourcemanager.resourcehealth.models.IssueNameParameter; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class EmergingIssuesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"refreshTimestamp\":\"2021-09-27T14:47:09Z\",\"statusBanners\":[],\"statusActiveEvents\":[]},\"id\":\"dn\",\"name\":\"itvgbmhrixkwm\",\"type\":\"ijejvegrhbpn\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + EmergingIssuesGetResult response = + manager + .emergingIssues() + .getWithResponse(IssueNameParameter.DEFAULT, com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(OffsetDateTime.parse("2021-09-27T14:47:09Z"), response.refreshTimestamp()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesListMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesListMockTests.java new file mode 100644 index 000000000000..0a75a35b39b6 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EmergingIssuesListMockTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssuesGetResult; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class EmergingIssuesListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"refreshTimestamp\":\"2021-11-23T11:34:55Z\",\"statusBanners\":[],\"statusActiveEvents\":[]},\"id\":\"s\",\"name\":\"pbyrqufegxu\",\"type\":\"wz\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.emergingIssues().list(com.azure.core.util.Context.NONE); + + Assertions + .assertEquals(OffsetDateTime.parse("2021-11-23T11:34:55Z"), response.iterator().next().refreshTimestamp()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventImpactedResourceListResultTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventImpactedResourceListResultTests.java new file mode 100644 index 000000000000..b0647642e028 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventImpactedResourceListResultTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventImpactedResourceInner; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResourceListResult; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EventImpactedResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EventImpactedResourceListResult model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"targetResourceType\":\"jqabcypmivkwlzuv\",\"targetResourceId\":\"fwnfnb\",\"targetRegion\":\"fionl\",\"info\":[]},\"id\":\"etqgtzxdpnq\",\"name\":\"qqwx\",\"type\":\"jfeallnwsub\"}],\"nextLink\":\"njampm\"}") + .toObject(EventImpactedResourceListResult.class); + Assertions.assertEquals("njampm", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EventImpactedResourceListResult model = + new EventImpactedResourceListResult() + .withValue(Arrays.asList(new EventImpactedResourceInner().withInfo(Arrays.asList()))) + .withNextLink("njampm"); + model = BinaryData.fromObject(model).toObject(EventImpactedResourceListResult.class); + Assertions.assertEquals("njampm", model.nextLink()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventPropertiesAdditionalInformationTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventPropertiesAdditionalInformationTests.java new file mode 100644 index 000000000000..4ee6884a867d --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventPropertiesAdditionalInformationTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesAdditionalInformation; +import org.junit.jupiter.api.Assertions; + +public final class EventPropertiesAdditionalInformationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EventPropertiesAdditionalInformation model = + BinaryData + .fromString("{\"message\":\"juahaquhcdhmdual\"}") + .toObject(EventPropertiesAdditionalInformation.class); + Assertions.assertEquals("juahaquhcdhmdual", model.message()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EventPropertiesAdditionalInformation model = + new EventPropertiesAdditionalInformation().withMessage("juahaquhcdhmdual"); + model = BinaryData.fromObject(model).toObject(EventPropertiesAdditionalInformation.class); + Assertions.assertEquals("juahaquhcdhmdual", model.message()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventPropertiesArticleTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventPropertiesArticleTests.java new file mode 100644 index 000000000000..c85d06761eb7 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventPropertiesArticleTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesArticle; +import org.junit.jupiter.api.Assertions; + +public final class EventPropertiesArticleTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EventPropertiesArticle model = + BinaryData + .fromString( + "{\"articleContent\":\"sucocmnyyazttbtw\",\"articleId\":\"qpuedckzywbiex\",\"parameters\":\"dataeyueaxibxujwb\"}") + .toObject(EventPropertiesArticle.class); + Assertions.assertEquals("sucocmnyyazttbtw", model.articleContent()); + Assertions.assertEquals("qpuedckzywbiex", model.articleId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EventPropertiesArticle model = + new EventPropertiesArticle() + .withArticleContent("sucocmnyyazttbtw") + .withArticleId("qpuedckzywbiex") + .withParameters("dataeyueaxibxujwb"); + model = BinaryData.fromObject(model).toObject(EventPropertiesArticle.class); + Assertions.assertEquals("sucocmnyyazttbtw", model.articleContent()); + Assertions.assertEquals("qpuedckzywbiex", model.articleId()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventPropertiesRecommendedActionsItemTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventPropertiesRecommendedActionsItemTests.java new file mode 100644 index 000000000000..7ee458bc64cb --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventPropertiesRecommendedActionsItemTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.EventPropertiesRecommendedActionsItem; +import org.junit.jupiter.api.Assertions; + +public final class EventPropertiesRecommendedActionsItemTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EventPropertiesRecommendedActionsItem model = + BinaryData + .fromString("{\"groupId\":2008133985,\"actionText\":\"v\"}") + .toObject(EventPropertiesRecommendedActionsItem.class); + Assertions.assertEquals(2008133985, model.groupId()); + Assertions.assertEquals("v", model.actionText()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EventPropertiesRecommendedActionsItem model = + new EventPropertiesRecommendedActionsItem().withGroupId(2008133985).withActionText("v"); + model = BinaryData.fromObject(model).toObject(EventPropertiesRecommendedActionsItem.class); + Assertions.assertEquals(2008133985, model.groupId()); + Assertions.assertEquals("v", model.actionText()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventsTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventsTests.java new file mode 100644 index 000000000000..31110620f604 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/EventsTests.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.fluent.models.EventInner; +import com.azure.resourcemanager.resourcehealth.models.EventLevelValues; +import com.azure.resourcemanager.resourcehealth.models.EventSourceValues; +import com.azure.resourcemanager.resourcehealth.models.EventStatusValues; +import com.azure.resourcemanager.resourcehealth.models.EventTypeValues; +import com.azure.resourcemanager.resourcehealth.models.Events; +import com.azure.resourcemanager.resourcehealth.models.LevelValues; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EventsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Events model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"eventType\":\"ServiceIssue\",\"eventSource\":\"ResourceHealth\",\"status\":\"Active\",\"title\":\"otwmcyn\",\"summary\":\"lbjnpgacftadehx\",\"header\":\"tyfsoppusuesn\",\"level\":\"Critical\",\"eventLevel\":\"Warning\",\"externalIncidentId\":\"avo\",\"reason\":\"zdmohctbqvu\",\"links\":[],\"impactStartTime\":\"2021-10-27T15:38:07Z\",\"impactMitigationTime\":\"2021-10-24T14:50:51Z\",\"impact\":[],\"faqs\":[],\"isHIR\":true,\"enableMicrosoftSupport\":true,\"description\":\"gwdkcglhsl\",\"platformInitiated\":true,\"enableChatWithUs\":true,\"priority\":2006960320,\"lastUpdateTime\":\"2021-08-29T22:22:31Z\",\"hirStage\":\"ixhbkuofqweykhm\",\"duration\":1631259925,\"impactType\":\"yexfwh\"},\"id\":\"cibvyvdcsitynn\",\"name\":\"amdecte\",\"type\":\"f\"},{\"properties\":{\"eventType\":\"EmergingIssues\",\"eventSource\":\"ServiceHealth\",\"status\":\"Active\",\"title\":\"hezrkgq\",\"summary\":\"jrefovgmkqsle\",\"header\":\"vxyqjpkcattpngjc\",\"level\":\"Warning\",\"eventLevel\":\"Warning\",\"externalIncidentId\":\"pjhvmdajvnys\",\"reason\":\"nqecanoaeup\",\"links\":[],\"impactStartTime\":\"2021-02-13T21:17:53Z\",\"impactMitigationTime\":\"2021-06-23T07:18:27Z\",\"impact\":[],\"faqs\":[],\"isHIR\":true,\"enableMicrosoftSupport\":false,\"description\":\"atuokthfuiu\",\"platformInitiated\":true,\"enableChatWithUs\":false,\"priority\":397485144,\"lastUpdateTime\":\"2021-06-22T02:08:06Z\",\"hirStage\":\"odpuozmyzydag\",\"duration\":1113167460,\"impactType\":\"ezyiuokktwhrdxw\"},\"id\":\"wqsmbsur\",\"name\":\"xim\",\"type\":\"ryocfsfksymdd\"},{\"properties\":{\"eventType\":\"SecurityAdvisory\",\"eventSource\":\"ServiceHealth\",\"status\":\"Resolved\",\"title\":\"qyud\",\"summary\":\"rrqnbpoczvyifqrv\",\"header\":\"vjsllrmvvdfw\",\"level\":\"Warning\",\"eventLevel\":\"Critical\",\"externalIncidentId\":\"ulexxbczwtr\",\"reason\":\"iqzbq\",\"links\":[],\"impactStartTime\":\"2021-11-22T16:46:16Z\",\"impactMitigationTime\":\"2021-03-01T06:44:22Z\",\"impact\":[],\"faqs\":[],\"isHIR\":true,\"enableMicrosoftSupport\":false,\"description\":\"lhzdobp\",\"platformInitiated\":false,\"enableChatWithUs\":false,\"priority\":206207279,\"lastUpdateTime\":\"2021-10-31T23:11:15Z\",\"hirStage\":\"hrk\",\"duration\":1990259381,\"impactType\":\"zjuqkhrsaj\"},\"id\":\"ku\",\"name\":\"foskghsauuimj\",\"type\":\"vxieduugidyj\"}],\"nextLink\":\"f\"}") + .toObject(Events.class); + Assertions.assertEquals(EventTypeValues.SERVICE_ISSUE, model.value().get(0).eventType()); + Assertions.assertEquals(EventSourceValues.RESOURCE_HEALTH, model.value().get(0).eventSource()); + Assertions.assertEquals(EventStatusValues.ACTIVE, model.value().get(0).status()); + Assertions.assertEquals("otwmcyn", model.value().get(0).title()); + Assertions.assertEquals("lbjnpgacftadehx", model.value().get(0).summary()); + Assertions.assertEquals("tyfsoppusuesn", model.value().get(0).headerProperty()); + Assertions.assertEquals(LevelValues.CRITICAL, model.value().get(0).level()); + Assertions.assertEquals(EventLevelValues.WARNING, model.value().get(0).eventLevel()); + Assertions.assertEquals("avo", model.value().get(0).externalIncidentId()); + Assertions.assertEquals("zdmohctbqvu", model.value().get(0).reason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-27T15:38:07Z"), model.value().get(0).impactStartTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-10-24T14:50:51Z"), model.value().get(0).impactMitigationTime()); + Assertions.assertEquals(true, model.value().get(0).isHir()); + Assertions.assertEquals(true, model.value().get(0).enableMicrosoftSupport()); + Assertions.assertEquals("gwdkcglhsl", model.value().get(0).description()); + Assertions.assertEquals(true, model.value().get(0).platformInitiated()); + Assertions.assertEquals(true, model.value().get(0).enableChatWithUs()); + Assertions.assertEquals(2006960320, model.value().get(0).priority()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-29T22:22:31Z"), model.value().get(0).lastUpdateTime()); + Assertions.assertEquals("ixhbkuofqweykhm", model.value().get(0).hirStage()); + Assertions.assertEquals(1631259925, model.value().get(0).duration()); + Assertions.assertEquals("yexfwh", model.value().get(0).impactType()); + Assertions.assertEquals("f", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Events model = + new Events() + .withValue( + Arrays + .asList( + new EventInner() + .withEventType(EventTypeValues.SERVICE_ISSUE) + .withEventSource(EventSourceValues.RESOURCE_HEALTH) + .withStatus(EventStatusValues.ACTIVE) + .withTitle("otwmcyn") + .withSummary("lbjnpgacftadehx") + .withHeaderProperty("tyfsoppusuesn") + .withLevel(LevelValues.CRITICAL) + .withEventLevel(EventLevelValues.WARNING) + .withExternalIncidentId("avo") + .withReason("zdmohctbqvu") + .withLinks(Arrays.asList()) + .withImpactStartTime(OffsetDateTime.parse("2021-10-27T15:38:07Z")) + .withImpactMitigationTime(OffsetDateTime.parse("2021-10-24T14:50:51Z")) + .withImpact(Arrays.asList()) + .withFaqs(Arrays.asList()) + .withIsHir(true) + .withEnableMicrosoftSupport(true) + .withDescription("gwdkcglhsl") + .withPlatformInitiated(true) + .withEnableChatWithUs(true) + .withPriority(2006960320) + .withLastUpdateTime(OffsetDateTime.parse("2021-08-29T22:22:31Z")) + .withHirStage("ixhbkuofqweykhm") + .withDuration(1631259925) + .withImpactType("yexfwh"), + new EventInner() + .withEventType(EventTypeValues.EMERGING_ISSUES) + .withEventSource(EventSourceValues.SERVICE_HEALTH) + .withStatus(EventStatusValues.ACTIVE) + .withTitle("hezrkgq") + .withSummary("jrefovgmkqsle") + .withHeaderProperty("vxyqjpkcattpngjc") + .withLevel(LevelValues.WARNING) + .withEventLevel(EventLevelValues.WARNING) + .withExternalIncidentId("pjhvmdajvnys") + .withReason("nqecanoaeup") + .withLinks(Arrays.asList()) + .withImpactStartTime(OffsetDateTime.parse("2021-02-13T21:17:53Z")) + .withImpactMitigationTime(OffsetDateTime.parse("2021-06-23T07:18:27Z")) + .withImpact(Arrays.asList()) + .withFaqs(Arrays.asList()) + .withIsHir(true) + .withEnableMicrosoftSupport(false) + .withDescription("atuokthfuiu") + .withPlatformInitiated(true) + .withEnableChatWithUs(false) + .withPriority(397485144) + .withLastUpdateTime(OffsetDateTime.parse("2021-06-22T02:08:06Z")) + .withHirStage("odpuozmyzydag") + .withDuration(1113167460) + .withImpactType("ezyiuokktwhrdxw"), + new EventInner() + .withEventType(EventTypeValues.SECURITY_ADVISORY) + .withEventSource(EventSourceValues.SERVICE_HEALTH) + .withStatus(EventStatusValues.RESOLVED) + .withTitle("qyud") + .withSummary("rrqnbpoczvyifqrv") + .withHeaderProperty("vjsllrmvvdfw") + .withLevel(LevelValues.WARNING) + .withEventLevel(EventLevelValues.CRITICAL) + .withExternalIncidentId("ulexxbczwtr") + .withReason("iqzbq") + .withLinks(Arrays.asList()) + .withImpactStartTime(OffsetDateTime.parse("2021-11-22T16:46:16Z")) + .withImpactMitigationTime(OffsetDateTime.parse("2021-03-01T06:44:22Z")) + .withImpact(Arrays.asList()) + .withFaqs(Arrays.asList()) + .withIsHir(true) + .withEnableMicrosoftSupport(false) + .withDescription("lhzdobp") + .withPlatformInitiated(false) + .withEnableChatWithUs(false) + .withPriority(206207279) + .withLastUpdateTime(OffsetDateTime.parse("2021-10-31T23:11:15Z")) + .withHirStage("hrk") + .withDuration(1990259381) + .withImpactType("zjuqkhrsaj"))) + .withNextLink("f"); + model = BinaryData.fromObject(model).toObject(Events.class); + Assertions.assertEquals(EventTypeValues.SERVICE_ISSUE, model.value().get(0).eventType()); + Assertions.assertEquals(EventSourceValues.RESOURCE_HEALTH, model.value().get(0).eventSource()); + Assertions.assertEquals(EventStatusValues.ACTIVE, model.value().get(0).status()); + Assertions.assertEquals("otwmcyn", model.value().get(0).title()); + Assertions.assertEquals("lbjnpgacftadehx", model.value().get(0).summary()); + Assertions.assertEquals("tyfsoppusuesn", model.value().get(0).headerProperty()); + Assertions.assertEquals(LevelValues.CRITICAL, model.value().get(0).level()); + Assertions.assertEquals(EventLevelValues.WARNING, model.value().get(0).eventLevel()); + Assertions.assertEquals("avo", model.value().get(0).externalIncidentId()); + Assertions.assertEquals("zdmohctbqvu", model.value().get(0).reason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-27T15:38:07Z"), model.value().get(0).impactStartTime()); + Assertions + .assertEquals(OffsetDateTime.parse("2021-10-24T14:50:51Z"), model.value().get(0).impactMitigationTime()); + Assertions.assertEquals(true, model.value().get(0).isHir()); + Assertions.assertEquals(true, model.value().get(0).enableMicrosoftSupport()); + Assertions.assertEquals("gwdkcglhsl", model.value().get(0).description()); + Assertions.assertEquals(true, model.value().get(0).platformInitiated()); + Assertions.assertEquals(true, model.value().get(0).enableChatWithUs()); + Assertions.assertEquals(2006960320, model.value().get(0).priority()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-29T22:22:31Z"), model.value().get(0).lastUpdateTime()); + Assertions.assertEquals("ixhbkuofqweykhm", model.value().get(0).hirStage()); + Assertions.assertEquals(1631259925, model.value().get(0).duration()); + Assertions.assertEquals("yexfwh", model.value().get(0).impactType()); + Assertions.assertEquals("f", model.nextLink()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactTests.java new file mode 100644 index 000000000000..91d243686127 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.EventStatusValues; +import com.azure.resourcemanager.resourcehealth.models.Impact; +import com.azure.resourcemanager.resourcehealth.models.ImpactedServiceRegion; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ImpactTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Impact model = + BinaryData + .fromString( + "{\"impactedService\":\"klbb\",\"impactedRegions\":[{\"impactedRegion\":\"wzbhvgyugu\",\"status\":\"Resolved\",\"impactedSubscriptions\":[\"fssxqukkfplg\",\"gsxnkjzkdeslpv\",\"opwi\"],\"impactedTenants\":[\"hxpkd\",\"zb\"],\"lastUpdateTime\":\"2021-04-02T11:03:50Z\",\"updates\":[]},{\"impactedRegion\":\"a\",\"status\":\"Resolved\",\"impactedSubscriptions\":[\"upedeojnabckhs\",\"txp\",\"ie\"],\"impactedTenants\":[\"hvpesapskrdqm\",\"jjdhtld\",\"kyzxuutk\"],\"lastUpdateTime\":\"2021-06-12T03:44:06Z\",\"updates\":[]},{\"impactedRegion\":\"svlxotogtwrup\",\"status\":\"Resolved\",\"impactedSubscriptions\":[\"micykvceoveilo\"],\"impactedTenants\":[\"tyfjfcnjbkcnxdhb\"],\"lastUpdateTime\":\"2021-07-22T04:13:03Z\",\"updates\":[]}]}") + .toObject(Impact.class); + Assertions.assertEquals("klbb", model.impactedService()); + Assertions.assertEquals("wzbhvgyugu", model.impactedRegions().get(0).impactedRegion()); + Assertions.assertEquals(EventStatusValues.RESOLVED, model.impactedRegions().get(0).status()); + Assertions.assertEquals("fssxqukkfplg", model.impactedRegions().get(0).impactedSubscriptions().get(0)); + Assertions.assertEquals("hxpkd", model.impactedRegions().get(0).impactedTenants().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-02T11:03:50Z"), model.impactedRegions().get(0).lastUpdateTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Impact model = + new Impact() + .withImpactedService("klbb") + .withImpactedRegions( + Arrays + .asList( + new ImpactedServiceRegion() + .withImpactedRegion("wzbhvgyugu") + .withStatus(EventStatusValues.RESOLVED) + .withImpactedSubscriptions(Arrays.asList("fssxqukkfplg", "gsxnkjzkdeslpv", "opwi")) + .withImpactedTenants(Arrays.asList("hxpkd", "zb")) + .withLastUpdateTime(OffsetDateTime.parse("2021-04-02T11:03:50Z")) + .withUpdates(Arrays.asList()), + new ImpactedServiceRegion() + .withImpactedRegion("a") + .withStatus(EventStatusValues.RESOLVED) + .withImpactedSubscriptions(Arrays.asList("upedeojnabckhs", "txp", "ie")) + .withImpactedTenants(Arrays.asList("hvpesapskrdqm", "jjdhtld", "kyzxuutk")) + .withLastUpdateTime(OffsetDateTime.parse("2021-06-12T03:44:06Z")) + .withUpdates(Arrays.asList()), + new ImpactedServiceRegion() + .withImpactedRegion("svlxotogtwrup") + .withStatus(EventStatusValues.RESOLVED) + .withImpactedSubscriptions(Arrays.asList("micykvceoveilo")) + .withImpactedTenants(Arrays.asList("tyfjfcnjbkcnxdhb")) + .withLastUpdateTime(OffsetDateTime.parse("2021-07-22T04:13:03Z")) + .withUpdates(Arrays.asList()))); + model = BinaryData.fromObject(model).toObject(Impact.class); + Assertions.assertEquals("klbb", model.impactedService()); + Assertions.assertEquals("wzbhvgyugu", model.impactedRegions().get(0).impactedRegion()); + Assertions.assertEquals(EventStatusValues.RESOLVED, model.impactedRegions().get(0).status()); + Assertions.assertEquals("fssxqukkfplg", model.impactedRegions().get(0).impactedSubscriptions().get(0)); + Assertions.assertEquals("hxpkd", model.impactedRegions().get(0).impactedTenants().get(0)); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-04-02T11:03:50Z"), model.impactedRegions().get(0).lastUpdateTime()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedRegionTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedRegionTests.java new file mode 100644 index 000000000000..3b35d503a242 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedRegionTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.ImpactedRegion; +import org.junit.jupiter.api.Assertions; + +public final class ImpactedRegionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ImpactedRegion model = + BinaryData.fromString("{\"id\":\"ftpvjzbexil\",\"name\":\"nfqqnvwp\"}").toObject(ImpactedRegion.class); + Assertions.assertEquals("ftpvjzbexil", model.id()); + Assertions.assertEquals("nfqqnvwp", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ImpactedRegion model = new ImpactedRegion().withId("ftpvjzbexil").withName("nfqqnvwp"); + model = BinaryData.fromObject(model).toObject(ImpactedRegion.class); + Assertions.assertEquals("ftpvjzbexil", model.id()); + Assertions.assertEquals("nfqqnvwp", model.name()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetByTenantIdWithResponseMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetByTenantIdWithResponseMockTests.java new file mode 100644 index 000000000000..220b5a2975a0 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetByTenantIdWithResponseMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ImpactedResourcesGetByTenantIdWithResponseMockTests { + @Test + public void testGetByTenantIdWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"targetResourceType\":\"jhwuaanozjos\",\"targetResourceId\":\"youlp\",\"targetRegion\":\"v\",\"info\":[]},\"id\":\"rvimjwosytxitcsk\",\"name\":\"cktqumiekkezzi\",\"type\":\"hlyfjhdgqgg\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + EventImpactedResource response = + manager + .impactedResources() + .getByTenantIdWithResponse("elpcirelsfeaenwa", "fatkld", com.azure.core.util.Context.NONE) + .getValue(); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetWithResponseMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetWithResponseMockTests.java new file mode 100644 index 000000000000..55d07a1a6be7 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesGetWithResponseMockTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ImpactedResourcesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"targetResourceType\":\"lwuip\",\"targetResourceId\":\"cjzkzivgvvcna\",\"targetRegion\":\"hyrnxxmu\",\"info\":[]},\"id\":\"drd\",\"name\":\"stkwqqtch\",\"type\":\"alm\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + EventImpactedResource response = + manager.impactedResources().getWithResponse("gxk", "lla", com.azure.core.util.Context.NONE).getValue(); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListBySubscriptionIdAndEventIdMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListBySubscriptionIdAndEventIdMockTests.java new file mode 100644 index 000000000000..0b4b758c24fb --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListBySubscriptionIdAndEventIdMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ImpactedResourcesListBySubscriptionIdAndEventIdMockTests { + @Test + public void testListBySubscriptionIdAndEventId() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"targetResourceType\":\"wrlkdmtn\",\"targetResourceId\":\"ok\",\"targetRegion\":\"llxdyhgs\",\"info\":[]},\"id\":\"gjltdtbnnhado\",\"name\":\"crkvcikhnv\",\"type\":\"amqgxqquezikyw\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .impactedResources() + .listBySubscriptionIdAndEventId("ynpcdpumnzgmwznm", "biknsorgjhxbld", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListByTenantIdAndEventIdMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListByTenantIdAndEventIdMockTests.java new file mode 100644 index 000000000000..3f2a7c53f0d9 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedResourcesListByTenantIdAndEventIdMockTests.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class ImpactedResourcesListByTenantIdAndEventIdMockTests { + @Test + public void testListByTenantIdAndEventId() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"targetResourceType\":\"piohgwxrtfu\",\"targetResourceId\":\"epxgyqagvr\",\"targetRegion\":\"npkukghimdblx\",\"info\":[]},\"id\":\"fnjhfjxwmszkkfo\",\"name\":\"rey\",\"type\":\"kzikfjawneaivxwc\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.impactedResources().listByTenantIdAndEventId("mtdaa", "gdv", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedServiceRegionTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedServiceRegionTests.java new file mode 100644 index 000000000000..19039ec6b9c5 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/ImpactedServiceRegionTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.EventStatusValues; +import com.azure.resourcemanager.resourcehealth.models.ImpactedServiceRegion; +import com.azure.resourcemanager.resourcehealth.models.Update; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ImpactedServiceRegionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ImpactedServiceRegion model = + BinaryData + .fromString( + "{\"impactedRegion\":\"wpn\",\"status\":\"Active\",\"impactedSubscriptions\":[\"nermcl\",\"plpho\",\"uscrpabgyepsb\",\"tazqugxywpmueefj\"],\"impactedTenants\":[\"qkqujidsu\",\"onobglaocqx\"],\"lastUpdateTime\":\"2021-08-26T18:25:08Z\",\"updates\":[{\"summary\":\"udxytlmoyrx\",\"updateDateTime\":\"2021-08-04T10:24:08Z\"}]}") + .toObject(ImpactedServiceRegion.class); + Assertions.assertEquals("wpn", model.impactedRegion()); + Assertions.assertEquals(EventStatusValues.ACTIVE, model.status()); + Assertions.assertEquals("nermcl", model.impactedSubscriptions().get(0)); + Assertions.assertEquals("qkqujidsu", model.impactedTenants().get(0)); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-26T18:25:08Z"), model.lastUpdateTime()); + Assertions.assertEquals("udxytlmoyrx", model.updates().get(0).summary()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-04T10:24:08Z"), model.updates().get(0).updateDateTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ImpactedServiceRegion model = + new ImpactedServiceRegion() + .withImpactedRegion("wpn") + .withStatus(EventStatusValues.ACTIVE) + .withImpactedSubscriptions(Arrays.asList("nermcl", "plpho", "uscrpabgyepsb", "tazqugxywpmueefj")) + .withImpactedTenants(Arrays.asList("qkqujidsu", "onobglaocqx")) + .withLastUpdateTime(OffsetDateTime.parse("2021-08-26T18:25:08Z")) + .withUpdates( + Arrays + .asList( + new Update() + .withSummary("udxytlmoyrx") + .withUpdateDateTime(OffsetDateTime.parse("2021-08-04T10:24:08Z")))); + model = BinaryData.fromObject(model).toObject(ImpactedServiceRegion.class); + Assertions.assertEquals("wpn", model.impactedRegion()); + Assertions.assertEquals(EventStatusValues.ACTIVE, model.status()); + Assertions.assertEquals("nermcl", model.impactedSubscriptions().get(0)); + Assertions.assertEquals("qkqujidsu", model.impactedTenants().get(0)); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-26T18:25:08Z"), model.lastUpdateTime()); + Assertions.assertEquals("udxytlmoyrx", model.updates().get(0).summary()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-04T10:24:08Z"), model.updates().get(0).updateDateTime()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/LinkDisplayTextTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/LinkDisplayTextTests.java new file mode 100644 index 000000000000..9cf85c996522 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/LinkDisplayTextTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.LinkDisplayText; +import org.junit.jupiter.api.Assertions; + +public final class LinkDisplayTextTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LinkDisplayText model = + BinaryData.fromString("{\"value\":\"cuh\",\"localizedValue\":\"tcty\"}").toObject(LinkDisplayText.class); + Assertions.assertEquals("cuh", model.value()); + Assertions.assertEquals("tcty", model.localizedValue()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LinkDisplayText model = new LinkDisplayText().withValue("cuh").withLocalizedValue("tcty"); + model = BinaryData.fromObject(model).toObject(LinkDisplayText.class); + Assertions.assertEquals("cuh", model.value()); + Assertions.assertEquals("tcty", model.localizedValue()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/LinkTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/LinkTests.java new file mode 100644 index 000000000000..45ea5a55a890 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/LinkTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.Link; +import com.azure.resourcemanager.resourcehealth.models.LinkDisplayText; +import com.azure.resourcemanager.resourcehealth.models.LinkTypeValues; +import org.junit.jupiter.api.Assertions; + +public final class LinkTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Link model = + BinaryData + .fromString( + "{\"type\":\"Button\",\"displayText\":{\"value\":\"muzyoxaepdk\",\"localizedValue\":\"ancuxrhd\"},\"extensionName\":\"avxbniwdjswztsdb\",\"bladeName\":\"nxytxh\",\"parameters\":\"dataxbzpfzab\"}") + .toObject(Link.class); + Assertions.assertEquals(LinkTypeValues.BUTTON, model.type()); + Assertions.assertEquals("muzyoxaepdk", model.displayText().value()); + Assertions.assertEquals("ancuxrhd", model.displayText().localizedValue()); + Assertions.assertEquals("avxbniwdjswztsdb", model.extensionName()); + Assertions.assertEquals("nxytxh", model.bladeName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Link model = + new Link() + .withType(LinkTypeValues.BUTTON) + .withDisplayText(new LinkDisplayText().withValue("muzyoxaepdk").withLocalizedValue("ancuxrhd")) + .withExtensionName("avxbniwdjswztsdb") + .withBladeName("nxytxh") + .withParameters("dataxbzpfzab"); + model = BinaryData.fromObject(model).toObject(Link.class); + Assertions.assertEquals(LinkTypeValues.BUTTON, model.type()); + Assertions.assertEquals("muzyoxaepdk", model.displayText().value()); + Assertions.assertEquals("ancuxrhd", model.displayText().localizedValue()); + Assertions.assertEquals("avxbniwdjswztsdb", model.extensionName()); + Assertions.assertEquals("nxytxh", model.bladeName()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataEntityInnerTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataEntityInnerTests.java new file mode 100644 index 000000000000..eb6bbf7636b5 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataEntityInnerTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.fluent.models.MetadataEntityInner; +import com.azure.resourcemanager.resourcehealth.models.MetadataSupportedValueDetail; +import com.azure.resourcemanager.resourcehealth.models.Scenario; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MetadataEntityInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetadataEntityInner model = + BinaryData + .fromString( + "{\"properties\":{\"displayName\":\"hjq\",\"dependsOn\":[\"yeicxmqciwqvhk\",\"ixuigdtopbobj\"],\"applicableScenarios\":[\"Alerts\"],\"supportedValues\":[{\"id\":\"a\",\"displayName\":\"uhrzayvvt\",\"resourceTypes\":[]}]},\"id\":\"dfgiot\",\"name\":\"ftutqxlngxlefgu\",\"type\":\"nxkrx\"}") + .toObject(MetadataEntityInner.class); + Assertions.assertEquals("hjq", model.displayName()); + Assertions.assertEquals("yeicxmqciwqvhk", model.dependsOn().get(0)); + Assertions.assertEquals(Scenario.ALERTS, model.applicableScenarios().get(0)); + Assertions.assertEquals("a", model.supportedValues().get(0).id()); + Assertions.assertEquals("uhrzayvvt", model.supportedValues().get(0).displayName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetadataEntityInner model = + new MetadataEntityInner() + .withDisplayName("hjq") + .withDependsOn(Arrays.asList("yeicxmqciwqvhk", "ixuigdtopbobj")) + .withApplicableScenarios(Arrays.asList(Scenario.ALERTS)) + .withSupportedValues( + Arrays + .asList( + new MetadataSupportedValueDetail() + .withId("a") + .withDisplayName("uhrzayvvt") + .withResourceTypes(Arrays.asList()))); + model = BinaryData.fromObject(model).toObject(MetadataEntityInner.class); + Assertions.assertEquals("hjq", model.displayName()); + Assertions.assertEquals("yeicxmqciwqvhk", model.dependsOn().get(0)); + Assertions.assertEquals(Scenario.ALERTS, model.applicableScenarios().get(0)); + Assertions.assertEquals("a", model.supportedValues().get(0).id()); + Assertions.assertEquals("uhrzayvvt", model.supportedValues().get(0).displayName()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataEntityListResultTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataEntityListResultTests.java new file mode 100644 index 000000000000..f2931c9c02f8 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataEntityListResultTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.fluent.models.MetadataEntityInner; +import com.azure.resourcemanager.resourcehealth.models.MetadataEntityListResult; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MetadataEntityListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetadataEntityListResult model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"displayName\":\"rlovmclwhijcoej\",\"dependsOn\":[],\"applicableScenarios\":[],\"supportedValues\":[]},\"id\":\"qsqsy\",\"name\":\"bkbfkgukdkex\",\"type\":\"ppofmxaxcfjpgdd\"},{\"properties\":{\"displayName\":\"jjxhvpmo\",\"dependsOn\":[],\"applicableScenarios\":[],\"supportedValues\":[]},\"id\":\"zxibqeoj\",\"name\":\"xqbzvddntwnd\",\"type\":\"icbtwnpzao\"}],\"nextLink\":\"uhrhcffcyddgl\"}") + .toObject(MetadataEntityListResult.class); + Assertions.assertEquals("rlovmclwhijcoej", model.value().get(0).displayName()); + Assertions.assertEquals("uhrhcffcyddgl", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetadataEntityListResult model = + new MetadataEntityListResult() + .withValue( + Arrays + .asList( + new MetadataEntityInner() + .withDisplayName("rlovmclwhijcoej") + .withDependsOn(Arrays.asList()) + .withApplicableScenarios(Arrays.asList()) + .withSupportedValues(Arrays.asList()), + new MetadataEntityInner() + .withDisplayName("jjxhvpmo") + .withDependsOn(Arrays.asList()) + .withApplicableScenarios(Arrays.asList()) + .withSupportedValues(Arrays.asList()))) + .withNextLink("uhrhcffcyddgl"); + model = BinaryData.fromObject(model).toObject(MetadataEntityListResult.class); + Assertions.assertEquals("rlovmclwhijcoej", model.value().get(0).displayName()); + Assertions.assertEquals("uhrhcffcyddgl", model.nextLink()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataEntityPropertiesTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataEntityPropertiesTests.java new file mode 100644 index 000000000000..d4a78d03cb96 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataEntityPropertiesTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.fluent.models.MetadataEntityProperties; +import com.azure.resourcemanager.resourcehealth.models.MetadataSupportedValueDetail; +import com.azure.resourcemanager.resourcehealth.models.Scenario; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MetadataEntityPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetadataEntityProperties model = + BinaryData + .fromString( + "{\"displayName\":\"mi\",\"dependsOn\":[\"hzrvqd\"],\"applicableScenarios\":[\"Alerts\"],\"supportedValues\":[{\"id\":\"igeho\",\"displayName\":\"bowsk\",\"resourceTypes\":[\"ktzlcuiywg\"]}]}") + .toObject(MetadataEntityProperties.class); + Assertions.assertEquals("mi", model.displayName()); + Assertions.assertEquals("hzrvqd", model.dependsOn().get(0)); + Assertions.assertEquals(Scenario.ALERTS, model.applicableScenarios().get(0)); + Assertions.assertEquals("igeho", model.supportedValues().get(0).id()); + Assertions.assertEquals("bowsk", model.supportedValues().get(0).displayName()); + Assertions.assertEquals("ktzlcuiywg", model.supportedValues().get(0).resourceTypes().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetadataEntityProperties model = + new MetadataEntityProperties() + .withDisplayName("mi") + .withDependsOn(Arrays.asList("hzrvqd")) + .withApplicableScenarios(Arrays.asList(Scenario.ALERTS)) + .withSupportedValues( + Arrays + .asList( + new MetadataSupportedValueDetail() + .withId("igeho") + .withDisplayName("bowsk") + .withResourceTypes(Arrays.asList("ktzlcuiywg")))); + model = BinaryData.fromObject(model).toObject(MetadataEntityProperties.class); + Assertions.assertEquals("mi", model.displayName()); + Assertions.assertEquals("hzrvqd", model.dependsOn().get(0)); + Assertions.assertEquals(Scenario.ALERTS, model.applicableScenarios().get(0)); + Assertions.assertEquals("igeho", model.supportedValues().get(0).id()); + Assertions.assertEquals("bowsk", model.supportedValues().get(0).displayName()); + Assertions.assertEquals("ktzlcuiywg", model.supportedValues().get(0).resourceTypes().get(0)); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataSupportedValueDetailTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataSupportedValueDetailTests.java new file mode 100644 index 000000000000..b33ea6159992 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadataSupportedValueDetailTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.MetadataSupportedValueDetail; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MetadataSupportedValueDetailTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetadataSupportedValueDetail model = + BinaryData + .fromString( + "{\"id\":\"wgndrvynhzgpp\",\"displayName\":\"cgyncocpecf\",\"resourceTypes\":[\"coofsxlzev\"]}") + .toObject(MetadataSupportedValueDetail.class); + Assertions.assertEquals("wgndrvynhzgpp", model.id()); + Assertions.assertEquals("cgyncocpecf", model.displayName()); + Assertions.assertEquals("coofsxlzev", model.resourceTypes().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetadataSupportedValueDetail model = + new MetadataSupportedValueDetail() + .withId("wgndrvynhzgpp") + .withDisplayName("cgyncocpecf") + .withResourceTypes(Arrays.asList("coofsxlzev")); + model = BinaryData.fromObject(model).toObject(MetadataSupportedValueDetail.class); + Assertions.assertEquals("wgndrvynhzgpp", model.id()); + Assertions.assertEquals("cgyncocpecf", model.displayName()); + Assertions.assertEquals("coofsxlzev", model.resourceTypes().get(0)); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadatasGetEntityWithResponseMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadatasGetEntityWithResponseMockTests.java new file mode 100644 index 000000000000..9810f87849ac --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadatasGetEntityWithResponseMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.MetadataEntity; +import com.azure.resourcemanager.resourcehealth.models.Scenario; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MetadatasGetEntityWithResponseMockTests { + @Test + public void testGetEntityWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"displayName\":\"swsrms\",\"dependsOn\":[\"rpzbchckqqzqi\",\"xiy\"],\"applicableScenarios\":[\"Alerts\",\"Alerts\",\"Alerts\",\"Alerts\"],\"supportedValues\":[]},\"id\":\"yatrwy\",\"name\":\"q\",\"type\":\"ibzyhwitsmyp\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + MetadataEntity response = + manager.metadatas().getEntityWithResponse("iyntorzihle", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("swsrms", response.displayName()); + Assertions.assertEquals("rpzbchckqqzqi", response.dependsOn().get(0)); + Assertions.assertEquals(Scenario.ALERTS, response.applicableScenarios().get(0)); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadatasListMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadatasListMockTests.java new file mode 100644 index 000000000000..683367c7504c --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/MetadatasListMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.MetadataEntity; +import com.azure.resourcemanager.resourcehealth.models.Scenario; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MetadatasListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"displayName\":\"nzar\",\"dependsOn\":[\"q\",\"uijfqk\",\"cewiipfpub\",\"ibwwiftohqkv\"],\"applicableScenarios\":[\"Alerts\",\"Alerts\",\"Alerts\",\"Alerts\"],\"supportedValues\":[]},\"id\":\"kn\",\"name\":\"n\",\"type\":\"synljphuopxodl\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.metadatas().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("nzar", response.iterator().next().displayName()); + Assertions.assertEquals("q", response.iterator().next().dependsOn().get(0)); + Assertions.assertEquals(Scenario.ALERTS, response.iterator().next().applicableScenarios().get(0)); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdMockTests.java new file mode 100644 index 000000000000..6c1472294f40 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class SecurityAdvisoryImpactedResourcesListBySubscriptionIdAndEventIdMockTests { + @Test + public void testListBySubscriptionIdAndEventId() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"targetResourceType\":\"su\",\"targetResourceId\":\"r\",\"targetRegion\":\"wdmjsjqbjhhyx\",\"info\":[]},\"id\":\"yc\",\"name\":\"duhpk\",\"type\":\"kgymareqnajxqug\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .securityAdvisoryImpactedResources() + .listBySubscriptionIdAndEventId("bdunygaeqid", "qfatpxllrxcyjm", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdMockTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdMockTests.java new file mode 100644 index 000000000000..18c1809fc6da --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.resourcehealth.ResourceHealthManager; +import com.azure.resourcemanager.resourcehealth.models.EventImpactedResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class SecurityAdvisoryImpactedResourcesListByTenantIdAndEventIdMockTests { + @Test + public void testListByTenantIdAndEventId() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"targetResourceType\":\"fwqmzqalkrmn\",\"targetResourceId\":\"jpxac\",\"targetRegion\":\"udfnbyxba\",\"info\":[]},\"id\":\"yvayffimrzr\",\"name\":\"uzqogsexnevf\",\"type\":\"nwnwme\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + ResourceHealthManager manager = + ResourceHealthManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .securityAdvisoryImpactedResources() + .listByTenantIdAndEventId("hky", "ubeddg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/StatusActiveEventTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/StatusActiveEventTests.java new file mode 100644 index 000000000000..43a6e87882bc --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/StatusActiveEventTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.EmergingIssueImpact; +import com.azure.resourcemanager.resourcehealth.models.SeverityValues; +import com.azure.resourcemanager.resourcehealth.models.StageValues; +import com.azure.resourcemanager.resourcehealth.models.StatusActiveEvent; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class StatusActiveEventTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StatusActiveEvent model = + BinaryData + .fromString( + "{\"title\":\"qeqxo\",\"description\":\"dahzxctobg\",\"trackingId\":\"dmoizpostmg\",\"startTime\":\"2021-03-12T03:59:06Z\",\"cloud\":\"unrmfqjhhkxb\",\"severity\":\"Information\",\"stage\":\"Resolve\",\"published\":false,\"lastModifiedTime\":\"2021-07-29T03:03:57Z\",\"impacts\":[{\"id\":\"gudivkrtswbxqz\",\"name\":\"zjf\",\"regions\":[]},{\"id\":\"fdxxivetvtcqaqtd\",\"name\":\"mcbxvwvxysl\",\"regions\":[]}]}") + .toObject(StatusActiveEvent.class); + Assertions.assertEquals("qeqxo", model.title()); + Assertions.assertEquals("dahzxctobg", model.description()); + Assertions.assertEquals("dmoizpostmg", model.trackingId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-12T03:59:06Z"), model.startTime()); + Assertions.assertEquals("unrmfqjhhkxb", model.cloud()); + Assertions.assertEquals(SeverityValues.INFORMATION, model.severity()); + Assertions.assertEquals(StageValues.RESOLVE, model.stage()); + Assertions.assertEquals(false, model.published()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-29T03:03:57Z"), model.lastModifiedTime()); + Assertions.assertEquals("gudivkrtswbxqz", model.impacts().get(0).id()); + Assertions.assertEquals("zjf", model.impacts().get(0).name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StatusActiveEvent model = + new StatusActiveEvent() + .withTitle("qeqxo") + .withDescription("dahzxctobg") + .withTrackingId("dmoizpostmg") + .withStartTime(OffsetDateTime.parse("2021-03-12T03:59:06Z")) + .withCloud("unrmfqjhhkxb") + .withSeverity(SeverityValues.INFORMATION) + .withStage(StageValues.RESOLVE) + .withPublished(false) + .withLastModifiedTime(OffsetDateTime.parse("2021-07-29T03:03:57Z")) + .withImpacts( + Arrays + .asList( + new EmergingIssueImpact() + .withId("gudivkrtswbxqz") + .withName("zjf") + .withRegions(Arrays.asList()), + new EmergingIssueImpact() + .withId("fdxxivetvtcqaqtd") + .withName("mcbxvwvxysl") + .withRegions(Arrays.asList()))); + model = BinaryData.fromObject(model).toObject(StatusActiveEvent.class); + Assertions.assertEquals("qeqxo", model.title()); + Assertions.assertEquals("dahzxctobg", model.description()); + Assertions.assertEquals("dmoizpostmg", model.trackingId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-12T03:59:06Z"), model.startTime()); + Assertions.assertEquals("unrmfqjhhkxb", model.cloud()); + Assertions.assertEquals(SeverityValues.INFORMATION, model.severity()); + Assertions.assertEquals(StageValues.RESOLVE, model.stage()); + Assertions.assertEquals(false, model.published()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-29T03:03:57Z"), model.lastModifiedTime()); + Assertions.assertEquals("gudivkrtswbxqz", model.impacts().get(0).id()); + Assertions.assertEquals("zjf", model.impacts().get(0).name()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/StatusBannerTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/StatusBannerTests.java new file mode 100644 index 000000000000..338a03ac0971 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/StatusBannerTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.StatusBanner; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class StatusBannerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StatusBanner model = + BinaryData + .fromString( + "{\"title\":\"wptfdy\",\"message\":\"fqbuaceopzf\",\"cloud\":\"hhuao\",\"lastModifiedTime\":\"2021-03-20T16:48:49Z\"}") + .toObject(StatusBanner.class); + Assertions.assertEquals("wptfdy", model.title()); + Assertions.assertEquals("fqbuaceopzf", model.message()); + Assertions.assertEquals("hhuao", model.cloud()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-20T16:48:49Z"), model.lastModifiedTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StatusBanner model = + new StatusBanner() + .withTitle("wptfdy") + .withMessage("fqbuaceopzf") + .withCloud("hhuao") + .withLastModifiedTime(OffsetDateTime.parse("2021-03-20T16:48:49Z")); + model = BinaryData.fromObject(model).toObject(StatusBanner.class); + Assertions.assertEquals("wptfdy", model.title()); + Assertions.assertEquals("fqbuaceopzf", model.message()); + Assertions.assertEquals("hhuao", model.cloud()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-20T16:48:49Z"), model.lastModifiedTime()); + } +} diff --git a/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/UpdateTests.java b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/UpdateTests.java new file mode 100644 index 000000000000..d3788f73b3c3 --- /dev/null +++ b/sdk/resourcehealth/azure-resourcemanager-resourcehealth/src/test/java/com/azure/resourcemanager/resourcehealth/generated/UpdateTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourcehealth.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.resourcehealth.models.Update; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class UpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Update model = + BinaryData + .fromString("{\"summary\":\"dw\",\"updateDateTime\":\"2021-08-04T11:26:15Z\"}") + .toObject(Update.class); + Assertions.assertEquals("dw", model.summary()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-04T11:26:15Z"), model.updateDateTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Update model = new Update().withSummary("dw").withUpdateDateTime(OffsetDateTime.parse("2021-08-04T11:26:15Z")); + model = BinaryData.fromObject(model).toObject(Update.class); + Assertions.assertEquals("dw", model.summary()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-04T11:26:15Z"), model.updateDateTime()); + } +} diff --git a/sdk/resourcemanager/azure-resourcemanager-containerregistry/src/test/resources/session-records/RegistryTaskTests.testRegistryNetworkRules.json b/sdk/resourcemanager/azure-resourcemanager-containerregistry/src/test/resources/session-records/RegistryTaskTests.testRegistryNetworkRules.json new file mode 100644 index 000000000000..2745ecc663c4 --- /dev/null +++ b/sdk/resourcemanager/azure-resourcemanager-containerregistry/src/test/resources/session-records/RegistryTaskTests.testRegistryNetworkRules.json @@ -0,0 +1,333 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgacr43871?api-version=2022-09-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources/2.27.0-beta.1 (17.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "cb24a0ff-ec96-4ff1-8fad-24839f4b0a83", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1199", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 25 May 2023 03:14:15 GMT", + "x-ms-correlation-request-id" : "57f04a03-981a-4ca9-a5db-56c6e41a85c4", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20230525T031416Z:57f04a03-981a-4ca9-a5db-56c6e41a85c4", + "Expires" : "-1", + "Content-Length" : "217", + "x-ms-request-id" : "57f04a03-981a-4ca9-a5db-56c6e41a85c4", + "Body" : "{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871\",\"name\":\"rgacr43871\",\"type\":\"Microsoft.Resources/resourceGroups\",\"location\":\"eastus\",\"properties\":{\"provisioningState\":\"Succeeded\"}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr838718?api-version=2022-12-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerregistry/2.27.0-beta.1 (17.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "1cdb6438-529e-49a9-bff4-6a81b3cdf68e", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "api-supported-versions" : "2022-12-01", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1198", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 May 2023 03:14:24 GMT", + "x-ms-correlation-request-id" : "f9af90fa-ded3-4b84-84a6-4e520e7374bd", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20230525T031425Z:f9af90fa-ded3-4b84-84a6-4e520e7374bd", + "Expires" : "-1", + "Content-Length" : "1449", + "x-ms-request-id" : "f9af90fa-ded3-4b84-84a6-4e520e7374bd", + "Body" : "{\"sku\":{\"name\":\"Premium\",\"tier\":\"Premium\"},\"type\":\"Microsoft.ContainerRegistry/registries\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr838718\",\"name\":\"acr838718\",\"location\":\"eastus\",\"tags\":{},\"systemData\":{\"createdBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"createdByType\":\"Application\",\"createdAt\":\"2023-05-25T03:14:20.3106207+00:00\",\"lastModifiedBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-05-25T03:14:20.3106207+00:00\"},\"properties\":{\"loginServer\":\"acr838718.azurecr.io\",\"creationDate\":\"2023-05-25T03:14:20.3106207Z\",\"provisioningState\":\"Succeeded\",\"adminUserEnabled\":false,\"networkRuleSet\":{\"defaultAction\":\"Allow\",\"ipRules\":[]},\"policies\":{\"quarantinePolicy\":{\"status\":\"disabled\"},\"trustPolicy\":{\"type\":\"Notary\",\"status\":\"disabled\"},\"retentionPolicy\":{\"days\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:23.040433+00:00\",\"status\":\"disabled\"},\"exportPolicy\":{\"status\":\"enabled\"},\"azureADAuthenticationAsArmPolicy\":{\"status\":\"enabled\"},\"softDeletePolicy\":{\"retentionDays\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:23.040433+00:00\",\"status\":\"disabled\"}},\"encryption\":{\"status\":\"disabled\"},\"dataEndpointEnabled\":false,\"dataEndpointHostNames\":[],\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Enabled\",\"networkRuleBypassOptions\":\"AzureServices\",\"zoneRedundancy\":\"Disabled\",\"anonymousPullEnabled\":false}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr838718?api-version=2022-12-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerregistry/2.27.0-beta.1 (17.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "fdcfbb2f-d71d-4920-883d-3052b5f585b4", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "api-supported-versions" : "2022-12-01", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1197", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 May 2023 03:14:27 GMT", + "x-ms-correlation-request-id" : "01f1b6c4-c1fe-4a9a-87be-6411e72c8b39", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20230525T031428Z:01f1b6c4-c1fe-4a9a-87be-6411e72c8b39", + "Expires" : "-1", + "Content-Length" : "1449", + "x-ms-request-id" : "01f1b6c4-c1fe-4a9a-87be-6411e72c8b39", + "Body" : "{\"sku\":{\"name\":\"Premium\",\"tier\":\"Premium\"},\"type\":\"Microsoft.ContainerRegistry/registries\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr838718\",\"name\":\"acr838718\",\"location\":\"eastus\",\"tags\":{},\"systemData\":{\"createdBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"createdByType\":\"Application\",\"createdAt\":\"2023-05-25T03:14:20.3106207+00:00\",\"lastModifiedBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-05-25T03:14:26.404667+00:00\"},\"properties\":{\"loginServer\":\"acr838718.azurecr.io\",\"creationDate\":\"2023-05-25T03:14:20.3106207Z\",\"provisioningState\":\"Succeeded\",\"adminUserEnabled\":false,\"networkRuleSet\":{\"defaultAction\":\"Allow\",\"ipRules\":[]},\"policies\":{\"quarantinePolicy\":{\"status\":\"disabled\"},\"trustPolicy\":{\"type\":\"Notary\",\"status\":\"disabled\"},\"retentionPolicy\":{\"days\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:23.040433+00:00\",\"status\":\"disabled\"},\"exportPolicy\":{\"status\":\"enabled\"},\"azureADAuthenticationAsArmPolicy\":{\"status\":\"enabled\"},\"softDeletePolicy\":{\"retentionDays\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:23.040433+00:00\",\"status\":\"disabled\"}},\"encryption\":{\"status\":\"disabled\"},\"dataEndpointEnabled\":false,\"dataEndpointHostNames\":[],\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Disabled\",\"networkRuleBypassOptions\":\"AzureServices\",\"zoneRedundancy\":\"Disabled\",\"anonymousPullEnabled\":false}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgacr43871?api-version=2022-09-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources/2.27.0-beta.1 (17.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "d80ac938-7932-449c-98d5-c065dd91b9a2", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1196", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 May 2023 03:14:29 GMT", + "x-ms-correlation-request-id" : "a4d25a1d-de50-4662-bf06-79006f06ea38", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20230525T031430Z:a4d25a1d-de50-4662-bf06-79006f06ea38", + "Expires" : "-1", + "Content-Length" : "217", + "x-ms-request-id" : "a4d25a1d-de50-4662-bf06-79006f06ea38", + "Body" : "{\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871\",\"name\":\"rgacr43871\",\"type\":\"Microsoft.Resources/resourceGroups\",\"location\":\"eastus\",\"properties\":{\"provisioningState\":\"Succeeded\"}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907?api-version=2022-12-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerregistry/2.27.0-beta.1 (17.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "825baac0-1863-4ae1-957c-cc5d230b49a4", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "api-supported-versions" : "2022-12-01", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1195", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 May 2023 03:14:41 GMT", + "x-ms-correlation-request-id" : "19790de7-06ef-4e29-bd66-3e7fd62f205e", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20230525T031441Z:19790de7-06ef-4e29-bd66-3e7fd62f205e", + "Expires" : "-1", + "Content-Length" : "1523", + "x-ms-request-id" : "19790de7-06ef-4e29-bd66-3e7fd62f205e", + "Body" : "{\"sku\":{\"name\":\"Premium\",\"tier\":\"Premium\"},\"type\":\"Microsoft.ContainerRegistry/registries\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907\",\"name\":\"acr061907\",\"location\":\"eastus\",\"tags\":{},\"systemData\":{\"createdBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"createdByType\":\"Application\",\"createdAt\":\"2023-05-25T03:14:32.7799477+00:00\",\"lastModifiedBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-05-25T03:14:32.7799477+00:00\"},\"properties\":{\"loginServer\":\"acr061907.azurecr.io\",\"creationDate\":\"2023-05-25T03:14:32.7799477Z\",\"provisioningState\":\"Succeeded\",\"adminUserEnabled\":false,\"networkRuleSet\":{\"defaultAction\":\"Deny\",\"ipRules\":[{\"action\":\"Allow\",\"value\":\"3.80.0.0/12\"}]},\"policies\":{\"quarantinePolicy\":{\"status\":\"disabled\"},\"trustPolicy\":{\"type\":\"Notary\",\"status\":\"disabled\"},\"retentionPolicy\":{\"days\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"},\"exportPolicy\":{\"status\":\"enabled\"},\"azureADAuthenticationAsArmPolicy\":{\"status\":\"enabled\"},\"softDeletePolicy\":{\"retentionDays\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"}},\"encryption\":{\"status\":\"disabled\"},\"dataEndpointEnabled\":true,\"dataEndpointHostNames\":[\"acr061907.eastus.data.azurecr.io\"],\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Enabled\",\"networkRuleBypassOptions\":\"AzureServices\",\"zoneRedundancy\":\"Disabled\",\"anonymousPullEnabled\":false}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907?api-version=2022-12-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerregistry/2.27.0-beta.1 (17.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "efe5fad3-2dfc-41b1-8f61-e6077e2a691a", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "api-supported-versions" : "2022-12-01", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1194", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 May 2023 03:14:43 GMT", + "x-ms-correlation-request-id" : "3bed7e0b-8da6-4890-aa74-827016ff6f5d", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20230525T031444Z:3bed7e0b-8da6-4890-aa74-827016ff6f5d", + "Expires" : "-1", + "Content-Length" : "1561", + "x-ms-request-id" : "3bed7e0b-8da6-4890-aa74-827016ff6f5d", + "Body" : "{\"sku\":{\"name\":\"Premium\",\"tier\":\"Premium\"},\"type\":\"Microsoft.ContainerRegistry/registries\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907\",\"name\":\"acr061907\",\"location\":\"eastus\",\"tags\":{},\"systemData\":{\"createdBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"createdByType\":\"Application\",\"createdAt\":\"2023-05-25T03:14:32.7799477+00:00\",\"lastModifiedBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-05-25T03:14:42.5772753+00:00\"},\"properties\":{\"loginServer\":\"acr061907.azurecr.io\",\"creationDate\":\"2023-05-25T03:14:32.7799477Z\",\"provisioningState\":\"Succeeded\",\"adminUserEnabled\":false,\"networkRuleSet\":{\"defaultAction\":\"Deny\",\"ipRules\":[{\"action\":\"Allow\",\"value\":\"3.80.0.0/12\"},{\"action\":\"Allow\",\"value\":\"3.80.0.1\"}]},\"policies\":{\"quarantinePolicy\":{\"status\":\"disabled\"},\"trustPolicy\":{\"type\":\"Notary\",\"status\":\"disabled\"},\"retentionPolicy\":{\"days\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"},\"exportPolicy\":{\"status\":\"enabled\"},\"azureADAuthenticationAsArmPolicy\":{\"status\":\"enabled\"},\"softDeletePolicy\":{\"retentionDays\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"}},\"encryption\":{\"status\":\"disabled\"},\"dataEndpointEnabled\":true,\"dataEndpointHostNames\":[\"acr061907.eastus.data.azurecr.io\"],\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Enabled\",\"networkRuleBypassOptions\":\"AzureServices\",\"zoneRedundancy\":\"Disabled\",\"anonymousPullEnabled\":false}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907?api-version=2022-12-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerregistry/2.27.0-beta.1 (17.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "749a587d-b85b-40e3-8022-48986a56e786", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "api-supported-versions" : "2022-12-01", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1193", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 May 2023 03:14:46 GMT", + "x-ms-correlation-request-id" : "76e303d6-d3cb-43c2-919f-07c201c9ddf4", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20230525T031446Z:76e303d6-d3cb-43c2-919f-07c201c9ddf4", + "Expires" : "-1", + "Content-Length" : "1523", + "x-ms-request-id" : "76e303d6-d3cb-43c2-919f-07c201c9ddf4", + "Body" : "{\"sku\":{\"name\":\"Premium\",\"tier\":\"Premium\"},\"type\":\"Microsoft.ContainerRegistry/registries\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907\",\"name\":\"acr061907\",\"location\":\"eastus\",\"tags\":{},\"systemData\":{\"createdBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"createdByType\":\"Application\",\"createdAt\":\"2023-05-25T03:14:32.7799477+00:00\",\"lastModifiedBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-05-25T03:14:44.9680159+00:00\"},\"properties\":{\"loginServer\":\"acr061907.azurecr.io\",\"creationDate\":\"2023-05-25T03:14:32.7799477Z\",\"provisioningState\":\"Succeeded\",\"adminUserEnabled\":false,\"networkRuleSet\":{\"defaultAction\":\"Deny\",\"ipRules\":[{\"action\":\"Allow\",\"value\":\"3.80.0.0/12\"}]},\"policies\":{\"quarantinePolicy\":{\"status\":\"disabled\"},\"trustPolicy\":{\"type\":\"Notary\",\"status\":\"disabled\"},\"retentionPolicy\":{\"days\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"},\"exportPolicy\":{\"status\":\"enabled\"},\"azureADAuthenticationAsArmPolicy\":{\"status\":\"enabled\"},\"softDeletePolicy\":{\"retentionDays\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"}},\"encryption\":{\"status\":\"disabled\"},\"dataEndpointEnabled\":true,\"dataEndpointHostNames\":[\"acr061907.eastus.data.azurecr.io\"],\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Enabled\",\"networkRuleBypassOptions\":\"AzureServices\",\"zoneRedundancy\":\"Disabled\",\"anonymousPullEnabled\":false}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907?api-version=2022-12-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerregistry/2.27.0-beta.1 (17.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "4a0fceaa-fd1d-448f-aade-5d67c09dc773", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "api-supported-versions" : "2022-12-01", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1192", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 May 2023 03:14:49 GMT", + "x-ms-correlation-request-id" : "48eaf8dc-0fb2-4664-8ca6-592b9abda216", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20230525T031449Z:48eaf8dc-0fb2-4664-8ca6-592b9abda216", + "Expires" : "-1", + "Content-Length" : "1490", + "x-ms-request-id" : "48eaf8dc-0fb2-4664-8ca6-592b9abda216", + "Body" : "{\"sku\":{\"name\":\"Premium\",\"tier\":\"Premium\"},\"type\":\"Microsoft.ContainerRegistry/registries\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907\",\"name\":\"acr061907\",\"location\":\"eastus\",\"tags\":{},\"systemData\":{\"createdBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"createdByType\":\"Application\",\"createdAt\":\"2023-05-25T03:14:32.7799477+00:00\",\"lastModifiedBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-05-25T03:14:47.6400106+00:00\"},\"properties\":{\"loginServer\":\"acr061907.azurecr.io\",\"creationDate\":\"2023-05-25T03:14:32.7799477Z\",\"provisioningState\":\"Succeeded\",\"adminUserEnabled\":false,\"networkRuleSet\":{\"defaultAction\":\"Deny\",\"ipRules\":[{\"action\":\"Allow\",\"value\":\"3.80.0.0/12\"}]},\"policies\":{\"quarantinePolicy\":{\"status\":\"disabled\"},\"trustPolicy\":{\"type\":\"Notary\",\"status\":\"disabled\"},\"retentionPolicy\":{\"days\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"},\"exportPolicy\":{\"status\":\"enabled\"},\"azureADAuthenticationAsArmPolicy\":{\"status\":\"enabled\"},\"softDeletePolicy\":{\"retentionDays\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"}},\"encryption\":{\"status\":\"disabled\"},\"dataEndpointEnabled\":false,\"dataEndpointHostNames\":[],\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Enabled\",\"networkRuleBypassOptions\":\"AzureServices\",\"zoneRedundancy\":\"Disabled\",\"anonymousPullEnabled\":false}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907?api-version=2022-12-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerregistry/2.27.0-beta.1 (17.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "c9e485a6-538f-4647-8833-67951d75e433", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "api-supported-versions" : "2022-12-01", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1191", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 May 2023 03:14:51 GMT", + "x-ms-correlation-request-id" : "79e5051e-e5ea-445b-8e93-a15f4a1035a1", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20230525T031452Z:79e5051e-e5ea-445b-8e93-a15f4a1035a1", + "Expires" : "-1", + "Content-Length" : "1481", + "x-ms-request-id" : "79e5051e-e5ea-445b-8e93-a15f4a1035a1", + "Body" : "{\"sku\":{\"name\":\"Premium\",\"tier\":\"Premium\"},\"type\":\"Microsoft.ContainerRegistry/registries\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907\",\"name\":\"acr061907\",\"location\":\"eastus\",\"tags\":{},\"systemData\":{\"createdBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"createdByType\":\"Application\",\"createdAt\":\"2023-05-25T03:14:32.7799477+00:00\",\"lastModifiedBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-05-25T03:14:50.7026536+00:00\"},\"properties\":{\"loginServer\":\"acr061907.azurecr.io\",\"creationDate\":\"2023-05-25T03:14:32.7799477Z\",\"provisioningState\":\"Succeeded\",\"adminUserEnabled\":false,\"networkRuleSet\":{\"defaultAction\":\"Deny\",\"ipRules\":[{\"action\":\"Allow\",\"value\":\"3.80.0.0/12\"}]},\"policies\":{\"quarantinePolicy\":{\"status\":\"disabled\"},\"trustPolicy\":{\"type\":\"Notary\",\"status\":\"disabled\"},\"retentionPolicy\":{\"days\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"},\"exportPolicy\":{\"status\":\"enabled\"},\"azureADAuthenticationAsArmPolicy\":{\"status\":\"enabled\"},\"softDeletePolicy\":{\"retentionDays\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"}},\"encryption\":{\"status\":\"disabled\"},\"dataEndpointEnabled\":false,\"dataEndpointHostNames\":[],\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Enabled\",\"networkRuleBypassOptions\":\"None\",\"zoneRedundancy\":\"Disabled\",\"anonymousPullEnabled\":false}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907?api-version=2022-12-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerregistry/2.27.0-beta.1 (17.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "916601bb-f609-4284-9b17-bfba1af76b71", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "api-supported-versions" : "2022-12-01", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1190", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 May 2023 03:14:54 GMT", + "x-ms-correlation-request-id" : "3e1fb0a8-595b-48f7-afb8-37066b8847f4", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20230525T031454Z:3e1fb0a8-595b-48f7-afb8-37066b8847f4", + "Expires" : "-1", + "Content-Length" : "1482", + "x-ms-request-id" : "3e1fb0a8-595b-48f7-afb8-37066b8847f4", + "Body" : "{\"sku\":{\"name\":\"Premium\",\"tier\":\"Premium\"},\"type\":\"Microsoft.ContainerRegistry/registries\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907\",\"name\":\"acr061907\",\"location\":\"eastus\",\"tags\":{},\"systemData\":{\"createdBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"createdByType\":\"Application\",\"createdAt\":\"2023-05-25T03:14:32.7799477+00:00\",\"lastModifiedBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-05-25T03:14:53.0777641+00:00\"},\"properties\":{\"loginServer\":\"acr061907.azurecr.io\",\"creationDate\":\"2023-05-25T03:14:32.7799477Z\",\"provisioningState\":\"Succeeded\",\"adminUserEnabled\":false,\"networkRuleSet\":{\"defaultAction\":\"Allow\",\"ipRules\":[{\"action\":\"Allow\",\"value\":\"3.80.0.0/12\"}]},\"policies\":{\"quarantinePolicy\":{\"status\":\"disabled\"},\"trustPolicy\":{\"type\":\"Notary\",\"status\":\"disabled\"},\"retentionPolicy\":{\"days\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"},\"exportPolicy\":{\"status\":\"enabled\"},\"azureADAuthenticationAsArmPolicy\":{\"status\":\"enabled\"},\"softDeletePolicy\":{\"retentionDays\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"}},\"encryption\":{\"status\":\"disabled\"},\"dataEndpointEnabled\":false,\"dataEndpointHostNames\":[],\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Enabled\",\"networkRuleBypassOptions\":\"None\",\"zoneRedundancy\":\"Disabled\",\"anonymousPullEnabled\":false}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "PATCH", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907?api-version=2022-12-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.containerregistry/2.27.0-beta.1 (17.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "0b7772a0-52e1-457f-86c8-5ba3dd02245f", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "api-supported-versions" : "2022-12-01", + "X-Content-Type-Options" : "nosniff", + "x-ms-ratelimit-remaining-subscription-writes" : "1189", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 May 2023 03:14:56 GMT", + "x-ms-correlation-request-id" : "fdf922c9-a89d-40e1-8550-5dc74535a8ca", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20230525T031456Z:fdf922c9-a89d-40e1-8550-5dc74535a8ca", + "Expires" : "-1", + "Content-Length" : "1483", + "x-ms-request-id" : "fdf922c9-a89d-40e1-8550-5dc74535a8ca", + "Body" : "{\"sku\":{\"name\":\"Premium\",\"tier\":\"Premium\"},\"type\":\"Microsoft.ContainerRegistry/registries\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgacr43871/providers/Microsoft.ContainerRegistry/registries/acr061907\",\"name\":\"acr061907\",\"location\":\"eastus\",\"tags\":{},\"systemData\":{\"createdBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"createdByType\":\"Application\",\"createdAt\":\"2023-05-25T03:14:32.7799477+00:00\",\"lastModifiedBy\":\"dbdd69d2-7304-468d-9011-390c26eb054e\",\"lastModifiedByType\":\"Application\",\"lastModifiedAt\":\"2023-05-25T03:14:55.4372644+00:00\"},\"properties\":{\"loginServer\":\"acr061907.azurecr.io\",\"creationDate\":\"2023-05-25T03:14:32.7799477Z\",\"provisioningState\":\"Succeeded\",\"adminUserEnabled\":false,\"networkRuleSet\":{\"defaultAction\":\"Allow\",\"ipRules\":[{\"action\":\"Allow\",\"value\":\"3.80.0.0/12\"}]},\"policies\":{\"quarantinePolicy\":{\"status\":\"disabled\"},\"trustPolicy\":{\"type\":\"Notary\",\"status\":\"disabled\"},\"retentionPolicy\":{\"days\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"},\"exportPolicy\":{\"status\":\"enabled\"},\"azureADAuthenticationAsArmPolicy\":{\"status\":\"enabled\"},\"softDeletePolicy\":{\"retentionDays\":7,\"lastUpdatedTime\":\"2023-05-25T03:14:39.9187488+00:00\",\"status\":\"disabled\"}},\"encryption\":{\"status\":\"disabled\"},\"dataEndpointEnabled\":false,\"dataEndpointHostNames\":[],\"privateEndpointConnections\":[],\"publicNetworkAccess\":\"Disabled\",\"networkRuleBypassOptions\":\"None\",\"zoneRedundancy\":\"Disabled\",\"anonymousPullEnabled\":false}}", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rgacr43871?api-version=2022-09-01", + "Headers" : { + "User-Agent" : "azsdk-java-com.azure.resourcemanager.resources/2.27.0-beta.1 (17.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "00b79a96-0ed4-41d6-8cdf-f05b181e4ee0", + "Content-Type" : "application/json" + }, + "Response" : { + "x-ms-ratelimit-remaining-subscription-deletes" : "14999", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "StatusCode" : "202", + "Date" : "Thu, 25 May 2023 03:14:59 GMT", + "x-ms-correlation-request-id" : "87c443d5-628d-46f4-a8a3-bab7798b0c15", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Retry-After" : "0", + "Cache-Control" : "no-cache", + "x-ms-routing-request-id" : "SOUTHEASTASIA:20230525T031459Z:87c443d5-628d-46f4-a8a3-bab7798b0c15", + "Expires" : "-1", + "Content-Length" : "0", + "x-ms-request-id" : "87c443d5-628d-46f4-a8a3-bab7798b0c15", + "Location" : "http://localhost:1234/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1SR0FDUjQzODcxLUVBU1RVUyIsImpvYkxvY2F0aW9uIjoiZWFzdHVzIn0?api-version=2022-09-01" + }, + "Exception" : null + } ], + "variables" : [ "rgacr43871", "acr838718", "acr061907" ] +} \ No newline at end of file diff --git a/sdk/search/azure-search-documents/assets.json b/sdk/search/azure-search-documents/assets.json new file mode 100644 index 000000000000..9045ce11edfe --- /dev/null +++ b/sdk/search/azure-search-documents/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "java", + "TagPrefix": "java/search/azure-search-documents", + "Tag": "java/search/azure-search-documents_67bdd0527a" +} diff --git a/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusTracerTests.java b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusTracerTests.java new file mode 100644 index 000000000000..bdf827931cb3 --- /dev/null +++ b/sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusTracerTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.servicebus.implementation.instrumentation; + +import com.azure.core.amqp.exception.AmqpErrorCondition; +import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.util.Context; +import com.azure.core.util.tracing.Tracer; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.ArgumentMatchers.same; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class ServiceBusTracerTests { + @Test + public void testSpanEndNoError() { + Tracer inner = mock(Tracer.class); + when(inner.isEnabled()).thenReturn(true); + + ServiceBusTracer tracer = new ServiceBusTracer(inner, "fqdn", "entityPath"); + tracer.endSpan(null, Context.NONE, null); + + verify(inner, times(1)).end(isNull(), isNull(), same(Context.NONE)); + } + + @Test + public void testSpanEndNoErrorAndScope() { + Tracer inner = mock(Tracer.class); + when(inner.isEnabled()).thenReturn(true); + + ServiceBusTracer tracer = new ServiceBusTracer(inner, "fqdn", "entityPath"); + AtomicBoolean closed = new AtomicBoolean(); + tracer.endSpan(null, Context.NONE, () -> closed.set(true)); + + verify(inner, times(1)).end(isNull(), isNull(), same(Context.NONE)); + assertTrue(closed.get()); + } + + @ParameterizedTest + @MethodSource("getAmqpException") + public void testSpanEndException(Exception amqpException, String expectedStatus) { + Tracer inner = mock(Tracer.class); + when(inner.isEnabled()).thenReturn(true); + + ServiceBusTracer tracer = new ServiceBusTracer(inner, "fqdn", "entityPath"); + + tracer.endSpan(amqpException, Context.NONE, null); + + verify(inner, times(1)).end(eq(expectedStatus), eq(amqpException), same(Context.NONE)); + } + + public static Stream getAmqpException() { + return Stream.of( + Arguments.of(new RuntimeException("foo"), null), + Arguments.of(new AmqpException(false, "foo", null, null), null), + Arguments.of(new AmqpException(false, AmqpErrorCondition.NOT_FOUND, "foo", null), AmqpErrorCondition.NOT_FOUND.getErrorCondition()), + Arguments.of(new AmqpException(false, AmqpErrorCondition.TIMEOUT_ERROR, "", null), AmqpErrorCondition.TIMEOUT_ERROR.getErrorCondition()), + Arguments.of(new AmqpException(false, AmqpErrorCondition.SERVER_BUSY_ERROR, null, new RuntimeException("foo"), null), AmqpErrorCondition.SERVER_BUSY_ERROR.getErrorCondition())); + } +} diff --git a/sdk/spring/scripts/spring_boot_2.7.11_managed_external_dependencies.txt b/sdk/spring/scripts/spring_boot_2.7.11_managed_external_dependencies.txt new file mode 100644 index 000000000000..04f8e60689f9 --- /dev/null +++ b/sdk/spring/scripts/spring_boot_2.7.11_managed_external_dependencies.txt @@ -0,0 +1,1555 @@ +antlr:antlr;2.7.7 +ch.qos.logback:logback-access;1.2.12 +ch.qos.logback:logback-classic;1.2.12 +ch.qos.logback:logback-core;1.2.12 +com.atomikos:transactions-jdbc;4.0.6 +com.atomikos:transactions-jms;4.0.6 +com.atomikos:transactions-jta;4.0.6 +com.couchbase.client:java-client;3.3.4 +com.datastax.oss:java-driver-bom;4.14.1 +com.datastax.oss:java-driver-core;4.14.1 +com.datastax.oss:java-driver-core-shaded;4.14.1 +com.datastax.oss:java-driver-mapper-processor;4.14.1 +com.datastax.oss:java-driver-mapper-runtime;4.14.1 +com.datastax.oss:java-driver-metrics-micrometer;4.14.1 +com.datastax.oss:java-driver-metrics-microprofile;4.14.1 +com.datastax.oss:java-driver-query-builder;4.14.1 +com.datastax.oss:java-driver-shaded-guava;25.1-jre-graal-sub-1 +com.datastax.oss:java-driver-test-infra;4.14.1 +com.datastax.oss:native-protocol;1.5.1 +com.ecwid.consul:consul-api;1.4.5 +com.fasterxml.jackson.core:jackson-annotations;2.13.5 +com.fasterxml.jackson.core:jackson-core;2.13.5 +com.fasterxml.jackson.core:jackson-databind;2.13.5 +com.fasterxml.jackson.dataformat:jackson-dataformat-avro;2.13.5 +com.fasterxml.jackson.dataformat:jackson-dataformat-cbor;2.13.5 +com.fasterxml.jackson.dataformat:jackson-dataformat-csv;2.13.5 +com.fasterxml.jackson.dataformat:jackson-dataformat-ion;2.13.5 +com.fasterxml.jackson.dataformat:jackson-dataformat-properties;2.13.5 +com.fasterxml.jackson.dataformat:jackson-dataformat-protobuf;2.13.5 +com.fasterxml.jackson.dataformat:jackson-dataformat-smile;2.13.5 +com.fasterxml.jackson.dataformat:jackson-dataformat-toml;2.13.5 +com.fasterxml.jackson.dataformat:jackson-dataformat-xml;2.13.5 +com.fasterxml.jackson.dataformat:jackson-dataformat-yaml;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-eclipse-collections;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-guava;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-hibernate4;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-hibernate5;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-hibernate5-jakarta;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-hppc;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-jakarta-jsonp;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-jaxrs;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-jdk8;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-joda;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-joda-money;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-json-org;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-jsr310;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-jsr353;2.13.5 +com.fasterxml.jackson.datatype:jackson-datatype-pcollections;2.13.5 +com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-base;2.13.5 +com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-cbor-provider;2.13.5 +com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-json-provider;2.13.5 +com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-smile-provider;2.13.5 +com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-xml-provider;2.13.5 +com.fasterxml.jackson.jakarta.rs:jackson-jakarta-rs-yaml-provider;2.13.5 +com.fasterxml.jackson.jaxrs:jackson-jaxrs-base;2.13.5 +com.fasterxml.jackson.jaxrs:jackson-jaxrs-cbor-provider;2.13.5 +com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider;2.13.5 +com.fasterxml.jackson.jaxrs:jackson-jaxrs-smile-provider;2.13.5 +com.fasterxml.jackson.jaxrs:jackson-jaxrs-xml-provider;2.13.5 +com.fasterxml.jackson.jaxrs:jackson-jaxrs-yaml-provider;2.13.5 +com.fasterxml.jackson.jr:jackson-jr-all;2.13.5 +com.fasterxml.jackson.jr:jackson-jr-annotation-support;2.13.5 +com.fasterxml.jackson.jr:jackson-jr-objects;2.13.5 +com.fasterxml.jackson.jr:jackson-jr-retrofit2;2.13.5 +com.fasterxml.jackson.jr:jackson-jr-stree;2.13.5 +com.fasterxml.jackson.module:jackson-module-afterburner;2.13.5 +com.fasterxml.jackson.module:jackson-module-blackbird;2.13.5 +com.fasterxml.jackson.module:jackson-module-guice;2.13.5 +com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations;2.13.5 +com.fasterxml.jackson.module:jackson-module-jaxb-annotations;2.13.5 +com.fasterxml.jackson.module:jackson-module-jsonSchema;2.13.5 +com.fasterxml.jackson.module:jackson-module-kotlin;2.13.5 +com.fasterxml.jackson.module:jackson-module-mrbean;2.13.5 +com.fasterxml.jackson.module:jackson-module-no-ctor-deser;2.13.5 +com.fasterxml.jackson.module:jackson-module-osgi;2.13.5 +com.fasterxml.jackson.module:jackson-module-parameter-names;2.13.5 +com.fasterxml.jackson.module:jackson-module-paranamer;2.13.5 +com.fasterxml.jackson.module:jackson-module-scala_2.11;2.13.5 +com.fasterxml.jackson.module:jackson-module-scala_2.12;2.13.5 +com.fasterxml.jackson.module:jackson-module-scala_2.13;2.13.5 +com.fasterxml.jackson.module:jackson-module-scala_3;2.13.5 +com.fasterxml.jackson:jackson-bom;2.13.5 +com.fasterxml:classmate;1.5.1 +com.github.ben-manes.caffeine:caffeine;2.9.3 +com.github.ben-manes.caffeine:guava;2.9.3 +com.github.ben-manes.caffeine:jcache;2.9.3 +com.github.ben-manes.caffeine:simulator;2.9.3 +com.github.mxab.thymeleaf.extras:thymeleaf-extras-data-attribute;2.0.1 +com.github.tomakehurst:wiremock-jre8;2.26.3 +com.github.tomakehurst:wiremock-jre8-standalone;2.33.0 +com.google.appengine:appengine-api-1.0-sdk;1.9.98 +com.google.code.gson:gson;2.9.1 +com.graphql-java:graphql-java;18.5 +com.h2database:h2;2.1.214 +com.hazelcast:hazelcast;5.1.5 +com.hazelcast:hazelcast-hibernate52;2.2.1 +com.hazelcast:hazelcast-hibernate53;2.2.1 +com.hazelcast:hazelcast-spring;5.1.5 +com.ibm.db2:jcc;11.5.8.0 +com.jayway.jsonpath:json-path;2.7.0 +com.jayway.jsonpath:json-path-assert;2.7.0 +com.microsoft.sqlserver:mssql-jdbc;10.2.3.jre8 +com.mysql:mysql-connector-j;8.0.33 +com.netflix.eureka:eureka-client;1.10.17 +com.netflix.eureka:eureka-core;1.10.17 +com.oracle.database.ha:ons;21.5.0.0 +com.oracle.database.ha:simplefan;21.5.0.0 +com.oracle.database.jdbc.debug:ojdbc11-debug;21.5.0.0 +com.oracle.database.jdbc.debug:ojdbc11-observability-debug;21.5.0.0 +com.oracle.database.jdbc.debug:ojdbc11_g;21.5.0.0 +com.oracle.database.jdbc.debug:ojdbc11dms_g;21.5.0.0 +com.oracle.database.jdbc.debug:ojdbc8-debug;21.5.0.0 +com.oracle.database.jdbc.debug:ojdbc8-observability-debug;21.5.0.0 +com.oracle.database.jdbc.debug:ojdbc8_g;21.5.0.0 +com.oracle.database.jdbc.debug:ojdbc8dms_g;21.5.0.0 +com.oracle.database.jdbc:ojdbc-bom;21.5.0.0 +com.oracle.database.jdbc:ojdbc11;21.5.0.0 +com.oracle.database.jdbc:ojdbc11-production;21.5.0.0 +com.oracle.database.jdbc:ojdbc8;21.5.0.0 +com.oracle.database.jdbc:ojdbc8-production;21.5.0.0 +com.oracle.database.jdbc:rsi;21.5.0.0 +com.oracle.database.jdbc:ucp;21.5.0.0 +com.oracle.database.jdbc:ucp11;21.5.0.0 +com.oracle.database.nls:orai18n;21.5.0.0 +com.oracle.database.observability:dms;21.5.0.0 +com.oracle.database.observability:ojdbc11-observability;21.5.0.0 +com.oracle.database.observability:ojdbc11dms;21.5.0.0 +com.oracle.database.observability:ojdbc8-observability;21.5.0.0 +com.oracle.database.observability:ojdbc8dms;21.5.0.0 +com.oracle.database.r2dbc:oracle-r2dbc;0.4.0 +com.oracle.database.security:oraclepki;21.5.0.0 +com.oracle.database.security:osdt_cert;21.5.0.0 +com.oracle.database.security:osdt_core;21.5.0.0 +com.oracle.database.xml:xdb;21.5.0.0 +com.oracle.database.xml:xmlparserv2;21.5.0.0 +com.querydsl:querydsl-apt;5.0.0 +com.querydsl:querydsl-bom;5.0.0 +com.querydsl:querydsl-codegen;5.0.0 +com.querydsl:querydsl-codegen-utils;5.0.0 +com.querydsl:querydsl-collections;5.0.0 +com.querydsl:querydsl-core;5.0.0 +com.querydsl:querydsl-guava;5.0.0 +com.querydsl:querydsl-hibernate-search;5.0.0 +com.querydsl:querydsl-jdo;5.0.0 +com.querydsl:querydsl-jpa;5.0.0 +com.querydsl:querydsl-jpa-codegen;5.0.0 +com.querydsl:querydsl-kotlin;5.0.0 +com.querydsl:querydsl-kotlin-codegen;5.0.0 +com.querydsl:querydsl-lucene3;5.0.0 +com.querydsl:querydsl-lucene4;5.0.0 +com.querydsl:querydsl-lucene5;5.0.0 +com.querydsl:querydsl-mongodb;5.0.0 +com.querydsl:querydsl-scala;5.0.0 +com.querydsl:querydsl-spatial;5.0.0 +com.querydsl:querydsl-sql;5.0.0 +com.querydsl:querydsl-sql-codegen;5.0.0 +com.querydsl:querydsl-sql-spatial;5.0.0 +com.querydsl:querydsl-sql-spring;5.0.0 +com.rabbitmq:amqp-client;5.14.2 +com.rabbitmq:stream-client;0.5.0 +com.samskivert:jmustache;1.15 +com.sendgrid:sendgrid-java;4.9.3 +com.squareup.okhttp3:logging-interceptor;4.9.3 +com.squareup.okhttp3:mockwebserver;4.9.3 +com.squareup.okhttp3:okcurl;4.9.3 +com.squareup.okhttp3:okhttp;4.9.3 +com.squareup.okhttp3:okhttp-bom;4.9.3 +com.squareup.okhttp3:okhttp-brotli;4.9.3 +com.squareup.okhttp3:okhttp-dnsoverhttps;4.9.3 +com.squareup.okhttp3:okhttp-sse;4.9.3 +com.squareup.okhttp3:okhttp-tls;4.9.3 +com.squareup.okhttp3:okhttp-urlconnection;4.9.3 +com.sun.activation:jakarta.activation;1.2.2 +com.sun.mail:jakarta.mail;1.6.7 +com.sun.xml.messaging.saaj:saaj-impl;1.5.3 +com.toomuchcoding.jsonassert:jsonassert;0.6.2 +com.toomuchcoding.jsonassert:jsonassert-shade;0.6.2 +com.unboundid:unboundid-ldapsdk;6.0.8 +com.zaxxer:HikariCP;4.0.3 +commons-codec:commons-codec;1.15 +commons-pool:commons-pool;1.6 +de.flapdoodle.embed:de.flapdoodle.embed.mongo;3.4.11 +io.awspring.cloud:spring-cloud-aws-context;2.4.4 +io.dropwizard.metrics:metrics-annotation;4.2.18 +io.dropwizard.metrics:metrics-bom;4.2.18 +io.dropwizard.metrics:metrics-caffeine;4.2.18 +io.dropwizard.metrics:metrics-caffeine3;4.2.18 +io.dropwizard.metrics:metrics-collectd;4.2.18 +io.dropwizard.metrics:metrics-core;4.2.18 +io.dropwizard.metrics:metrics-ehcache;4.2.18 +io.dropwizard.metrics:metrics-graphite;4.2.18 +io.dropwizard.metrics:metrics-healthchecks;4.2.18 +io.dropwizard.metrics:metrics-httpasyncclient;4.2.18 +io.dropwizard.metrics:metrics-httpclient;4.2.18 +io.dropwizard.metrics:metrics-httpclient5;4.2.18 +io.dropwizard.metrics:metrics-jakarta-servlet;4.2.18 +io.dropwizard.metrics:metrics-jakarta-servlets;4.2.18 +io.dropwizard.metrics:metrics-jcache;4.2.18 +io.dropwizard.metrics:metrics-jdbi;4.2.18 +io.dropwizard.metrics:metrics-jdbi3;4.2.18 +io.dropwizard.metrics:metrics-jersey2;4.2.18 +io.dropwizard.metrics:metrics-jersey3;4.2.18 +io.dropwizard.metrics:metrics-jersey31;4.2.18 +io.dropwizard.metrics:metrics-jetty10;4.2.18 +io.dropwizard.metrics:metrics-jetty11;4.2.18 +io.dropwizard.metrics:metrics-jetty9;4.2.18 +io.dropwizard.metrics:metrics-jmx;4.2.18 +io.dropwizard.metrics:metrics-json;4.2.18 +io.dropwizard.metrics:metrics-jvm;4.2.18 +io.dropwizard.metrics:metrics-log4j2;4.2.18 +io.dropwizard.metrics:metrics-logback;4.2.18 +io.dropwizard.metrics:metrics-logback13;4.2.18 +io.dropwizard.metrics:metrics-logback14;4.2.18 +io.dropwizard.metrics:metrics-servlet;4.2.18 +io.dropwizard.metrics:metrics-servlets;4.2.18 +io.fabric8.kubernetes:kubernetes-karaf;5.10.2 +io.fabric8.kubernetes:kubernetes-karaf-itests;5.10.2 +io.fabric8:camel-k-client;5.10.2 +io.fabric8:camel-k-mock;5.10.2 +io.fabric8:camel-k-model-v1;5.10.2 +io.fabric8:camel-k-model-v1alpha1;5.10.2 +io.fabric8:camel-k-tests;5.10.2 +io.fabric8:certmanager-client;5.10.2 +io.fabric8:certmanager-examples;5.10.2 +io.fabric8:certmanager-model-v1;5.10.2 +io.fabric8:certmanager-model-v1alpha2;5.10.2 +io.fabric8:certmanager-model-v1alpha3;5.10.2 +io.fabric8:certmanager-model-v1beta1;5.10.2 +io.fabric8:certmanager-server-mock;5.10.2 +io.fabric8:certmanager-tests;5.10.2 +io.fabric8:chaosmesh-client;5.10.2 +io.fabric8:chaosmesh-examples;5.10.2 +io.fabric8:chaosmesh-model;5.10.2 +io.fabric8:chaosmesh-server-mock;5.10.2 +io.fabric8:chaosmesh-tests;5.10.2 +io.fabric8:crd-generator-api;5.10.2 +io.fabric8:crd-generator-apt;5.10.2 +io.fabric8:knative-client;5.10.2 +io.fabric8:knative-examples;5.10.2 +io.fabric8:knative-mock;5.10.2 +io.fabric8:knative-model;5.10.2 +io.fabric8:knative-tests;5.10.2 +io.fabric8:kubernetes-client;5.10.2 +io.fabric8:kubernetes-client-bom;5.10.2 +io.fabric8:kubernetes-examples;5.10.2 +io.fabric8:kubernetes-model;5.10.2 +io.fabric8:kubernetes-model-admissionregistration;5.10.2 +io.fabric8:kubernetes-model-apiextensions;5.10.2 +io.fabric8:kubernetes-model-apps;5.10.2 +io.fabric8:kubernetes-model-autoscaling;5.10.2 +io.fabric8:kubernetes-model-batch;5.10.2 +io.fabric8:kubernetes-model-certificates;5.10.2 +io.fabric8:kubernetes-model-common;5.10.2 +io.fabric8:kubernetes-model-coordination;5.10.2 +io.fabric8:kubernetes-model-core;5.10.2 +io.fabric8:kubernetes-model-discovery;5.10.2 +io.fabric8:kubernetes-model-events;5.10.2 +io.fabric8:kubernetes-model-extensions;5.10.2 +io.fabric8:kubernetes-model-flowcontrol;5.10.2 +io.fabric8:kubernetes-model-jsonschema2pojo;5.10.2 +io.fabric8:kubernetes-model-metrics;5.10.2 +io.fabric8:kubernetes-model-networking;5.10.2 +io.fabric8:kubernetes-model-node;5.10.2 +io.fabric8:kubernetes-model-policy;5.10.2 +io.fabric8:kubernetes-model-rbac;5.10.2 +io.fabric8:kubernetes-model-scheduling;5.10.2 +io.fabric8:kubernetes-model-storageclass;5.10.2 +io.fabric8:kubernetes-openshift-uberjar;5.10.2 +io.fabric8:kubernetes-server-mock;5.10.2 +io.fabric8:kubernetes-test;5.10.2 +io.fabric8:model-annotator;5.10.2 +io.fabric8:openshift-client;5.10.2 +io.fabric8:openshift-model;5.10.2 +io.fabric8:openshift-model-clusterautoscaling;5.10.2 +io.fabric8:openshift-model-console;5.10.2 +io.fabric8:openshift-model-machine;5.10.2 +io.fabric8:openshift-model-machineconfig;5.10.2 +io.fabric8:openshift-model-miscellaneous;5.10.2 +io.fabric8:openshift-model-monitoring;5.10.2 +io.fabric8:openshift-model-operator;5.10.2 +io.fabric8:openshift-model-operatorhub;5.10.2 +io.fabric8:openshift-model-storageversionmigrator;5.10.2 +io.fabric8:openshift-model-tuned;5.10.2 +io.fabric8:openshift-model-whereabouts;5.10.2 +io.fabric8:openshift-server-mock;5.10.2 +io.fabric8:service-catalog-examples;5.10.2 +io.fabric8:servicecatalog-client;5.10.2 +io.fabric8:servicecatalog-model;5.10.2 +io.fabric8:servicecatalog-server-mock;5.10.2 +io.fabric8:servicecatalog-tests;5.10.2 +io.fabric8:tekton-client;5.10.2 +io.fabric8:tekton-examples;5.10.2 +io.fabric8:tekton-mock;5.10.2 +io.fabric8:tekton-model-triggers;5.10.2 +io.fabric8:tekton-model-v1alpha1;5.10.2 +io.fabric8:tekton-model-v1beta1;5.10.2 +io.fabric8:tekton-tests;5.10.2 +io.fabric8:verticalpodautoscaler-client;5.10.2 +io.fabric8:verticalpodautoscaler-examples;5.10.2 +io.fabric8:verticalpodautoscaler-model-v1;5.10.2 +io.fabric8:verticalpodautoscaler-server-mock;5.10.2 +io.fabric8:verticalpodautoscaler-tests;5.10.2 +io.fabric8:volumesnapshot-client;5.10.2 +io.fabric8:volumesnapshot-examples;5.10.2 +io.fabric8:volumesnapshot-model;5.10.2 +io.fabric8:volumesnapshot-server-mock;5.10.2 +io.fabric8:volumesnapshot-tests;5.10.2 +io.github.lognet:grpc-spring-boot-starter;4.2.2 +io.github.openfeign.form:feign-form-spring;3.8.0 +io.github.openfeign:feign-annotation-error-decoder;11.10 +io.github.openfeign:feign-bom;11.10 +io.github.openfeign:feign-core;11.10 +io.github.openfeign:feign-dropwizard-metrics4;11.10 +io.github.openfeign:feign-dropwizard-metrics5;11.10 +io.github.openfeign:feign-googlehttpclient;11.10 +io.github.openfeign:feign-gson;11.10 +io.github.openfeign:feign-hc5;11.10 +io.github.openfeign:feign-httpclient;11.10 +io.github.openfeign:feign-hystrix;11.10 +io.github.openfeign:feign-jackson;11.10 +io.github.openfeign:feign-jackson-jaxb;11.10 +io.github.openfeign:feign-jackson-jr;11.10 +io.github.openfeign:feign-jaxb;11.10 +io.github.openfeign:feign-jaxrs;11.10 +io.github.openfeign:feign-jaxrs2;11.10 +io.github.openfeign:feign-json;11.10 +io.github.openfeign:feign-micrometer;11.10 +io.github.openfeign:feign-mock;11.10 +io.github.openfeign:feign-okhttp;11.10 +io.github.openfeign:feign-reactive-wrappers;11.10 +io.github.openfeign:feign-ribbon;11.10 +io.github.openfeign:feign-sax;11.10 +io.github.openfeign:feign-slf4j;11.10 +io.github.openfeign:feign-soap;11.10 +io.github.openfeign:feign-spring4;11.10 +io.github.resilience4j:resilience4j-all;1.7.0 +io.github.resilience4j:resilience4j-annotations;1.7.0 +io.github.resilience4j:resilience4j-bom;1.7.0 +io.github.resilience4j:resilience4j-bulkhead;1.7.0 +io.github.resilience4j:resilience4j-cache;1.7.0 +io.github.resilience4j:resilience4j-circuitbreaker;1.7.0 +io.github.resilience4j:resilience4j-circularbuffer;1.7.0 +io.github.resilience4j:resilience4j-consumer;1.7.0 +io.github.resilience4j:resilience4j-core;1.7.0 +io.github.resilience4j:resilience4j-feign;1.7.0 +io.github.resilience4j:resilience4j-kotlin;1.7.0 +io.github.resilience4j:resilience4j-metrics;1.7.0 +io.github.resilience4j:resilience4j-micrometer;1.7.0 +io.github.resilience4j:resilience4j-prometheus;1.7.0 +io.github.resilience4j:resilience4j-ratelimiter;1.7.0 +io.github.resilience4j:resilience4j-ratpack;1.7.0 +io.github.resilience4j:resilience4j-reactor;1.7.0 +io.github.resilience4j:resilience4j-retrofit;1.7.0 +io.github.resilience4j:resilience4j-retry;1.7.0 +io.github.resilience4j:resilience4j-rxjava2;1.7.0 +io.github.resilience4j:resilience4j-rxjava3;1.7.0 +io.github.resilience4j:resilience4j-spring;1.7.0 +io.github.resilience4j:resilience4j-spring-boot2;1.7.0 +io.github.resilience4j:resilience4j-spring-cloud2;1.7.0 +io.github.resilience4j:resilience4j-timelimiter;1.7.0 +io.github.resilience4j:resilience4j-vertx;1.7.0 +io.kubernetes:client-java;13.0.2 +io.kubernetes:client-java-extended;13.0.2 +io.kubernetes:client-java-spring-integration;13.0.2 +io.lettuce:lettuce-core;6.1.10.RELEASE +io.micrometer:micrometer-bom;1.9.10 +io.micrometer:micrometer-core;1.9.10 +io.micrometer:micrometer-registry-appoptics;1.9.10 +io.micrometer:micrometer-registry-atlas;1.9.10 +io.micrometer:micrometer-registry-azure-monitor;1.9.10 +io.micrometer:micrometer-registry-cloudwatch;1.9.10 +io.micrometer:micrometer-registry-cloudwatch2;1.9.10 +io.micrometer:micrometer-registry-datadog;1.9.10 +io.micrometer:micrometer-registry-dynatrace;1.9.10 +io.micrometer:micrometer-registry-elastic;1.9.10 +io.micrometer:micrometer-registry-ganglia;1.9.10 +io.micrometer:micrometer-registry-graphite;1.9.10 +io.micrometer:micrometer-registry-health;1.9.10 +io.micrometer:micrometer-registry-humio;1.9.10 +io.micrometer:micrometer-registry-influx;1.9.10 +io.micrometer:micrometer-registry-jmx;1.9.10 +io.micrometer:micrometer-registry-kairos;1.9.10 +io.micrometer:micrometer-registry-new-relic;1.9.10 +io.micrometer:micrometer-registry-opentsdb;1.9.10 +io.micrometer:micrometer-registry-otlp;1.9.10 +io.micrometer:micrometer-registry-prometheus;1.9.10 +io.micrometer:micrometer-registry-signalfx;1.9.10 +io.micrometer:micrometer-registry-stackdriver;1.9.10 +io.micrometer:micrometer-registry-statsd;1.9.10 +io.micrometer:micrometer-registry-wavefront;1.9.10 +io.micrometer:micrometer-test;1.9.10 +io.netty:netty-all;4.1.91.Final +io.netty:netty-bom;4.1.91.Final +io.netty:netty-buffer;4.1.91.Final +io.netty:netty-codec;4.1.91.Final +io.netty:netty-codec-dns;4.1.91.Final +io.netty:netty-codec-haproxy;4.1.91.Final +io.netty:netty-codec-http;4.1.91.Final +io.netty:netty-codec-http2;4.1.91.Final +io.netty:netty-codec-memcache;4.1.91.Final +io.netty:netty-codec-mqtt;4.1.91.Final +io.netty:netty-codec-redis;4.1.91.Final +io.netty:netty-codec-smtp;4.1.91.Final +io.netty:netty-codec-socks;4.1.91.Final +io.netty:netty-codec-stomp;4.1.91.Final +io.netty:netty-codec-xml;4.1.91.Final +io.netty:netty-common;4.1.91.Final +io.netty:netty-dev-tools;4.1.91.Final +io.netty:netty-example;4.1.91.Final +io.netty:netty-handler;4.1.91.Final +io.netty:netty-handler-proxy;4.1.91.Final +io.netty:netty-handler-ssl-ocsp;4.1.91.Final +io.netty:netty-resolver;4.1.91.Final +io.netty:netty-resolver-dns;4.1.91.Final +io.netty:netty-resolver-dns-classes-macos;4.1.91.Final +io.netty:netty-resolver-dns-native-macos;4.1.91.Final +io.netty:netty-tcnative;2.0.59.Final +io.netty:netty-tcnative-boringssl-static;2.0.59.Final +io.netty:netty-tcnative-classes;2.0.59.Final +io.netty:netty-transport;4.1.91.Final +io.netty:netty-transport-classes-epoll;4.1.91.Final +io.netty:netty-transport-classes-kqueue;4.1.91.Final +io.netty:netty-transport-native-epoll;4.1.91.Final +io.netty:netty-transport-native-kqueue;4.1.91.Final +io.netty:netty-transport-native-unix-common;4.1.91.Final +io.netty:netty-transport-rxtx;4.1.91.Final +io.netty:netty-transport-sctp;4.1.91.Final +io.netty:netty-transport-udt;4.1.91.Final +io.opentracing.brave:brave-opentracing;0.37.4 +io.projectreactor.addons:reactor-adapter;3.4.10 +io.projectreactor.addons:reactor-extra;3.4.10 +io.projectreactor.addons:reactor-pool;0.2.11 +io.projectreactor.kafka:reactor-kafka;1.3.17 +io.projectreactor.kotlin:reactor-kotlin-extensions;1.1.10 +io.projectreactor.netty:reactor-netty;1.0.31 +io.projectreactor.netty:reactor-netty-core;1.0.31 +io.projectreactor.netty:reactor-netty-http;1.0.31 +io.projectreactor.netty:reactor-netty-http-brave;1.0.31 +io.projectreactor.rabbitmq:reactor-rabbitmq;1.5.6 +io.projectreactor:reactor-bom;2020.0.31 +io.projectreactor:reactor-core;3.4.29 +io.projectreactor:reactor-test;3.4.29 +io.projectreactor:reactor-tools;3.4.29 +io.prometheus:simpleclient;0.15.0 +io.prometheus:simpleclient_bom;0.15.0 +io.prometheus:simpleclient_caffeine;0.15.0 +io.prometheus:simpleclient_common;0.15.0 +io.prometheus:simpleclient_dropwizard;0.15.0 +io.prometheus:simpleclient_graphite_bridge;0.15.0 +io.prometheus:simpleclient_guava;0.15.0 +io.prometheus:simpleclient_hibernate;0.15.0 +io.prometheus:simpleclient_hotspot;0.15.0 +io.prometheus:simpleclient_httpserver;0.15.0 +io.prometheus:simpleclient_jetty;0.15.0 +io.prometheus:simpleclient_jetty_jdk8;0.15.0 +io.prometheus:simpleclient_log4j;0.15.0 +io.prometheus:simpleclient_log4j2;0.15.0 +io.prometheus:simpleclient_logback;0.15.0 +io.prometheus:simpleclient_pushgateway;0.15.0 +io.prometheus:simpleclient_servlet;0.15.0 +io.prometheus:simpleclient_servlet_jakarta;0.15.0 +io.prometheus:simpleclient_spring_boot;0.15.0 +io.prometheus:simpleclient_spring_web;0.15.0 +io.prometheus:simpleclient_tracer_otel;0.15.0 +io.prometheus:simpleclient_tracer_otel_agent;0.15.0 +io.prometheus:simpleclient_vertx;0.15.0 +io.r2dbc:r2dbc-bom;Borca-SR2 +io.r2dbc:r2dbc-h2;0.9.1.RELEASE +io.r2dbc:r2dbc-mssql;0.9.0.RELEASE +io.r2dbc:r2dbc-pool;0.9.2.RELEASE +io.r2dbc:r2dbc-proxy;0.9.1.RELEASE +io.r2dbc:r2dbc-spi;0.9.1.RELEASE +io.reactivex.rxjava2:rxjava;2.2.21 +io.reactivex:rxjava;1.3.8 +io.reactivex:rxjava-reactive-streams;1.2.1 +io.rest-assured.examples:kotlin-example;4.5.1 +io.rest-assured.examples:rest-assured-itest-java;4.5.1 +io.rest-assured.examples:scala-example;4.5.1 +io.rest-assured.examples:scala-mock-mvc-example;4.5.1 +io.rest-assured.examples:scalatra-example;4.5.1 +io.rest-assured.examples:scalatra-webapp;4.5.1 +io.rest-assured.examples:spring-mvc-webapp;4.5.1 +io.rest-assured:json-path;4.5.1 +io.rest-assured:json-schema-validator;4.5.1 +io.rest-assured:kotlin-extensions;4.5.1 +io.rest-assured:rest-assured;4.5.1 +io.rest-assured:rest-assured-all;4.5.1 +io.rest-assured:rest-assured-bom;4.5.1 +io.rest-assured:rest-assured-common;4.5.1 +io.rest-assured:scala-support;4.5.1 +io.rest-assured:spring-commons;4.5.1 +io.rest-assured:spring-mock-mvc;4.5.1 +io.rest-assured:spring-mock-mvc-kotlin-extensions;4.5.1 +io.rest-assured:spring-web-test-client;4.5.1 +io.rest-assured:xml-path;4.5.1 +io.rsocket:rsocket-bom;1.1.3 +io.rsocket:rsocket-core;1.1.3 +io.rsocket:rsocket-load-balancer;1.1.3 +io.rsocket:rsocket-micrometer;1.1.3 +io.rsocket:rsocket-test;1.1.3 +io.rsocket:rsocket-transport-local;1.1.3 +io.rsocket:rsocket-transport-netty;1.1.3 +io.specto:hoverfly-java;0.13.0 +io.specto:hoverfly-java-junit5;0.13.0 +io.spring.gradle:dependency-management-plugin;1.0.15.RELEASE +io.undertow:undertow-core;2.2.24.Final +io.undertow:undertow-servlet;2.2.24.Final +io.undertow:undertow-websockets-jsr;2.2.24.Final +io.zipkin.brave:brave;5.13.9 +io.zipkin.brave:brave-bom;5.13.9 +io.zipkin.brave:brave-context-jfr;5.13.9 +io.zipkin.brave:brave-context-log4j12;5.13.9 +io.zipkin.brave:brave-context-log4j2;5.13.9 +io.zipkin.brave:brave-context-rxjava2;5.13.9 +io.zipkin.brave:brave-context-slf4j;5.13.9 +io.zipkin.brave:brave-instrumentation-dubbo;5.13.9 +io.zipkin.brave:brave-instrumentation-dubbo-rpc;5.13.9 +io.zipkin.brave:brave-instrumentation-grpc;5.13.9 +io.zipkin.brave:brave-instrumentation-http;5.13.9 +io.zipkin.brave:brave-instrumentation-http-tests;5.13.9 +io.zipkin.brave:brave-instrumentation-httpasyncclient;5.13.9 +io.zipkin.brave:brave-instrumentation-httpclient;5.13.9 +io.zipkin.brave:brave-instrumentation-jaxrs2;5.13.9 +io.zipkin.brave:brave-instrumentation-jersey-server;5.13.9 +io.zipkin.brave:brave-instrumentation-jms;5.13.9 +io.zipkin.brave:brave-instrumentation-kafka-clients;5.13.9 +io.zipkin.brave:brave-instrumentation-kafka-streams;5.13.9 +io.zipkin.brave:brave-instrumentation-messaging;5.13.9 +io.zipkin.brave:brave-instrumentation-mongodb;5.13.9 +io.zipkin.brave:brave-instrumentation-mysql;5.13.9 +io.zipkin.brave:brave-instrumentation-mysql6;5.13.9 +io.zipkin.brave:brave-instrumentation-mysql8;5.13.9 +io.zipkin.brave:brave-instrumentation-netty-codec-http;5.13.9 +io.zipkin.brave:brave-instrumentation-okhttp3;5.13.9 +io.zipkin.brave:brave-instrumentation-p6spy;5.13.9 +io.zipkin.brave:brave-instrumentation-rpc;5.13.9 +io.zipkin.brave:brave-instrumentation-servlet;5.13.9 +io.zipkin.brave:brave-instrumentation-sparkjava;5.13.9 +io.zipkin.brave:brave-instrumentation-spring-rabbit;5.13.9 +io.zipkin.brave:brave-instrumentation-spring-web;5.13.9 +io.zipkin.brave:brave-instrumentation-spring-webmvc;5.13.9 +io.zipkin.brave:brave-instrumentation-vertx-web;5.13.9 +io.zipkin.brave:brave-spring-beans;5.13.9 +io.zipkin.brave:brave-tests;5.13.9 +io.zipkin.proto3:zipkin-proto3;1.0.0 +io.zipkin.reporter2:zipkin-reporter;2.16.3 +io.zipkin.reporter2:zipkin-reporter-bom;2.16.3 +io.zipkin.reporter2:zipkin-reporter-brave;2.16.3 +io.zipkin.reporter2:zipkin-reporter-metrics-micrometer;2.16.3 +io.zipkin.reporter2:zipkin-reporter-spring-beans;2.16.3 +io.zipkin.reporter2:zipkin-sender-activemq-client;2.16.3 +io.zipkin.reporter2:zipkin-sender-amqp-client;2.16.3 +io.zipkin.reporter2:zipkin-sender-kafka;2.16.3 +io.zipkin.reporter2:zipkin-sender-kafka08;2.16.3 +io.zipkin.reporter2:zipkin-sender-libthrift;2.16.3 +io.zipkin.reporter2:zipkin-sender-okhttp3;2.16.3 +io.zipkin.reporter2:zipkin-sender-urlconnection;2.16.3 +io.zipkin.zipkin2:zipkin;2.23.2 +jakarta.activation:jakarta.activation-api;1.2.2 +jakarta.annotation:jakarta.annotation-api;1.3.5 +jakarta.jms:jakarta.jms-api;2.0.3 +jakarta.json.bind:jakarta.json.bind-api;1.0.2 +jakarta.json:jakarta.json-api;1.1.6 +jakarta.mail:jakarta.mail-api;1.6.7 +jakarta.management.j2ee:jakarta.management.j2ee-api;1.1.4 +jakarta.persistence:jakarta.persistence-api;2.2.3 +jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api;1.2.7 +jakarta.servlet:jakarta.servlet-api;4.0.4 +jakarta.transaction:jakarta.transaction-api;1.3.3 +jakarta.validation:jakarta.validation-api;2.0.2 +jakarta.websocket:jakarta.websocket-api;1.1.2 +jakarta.ws.rs:jakarta.ws.rs-api;2.1.6 +jakarta.xml.bind:jakarta.xml.bind-api;2.3.3 +jakarta.xml.soap:jakarta.xml.soap-api;1.4.2 +jakarta.xml.ws:jakarta.xml.ws-api;2.3.3 +javax.activation:javax.activation-api;1.2.0 +javax.annotation:javax.annotation-api;1.3.2 +javax.cache:cache-api;1.1.1 +javax.jms:javax.jms-api;2.0.1 +javax.json.bind:javax.json.bind-api;1.0 +javax.json:javax.json-api;1.1.4 +javax.mail:javax.mail-api;1.6.2 +javax.money:money-api;1.1 +javax.persistence:javax.persistence-api;2.2 +javax.servlet:javax.servlet-api;4.0.1 +javax.servlet:jstl;1.2 +javax.transaction:javax.transaction-api;1.3 +javax.validation:validation-api;2.0.1.Final +javax.websocket:javax.websocket-api;1.1 +javax.xml.bind:jaxb-api;2.3.1 +javax.xml.ws:jaxws-api;2.3.1 +jaxen:jaxen;1.2.0 +junit:junit;4.13.2 +me.snowdrop:istio-client;1.7.7.1 +net.bytebuddy:byte-buddy;1.12.23 +net.bytebuddy:byte-buddy-agent;1.12.23 +net.minidev:json-smart;2.4.10 +net.sf.ehcache:ehcache;2.10.9.2 +net.sourceforge.htmlunit:htmlunit;2.60.0 +net.sourceforge.jtds:jtds;1.3.1 +net.sourceforge.nekohtml:nekohtml;1.9.22 +nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect;3.0.0 +org.apache.activemq:activemq-amqp;5.16.6 +org.apache.activemq:activemq-blueprint;5.16.6 +org.apache.activemq:activemq-broker;5.16.6 +org.apache.activemq:activemq-camel;5.16.6 +org.apache.activemq:activemq-client;5.16.6 +org.apache.activemq:activemq-console;5.16.6 +org.apache.activemq:activemq-http;5.16.6 +org.apache.activemq:activemq-jaas;5.16.6 +org.apache.activemq:activemq-jdbc-store;5.16.6 +org.apache.activemq:activemq-jms-pool;5.16.6 +org.apache.activemq:activemq-kahadb-store;5.16.6 +org.apache.activemq:activemq-karaf;5.16.6 +org.apache.activemq:activemq-leveldb-store;5.16.6 +org.apache.activemq:activemq-log4j-appender;5.16.6 +org.apache.activemq:activemq-mqtt;5.16.6 +org.apache.activemq:activemq-openwire-generator;5.16.6 +org.apache.activemq:activemq-openwire-legacy;5.16.6 +org.apache.activemq:activemq-osgi;5.16.6 +org.apache.activemq:activemq-partition;5.16.6 +org.apache.activemq:activemq-pool;5.16.6 +org.apache.activemq:activemq-ra;5.16.6 +org.apache.activemq:activemq-run;5.16.6 +org.apache.activemq:activemq-runtime-config;5.16.6 +org.apache.activemq:activemq-shiro;5.16.6 +org.apache.activemq:activemq-spring;5.16.6 +org.apache.activemq:activemq-stomp;5.16.6 +org.apache.activemq:activemq-web;5.16.6 +org.apache.activemq:artemis-amqp-protocol;2.19.1 +org.apache.activemq:artemis-commons;2.19.1 +org.apache.activemq:artemis-core-client;2.19.1 +org.apache.activemq:artemis-jdbc-store;2.19.1 +org.apache.activemq:artemis-jms-client;2.19.1 +org.apache.activemq:artemis-jms-server;2.19.1 +org.apache.activemq:artemis-journal;2.19.1 +org.apache.activemq:artemis-quorum-api;2.19.1 +org.apache.activemq:artemis-selector;2.19.1 +org.apache.activemq:artemis-server;2.19.1 +org.apache.activemq:artemis-service-extensions;2.19.1 +org.apache.commons:commons-collections4;4.4 +org.apache.commons:commons-dbcp2;2.9.0 +org.apache.commons:commons-lang3;3.12.0 +org.apache.commons:commons-pool2;2.11.1 +org.apache.curator:curator-framework;5.1.0 +org.apache.curator:curator-recipes;5.1.0 +org.apache.curator:curator-test;5.1.0 +org.apache.curator:curator-x-discovery;5.1.0 +org.apache.derby:derby;10.14.2.0 +org.apache.derby:derbyclient;10.14.2.0 +org.apache.derby:derbynet;10.14.2.0 +org.apache.derby:derbyoptionaltools;10.14.2.0 +org.apache.derby:derbytools;10.14.2.0 +org.apache.httpcomponents.client5:httpclient5;5.1.4 +org.apache.httpcomponents.client5:httpclient5-cache;5.1.4 +org.apache.httpcomponents.client5:httpclient5-fluent;5.1.4 +org.apache.httpcomponents.client5:httpclient5-win;5.1.4 +org.apache.httpcomponents.core5:httpcore5;5.1.5 +org.apache.httpcomponents.core5:httpcore5-h2;5.1.5 +org.apache.httpcomponents.core5:httpcore5-reactive;5.1.5 +org.apache.httpcomponents:fluent-hc;4.5.14 +org.apache.httpcomponents:httpasyncclient;4.1.5 +org.apache.httpcomponents:httpclient;4.5.14 +org.apache.httpcomponents:httpclient-cache;4.5.14 +org.apache.httpcomponents:httpclient-osgi;4.5.14 +org.apache.httpcomponents:httpclient-win;4.5.14 +org.apache.httpcomponents:httpcore;4.4.16 +org.apache.httpcomponents:httpcore-nio;4.4.16 +org.apache.httpcomponents:httpmime;4.5.14 +org.apache.johnzon:johnzon-core;1.2.19 +org.apache.johnzon:johnzon-jaxrs;1.2.19 +org.apache.johnzon:johnzon-jsonb;1.2.19 +org.apache.johnzon:johnzon-jsonb-extras;1.2.19 +org.apache.johnzon:johnzon-jsonschema;1.2.19 +org.apache.johnzon:johnzon-mapper;1.2.19 +org.apache.johnzon:johnzon-websocket;1.2.19 +org.apache.kafka:connect;3.1.2 +org.apache.kafka:connect-api;3.1.2 +org.apache.kafka:connect-basic-auth-extension;3.1.2 +org.apache.kafka:connect-file;3.1.2 +org.apache.kafka:connect-json;3.1.2 +org.apache.kafka:connect-mirror;3.1.2 +org.apache.kafka:connect-mirror-client;3.1.2 +org.apache.kafka:connect-runtime;3.1.2 +org.apache.kafka:connect-transforms;3.1.2 +org.apache.kafka:generator;3.1.2 +org.apache.kafka:kafka-clients;3.1.2 +org.apache.kafka:kafka-log4j-appender;3.1.2 +org.apache.kafka:kafka-metadata;3.1.2 +org.apache.kafka:kafka-raft;3.1.2 +org.apache.kafka:kafka-server-common;3.1.2 +org.apache.kafka:kafka-shell;3.1.2 +org.apache.kafka:kafka-storage;3.1.2 +org.apache.kafka:kafka-storage-api;3.1.2 +org.apache.kafka:kafka-streams;3.1.2 +org.apache.kafka:kafka-streams-scala_2.12;3.1.2 +org.apache.kafka:kafka-streams-scala_2.13;3.1.2 +org.apache.kafka:kafka-streams-test-utils;3.1.2 +org.apache.kafka:kafka-tools;3.1.2 +org.apache.kafka:kafka_2.12;3.1.2 +org.apache.kafka:kafka_2.13;3.1.2 +org.apache.kafka:trogdor;3.1.2 +org.apache.logging.log4j:log4j-1.2-api;2.17.2 +org.apache.logging.log4j:log4j-api;2.17.2 +org.apache.logging.log4j:log4j-appserver;2.17.2 +org.apache.logging.log4j:log4j-bom;2.17.2 +org.apache.logging.log4j:log4j-cassandra;2.17.2 +org.apache.logging.log4j:log4j-core;2.17.2 +org.apache.logging.log4j:log4j-couchdb;2.17.2 +org.apache.logging.log4j:log4j-docker;2.17.2 +org.apache.logging.log4j:log4j-flume-ng;2.17.2 +org.apache.logging.log4j:log4j-iostreams;2.17.2 +org.apache.logging.log4j:log4j-jcl;2.17.2 +org.apache.logging.log4j:log4j-jmx-gui;2.17.2 +org.apache.logging.log4j:log4j-jpa;2.17.2 +org.apache.logging.log4j:log4j-jpl;2.17.2 +org.apache.logging.log4j:log4j-jul;2.17.2 +org.apache.logging.log4j:log4j-kubernetes;2.17.2 +org.apache.logging.log4j:log4j-layout-template-json;2.17.2 +org.apache.logging.log4j:log4j-liquibase;2.17.2 +org.apache.logging.log4j:log4j-mongodb3;2.17.2 +org.apache.logging.log4j:log4j-mongodb4;2.17.2 +org.apache.logging.log4j:log4j-slf4j-impl;2.17.2 +org.apache.logging.log4j:log4j-slf4j18-impl;2.17.2 +org.apache.logging.log4j:log4j-spring-boot;2.17.2 +org.apache.logging.log4j:log4j-spring-cloud-config-client;2.17.2 +org.apache.logging.log4j:log4j-taglib;2.17.2 +org.apache.logging.log4j:log4j-to-slf4j;2.17.2 +org.apache.logging.log4j:log4j-web;2.17.2 +org.apache.solr:solr-analysis-extras;8.11.2 +org.apache.solr:solr-analytics;8.11.2 +org.apache.solr:solr-cell;8.11.2 +org.apache.solr:solr-core;8.11.2 +org.apache.solr:solr-dataimporthandler;8.11.2 +org.apache.solr:solr-dataimporthandler-extras;8.11.2 +org.apache.solr:solr-gcs-repository;8.11.2 +org.apache.solr:solr-jaegertracer-configurator;8.11.2 +org.apache.solr:solr-langid;8.11.2 +org.apache.solr:solr-ltr;8.11.2 +org.apache.solr:solr-prometheus-exporter;8.11.2 +org.apache.solr:solr-s3-repository;8.11.2 +org.apache.solr:solr-solrj;8.11.2 +org.apache.solr:solr-test-framework;8.11.2 +org.apache.solr:solr-velocity;8.11.2 +org.apache.tomcat.embed:tomcat-embed-core;9.0.74 +org.apache.tomcat.embed:tomcat-embed-el;9.0.74 +org.apache.tomcat.embed:tomcat-embed-jasper;9.0.74 +org.apache.tomcat.embed:tomcat-embed-websocket;9.0.74 +org.apache.tomcat:tomcat-annotations-api;9.0.74 +org.apache.tomcat:tomcat-jdbc;9.0.74 +org.apache.tomcat:tomcat-jsp-api;9.0.74 +org.arquillian.cube:arquillian-cube-kubernetes;1.15.2 +org.arquillian.cube:arquillian-cube-openshift;1.15.2 +org.arquillian.cube:arquillian-cube-requirement;1.15.2 +org.aspectj:aspectjrt;1.9.7 +org.aspectj:aspectjtools;1.9.7 +org.aspectj:aspectjweaver;1.9.7 +org.assertj:assertj-core;3.22.0 +org.awaitility:awaitility;4.2.0 +org.awaitility:awaitility-groovy;4.2.0 +org.awaitility:awaitility-kotlin;4.2.0 +org.awaitility:awaitility-scala;4.2.0 +org.cache2k:cache2k-api;2.6.1.Final +org.cache2k:cache2k-config;2.6.1.Final +org.cache2k:cache2k-core;2.6.1.Final +org.cache2k:cache2k-jcache;2.6.1.Final +org.cache2k:cache2k-micrometer;2.6.1.Final +org.cache2k:cache2k-spring;2.6.1.Final +org.codehaus.groovy:groovy;3.0.17 +org.codehaus.groovy:groovy-ant;3.0.17 +org.codehaus.groovy:groovy-astbuilder;3.0.17 +org.codehaus.groovy:groovy-bom;3.0.17 +org.codehaus.groovy:groovy-bsf;3.0.17 +org.codehaus.groovy:groovy-cli-commons;3.0.17 +org.codehaus.groovy:groovy-cli-picocli;3.0.17 +org.codehaus.groovy:groovy-console;3.0.17 +org.codehaus.groovy:groovy-datetime;3.0.17 +org.codehaus.groovy:groovy-dateutil;3.0.17 +org.codehaus.groovy:groovy-docgenerator;3.0.17 +org.codehaus.groovy:groovy-groovydoc;3.0.17 +org.codehaus.groovy:groovy-groovysh;3.0.17 +org.codehaus.groovy:groovy-jaxb;3.0.17 +org.codehaus.groovy:groovy-jmx;3.0.17 +org.codehaus.groovy:groovy-json;3.0.17 +org.codehaus.groovy:groovy-jsr223;3.0.17 +org.codehaus.groovy:groovy-macro;3.0.17 +org.codehaus.groovy:groovy-nio;3.0.17 +org.codehaus.groovy:groovy-servlet;3.0.17 +org.codehaus.groovy:groovy-sql;3.0.17 +org.codehaus.groovy:groovy-swing;3.0.17 +org.codehaus.groovy:groovy-templates;3.0.17 +org.codehaus.groovy:groovy-test;3.0.17 +org.codehaus.groovy:groovy-test-junit5;3.0.17 +org.codehaus.groovy:groovy-testng;3.0.17 +org.codehaus.groovy:groovy-xml;3.0.17 +org.codehaus.groovy:groovy-yaml;3.0.17 +org.codehaus.janino:commons-compiler;3.1.9 +org.codehaus.janino:commons-compiler-jdk;3.1.9 +org.codehaus.janino:janino;3.1.9 +org.eclipse.jetty.fcgi:fcgi-client;9.4.51.v20230217 +org.eclipse.jetty.fcgi:fcgi-server;9.4.51.v20230217 +org.eclipse.jetty.gcloud:jetty-gcloud-session-manager;9.4.51.v20230217 +org.eclipse.jetty.http2:http2-client;9.4.51.v20230217 +org.eclipse.jetty.http2:http2-common;9.4.51.v20230217 +org.eclipse.jetty.http2:http2-hpack;9.4.51.v20230217 +org.eclipse.jetty.http2:http2-http-client-transport;9.4.51.v20230217 +org.eclipse.jetty.http2:http2-server;9.4.51.v20230217 +org.eclipse.jetty.memcached:jetty-memcached-sessions;9.4.51.v20230217 +org.eclipse.jetty.orbit:javax.servlet.jsp;2.2.0.v201112011158 +org.eclipse.jetty.osgi:jetty-httpservice;9.4.51.v20230217 +org.eclipse.jetty.osgi:jetty-osgi-boot;9.4.51.v20230217 +org.eclipse.jetty.osgi:jetty-osgi-boot-jsp;9.4.51.v20230217 +org.eclipse.jetty.osgi:jetty-osgi-boot-warurl;9.4.51.v20230217 +org.eclipse.jetty.websocket:javax-websocket-client-impl;9.4.51.v20230217 +org.eclipse.jetty.websocket:javax-websocket-server-impl;9.4.51.v20230217 +org.eclipse.jetty.websocket:websocket-api;9.4.51.v20230217 +org.eclipse.jetty.websocket:websocket-client;9.4.51.v20230217 +org.eclipse.jetty.websocket:websocket-common;9.4.51.v20230217 +org.eclipse.jetty.websocket:websocket-server;9.4.51.v20230217 +org.eclipse.jetty.websocket:websocket-servlet;9.4.51.v20230217 +org.eclipse.jetty:apache-jsp;9.4.51.v20230217 +org.eclipse.jetty:apache-jstl;9.4.51.v20230217 +org.eclipse.jetty:infinispan-common;9.4.51.v20230217 +org.eclipse.jetty:infinispan-embedded-query;9.4.51.v20230217 +org.eclipse.jetty:infinispan-remote-query;9.4.51.v20230217 +org.eclipse.jetty:jetty-alpn-client;9.4.51.v20230217 +org.eclipse.jetty:jetty-alpn-conscrypt-client;9.4.51.v20230217 +org.eclipse.jetty:jetty-alpn-conscrypt-server;9.4.51.v20230217 +org.eclipse.jetty:jetty-alpn-java-client;9.4.51.v20230217 +org.eclipse.jetty:jetty-alpn-java-server;9.4.51.v20230217 +org.eclipse.jetty:jetty-alpn-openjdk8-client;9.4.51.v20230217 +org.eclipse.jetty:jetty-alpn-openjdk8-server;9.4.51.v20230217 +org.eclipse.jetty:jetty-alpn-server;9.4.51.v20230217 +org.eclipse.jetty:jetty-annotations;9.4.51.v20230217 +org.eclipse.jetty:jetty-ant;9.4.51.v20230217 +org.eclipse.jetty:jetty-bom;9.4.51.v20230217 +org.eclipse.jetty:jetty-client;9.4.51.v20230217 +org.eclipse.jetty:jetty-continuation;9.4.51.v20230217 +org.eclipse.jetty:jetty-deploy;9.4.51.v20230217 +org.eclipse.jetty:jetty-distribution;9.4.51.v20230217 +org.eclipse.jetty:jetty-hazelcast;9.4.51.v20230217 +org.eclipse.jetty:jetty-home;9.4.51.v20230217 +org.eclipse.jetty:jetty-http;9.4.51.v20230217 +org.eclipse.jetty:jetty-http-spi;9.4.51.v20230217 +org.eclipse.jetty:jetty-io;9.4.51.v20230217 +org.eclipse.jetty:jetty-jaas;9.4.51.v20230217 +org.eclipse.jetty:jetty-jaspi;9.4.51.v20230217 +org.eclipse.jetty:jetty-jmx;9.4.51.v20230217 +org.eclipse.jetty:jetty-jndi;9.4.51.v20230217 +org.eclipse.jetty:jetty-nosql;9.4.51.v20230217 +org.eclipse.jetty:jetty-openid;9.4.51.v20230217 +org.eclipse.jetty:jetty-plus;9.4.51.v20230217 +org.eclipse.jetty:jetty-proxy;9.4.51.v20230217 +org.eclipse.jetty:jetty-quickstart;9.4.51.v20230217 +org.eclipse.jetty:jetty-reactive-httpclient;1.1.14 +org.eclipse.jetty:jetty-rewrite;9.4.51.v20230217 +org.eclipse.jetty:jetty-security;9.4.51.v20230217 +org.eclipse.jetty:jetty-server;9.4.51.v20230217 +org.eclipse.jetty:jetty-servlet;9.4.51.v20230217 +org.eclipse.jetty:jetty-servlets;9.4.51.v20230217 +org.eclipse.jetty:jetty-spring;9.4.51.v20230217 +org.eclipse.jetty:jetty-unixsocket;9.4.51.v20230217 +org.eclipse.jetty:jetty-util;9.4.51.v20230217 +org.eclipse.jetty:jetty-util-ajax;9.4.51.v20230217 +org.eclipse.jetty:jetty-webapp;9.4.51.v20230217 +org.eclipse.jetty:jetty-xml;9.4.51.v20230217 +org.eclipse.jgit:org.eclipse.jgit;5.13.1.202206130422-r +org.eclipse.jgit:org.eclipse.jgit.http.apache;5.13.1.202206130422-r +org.eclipse.jgit:org.eclipse.jgit.junit.http;5.13.1.202206130422-r +org.eclipse.jgit:org.eclipse.jgit.ssh.apache;5.13.1.202206130422-r +org.ehcache:ehcache;3.10.8 +org.ehcache:ehcache-clustered;3.10.8 +org.ehcache:ehcache-transactions;3.10.8 +org.elasticsearch.client:elasticsearch-rest-client;7.17.9 +org.elasticsearch.client:elasticsearch-rest-client-sniffer;7.17.9 +org.elasticsearch.client:elasticsearch-rest-high-level-client;7.17.9 +org.elasticsearch.client:transport;7.17.9 +org.elasticsearch.distribution.integ-test-zip:elasticsearch;7.17.9 +org.elasticsearch.plugin:transport-netty4-client;7.17.9 +org.elasticsearch:elasticsearch;7.17.9 +org.firebirdsql.jdbc:jaybird;4.0.9.java8 +org.firebirdsql.jdbc:jaybird-jdk18;4.0.9.java8 +org.flywaydb:flyway-core;8.5.13 +org.flywaydb:flyway-firebird;8.5.13 +org.flywaydb:flyway-mysql;8.5.13 +org.flywaydb:flyway-sqlserver;8.5.13 +org.freemarker:freemarker;2.3.32 +org.glassfish.jaxb:codemodel;2.3.8 +org.glassfish.jaxb:codemodel-annotation-compiler;2.3.8 +org.glassfish.jaxb:jaxb-jxc;2.3.8 +org.glassfish.jaxb:jaxb-runtime;2.3.8 +org.glassfish.jaxb:jaxb-xjc;2.3.8 +org.glassfish.jaxb:txw2;2.3.8 +org.glassfish.jaxb:txwc2;2.3.8 +org.glassfish.jaxb:xsom;2.3.8 +org.glassfish.jersey.bundles:jaxrs-ri;2.35 +org.glassfish.jersey.connectors:jersey-apache-connector;2.35 +org.glassfish.jersey.connectors:jersey-grizzly-connector;2.35 +org.glassfish.jersey.connectors:jersey-helidon-connector;2.35 +org.glassfish.jersey.connectors:jersey-jdk-connector;2.35 +org.glassfish.jersey.connectors:jersey-jetty-connector;2.35 +org.glassfish.jersey.connectors:jersey-netty-connector;2.35 +org.glassfish.jersey.containers.glassfish:jersey-gf-ejb;2.35 +org.glassfish.jersey.containers:jersey-container-grizzly2-http;2.35 +org.glassfish.jersey.containers:jersey-container-grizzly2-servlet;2.35 +org.glassfish.jersey.containers:jersey-container-jdk-http;2.35 +org.glassfish.jersey.containers:jersey-container-jetty-http;2.35 +org.glassfish.jersey.containers:jersey-container-jetty-servlet;2.35 +org.glassfish.jersey.containers:jersey-container-netty-http;2.35 +org.glassfish.jersey.containers:jersey-container-servlet;2.35 +org.glassfish.jersey.containers:jersey-container-servlet-core;2.35 +org.glassfish.jersey.containers:jersey-container-simple-http;2.35 +org.glassfish.jersey.core:jersey-client;2.35 +org.glassfish.jersey.core:jersey-common;2.35 +org.glassfish.jersey.core:jersey-server;2.35 +org.glassfish.jersey.ext.cdi:jersey-cdi-rs-inject;2.35 +org.glassfish.jersey.ext.cdi:jersey-cdi1x;2.35 +org.glassfish.jersey.ext.cdi:jersey-cdi1x-ban-custom-hk2-binding;2.35 +org.glassfish.jersey.ext.cdi:jersey-cdi1x-servlet;2.35 +org.glassfish.jersey.ext.cdi:jersey-cdi1x-transaction;2.35 +org.glassfish.jersey.ext.cdi:jersey-cdi1x-validation;2.35 +org.glassfish.jersey.ext.cdi:jersey-weld2-se;2.35 +org.glassfish.jersey.ext.microprofile:jersey-mp-config;2.35 +org.glassfish.jersey.ext.microprofile:jersey-mp-rest-client;2.35 +org.glassfish.jersey.ext.rx:jersey-rx-client-guava;2.35 +org.glassfish.jersey.ext.rx:jersey-rx-client-rxjava;2.35 +org.glassfish.jersey.ext.rx:jersey-rx-client-rxjava2;2.35 +org.glassfish.jersey.ext:jersey-bean-validation;2.35 +org.glassfish.jersey.ext:jersey-declarative-linking;2.35 +org.glassfish.jersey.ext:jersey-entity-filtering;2.35 +org.glassfish.jersey.ext:jersey-metainf-services;2.35 +org.glassfish.jersey.ext:jersey-mvc;2.35 +org.glassfish.jersey.ext:jersey-mvc-bean-validation;2.35 +org.glassfish.jersey.ext:jersey-mvc-freemarker;2.35 +org.glassfish.jersey.ext:jersey-mvc-jsp;2.35 +org.glassfish.jersey.ext:jersey-mvc-mustache;2.35 +org.glassfish.jersey.ext:jersey-proxy-client;2.35 +org.glassfish.jersey.ext:jersey-servlet-portability;2.35 +org.glassfish.jersey.ext:jersey-spring4;2.35 +org.glassfish.jersey.ext:jersey-spring5;2.35 +org.glassfish.jersey.ext:jersey-wadl-doclet;2.35 +org.glassfish.jersey.inject:jersey-cdi2-se;2.35 +org.glassfish.jersey.inject:jersey-hk2;2.35 +org.glassfish.jersey.media:jersey-media-jaxb;2.35 +org.glassfish.jersey.media:jersey-media-json-binding;2.35 +org.glassfish.jersey.media:jersey-media-json-jackson;2.35 +org.glassfish.jersey.media:jersey-media-json-jettison;2.35 +org.glassfish.jersey.media:jersey-media-json-processing;2.35 +org.glassfish.jersey.media:jersey-media-kryo;2.35 +org.glassfish.jersey.media:jersey-media-moxy;2.35 +org.glassfish.jersey.media:jersey-media-multipart;2.35 +org.glassfish.jersey.media:jersey-media-sse;2.35 +org.glassfish.jersey.security:oauth1-client;2.35 +org.glassfish.jersey.security:oauth1-server;2.35 +org.glassfish.jersey.security:oauth1-signature;2.35 +org.glassfish.jersey.security:oauth2-client;2.35 +org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-bundle;2.35 +org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-external;2.35 +org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-grizzly2;2.35 +org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-inmemory;2.35 +org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-jdk-http;2.35 +org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-jetty;2.35 +org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-simple;2.35 +org.glassfish.jersey.test-framework:jersey-test-framework-core;2.35 +org.glassfish.jersey.test-framework:jersey-test-framework-util;2.35 +org.glassfish.jersey:jersey-bom;2.35 +org.glassfish.web:jakarta.servlet.jsp.jstl;1.2.6 +org.glassfish:jakarta.el;3.0.4 +org.hamcrest:hamcrest;2.2 +org.hamcrest:hamcrest-core;2.2 +org.hamcrest:hamcrest-library;2.2 +org.hibernate.validator:hibernate-validator;6.2.5.Final +org.hibernate.validator:hibernate-validator-annotation-processor;6.2.5.Final +org.hibernate:hibernate-c3p0;5.6.15.Final +org.hibernate:hibernate-core;5.6.15.Final +org.hibernate:hibernate-ehcache;5.6.15.Final +org.hibernate:hibernate-entitymanager;5.6.15.Final +org.hibernate:hibernate-envers;5.6.15.Final +org.hibernate:hibernate-hikaricp;5.6.15.Final +org.hibernate:hibernate-java8;5.6.15.Final +org.hibernate:hibernate-jcache;5.6.15.Final +org.hibernate:hibernate-jpamodelgen;5.6.15.Final +org.hibernate:hibernate-micrometer;5.6.15.Final +org.hibernate:hibernate-proxool;5.6.15.Final +org.hibernate:hibernate-spatial;5.6.15.Final +org.hibernate:hibernate-testing;5.6.15.Final +org.hibernate:hibernate-vibur;5.6.15.Final +org.hsqldb:hsqldb;2.5.2 +org.infinispan.protostream:protostream;4.4.4.Final +org.infinispan.protostream:protostream-processor;4.4.4.Final +org.infinispan.protostream:protostream-types;4.4.4.Final +org.infinispan:infinispan-anchored-keys;13.0.15.Final +org.infinispan:infinispan-api;13.0.15.Final +org.infinispan:infinispan-bom;13.0.15.Final +org.infinispan:infinispan-cachestore-jdbc;13.0.15.Final +org.infinispan:infinispan-cachestore-jpa;13.0.15.Final +org.infinispan:infinispan-cachestore-remote;13.0.15.Final +org.infinispan:infinispan-cachestore-rocksdb;13.0.15.Final +org.infinispan:infinispan-cachestore-sql;13.0.15.Final +org.infinispan:infinispan-cdi-common;13.0.15.Final +org.infinispan:infinispan-cdi-embedded;13.0.15.Final +org.infinispan:infinispan-cdi-remote;13.0.15.Final +org.infinispan:infinispan-checkstyle;13.0.15.Final +org.infinispan:infinispan-cli-client;13.0.15.Final +org.infinispan:infinispan-client-hotrod;13.0.15.Final +org.infinispan:infinispan-client-rest;13.0.15.Final +org.infinispan:infinispan-cloudevents-integration;13.0.15.Final +org.infinispan:infinispan-clustered-counter;13.0.15.Final +org.infinispan:infinispan-clustered-lock;13.0.15.Final +org.infinispan:infinispan-commons;13.0.15.Final +org.infinispan:infinispan-commons-test;13.0.15.Final +org.infinispan:infinispan-component-annotations;13.0.15.Final +org.infinispan:infinispan-component-processor;13.0.15.Final +org.infinispan:infinispan-console;0.15.5.Final +org.infinispan:infinispan-core;13.0.15.Final +org.infinispan:infinispan-extended-statistics;13.0.15.Final +org.infinispan:infinispan-hibernate-cache-commons;13.0.15.Final +org.infinispan:infinispan-hibernate-cache-spi;13.0.15.Final +org.infinispan:infinispan-hibernate-cache-v53;13.0.15.Final +org.infinispan:infinispan-jboss-marshalling;13.0.15.Final +org.infinispan:infinispan-jcache;13.0.15.Final +org.infinispan:infinispan-jcache-commons;13.0.15.Final +org.infinispan:infinispan-jcache-remote;13.0.15.Final +org.infinispan:infinispan-key-value-store-client;13.0.15.Final +org.infinispan:infinispan-multimap;13.0.15.Final +org.infinispan:infinispan-objectfilter;13.0.15.Final +org.infinispan:infinispan-query;13.0.15.Final +org.infinispan:infinispan-query-core;13.0.15.Final +org.infinispan:infinispan-query-dsl;13.0.15.Final +org.infinispan:infinispan-remote-query-client;13.0.15.Final +org.infinispan:infinispan-remote-query-server;13.0.15.Final +org.infinispan:infinispan-scripting;13.0.15.Final +org.infinispan:infinispan-server-core;13.0.15.Final +org.infinispan:infinispan-server-hotrod;13.0.15.Final +org.infinispan:infinispan-server-memcached;13.0.15.Final +org.infinispan:infinispan-server-rest;13.0.15.Final +org.infinispan:infinispan-server-router;13.0.15.Final +org.infinispan:infinispan-server-runtime;13.0.15.Final +org.infinispan:infinispan-server-testdriver-core;13.0.15.Final +org.infinispan:infinispan-server-testdriver-junit4;13.0.15.Final +org.infinispan:infinispan-server-testdriver-junit5;13.0.15.Final +org.infinispan:infinispan-spring-boot-starter-embedded;13.0.15.Final +org.infinispan:infinispan-spring-boot-starter-remote;13.0.15.Final +org.infinispan:infinispan-spring5-common;13.0.15.Final +org.infinispan:infinispan-spring5-embedded;13.0.15.Final +org.infinispan:infinispan-spring5-remote;13.0.15.Final +org.infinispan:infinispan-tasks;13.0.15.Final +org.infinispan:infinispan-tasks-api;13.0.15.Final +org.infinispan:infinispan-tools;13.0.15.Final +org.influxdb:influxdb-java;2.22 +org.jboss.arquillian.junit:arquillian-junit-standalone;1.6.0.Final +org.jboss.logging:jboss-logging;3.4.3.Final +org.jdom:jdom2;2.0.6.1 +org.jetbrains.kotlin:kotlin-bom;1.6.21 +org.jetbrains.kotlin:kotlin-compiler;1.6.21 +org.jetbrains.kotlin:kotlin-compiler-embeddable;1.6.21 +org.jetbrains.kotlin:kotlin-daemon-client;1.6.21 +org.jetbrains.kotlin:kotlin-main-kts;1.6.21 +org.jetbrains.kotlin:kotlin-osgi-bundle;1.6.21 +org.jetbrains.kotlin:kotlin-reflect;1.6.21 +org.jetbrains.kotlin:kotlin-script-runtime;1.6.21 +org.jetbrains.kotlin:kotlin-script-util;1.6.21 +org.jetbrains.kotlin:kotlin-scripting-common;1.6.21 +org.jetbrains.kotlin:kotlin-scripting-ide-services;1.6.21 +org.jetbrains.kotlin:kotlin-scripting-jvm;1.6.21 +org.jetbrains.kotlin:kotlin-scripting-jvm-host;1.6.21 +org.jetbrains.kotlin:kotlin-stdlib;1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-common;1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk7;1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-jdk8;1.6.21 +org.jetbrains.kotlin:kotlin-stdlib-js;1.6.21 +org.jetbrains.kotlin:kotlin-test;1.6.21 +org.jetbrains.kotlin:kotlin-test-annotations-common;1.6.21 +org.jetbrains.kotlin:kotlin-test-common;1.6.21 +org.jetbrains.kotlin:kotlin-test-js;1.6.21 +org.jetbrains.kotlin:kotlin-test-junit;1.6.21 +org.jetbrains.kotlin:kotlin-test-junit5;1.6.21 +org.jetbrains.kotlin:kotlin-test-testng;1.6.21 +org.jetbrains.kotlinx:kotlinx-coroutines-android;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-bom;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-debug;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-guava;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-javafx;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-jdk8;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-jdk9;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-play-services;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-reactive;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-reactor;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-rx2;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-rx3;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-slf4j;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-swing;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-test;1.6.4 +org.jetbrains.kotlinx:kotlinx-coroutines-test-jvm;1.6.4 +org.jolokia:jolokia-core;1.7.2 +org.jooq:jooq;3.14.16 +org.jooq:jooq-codegen;3.14.16 +org.jooq:jooq-kotlin;3.14.16 +org.jooq:jooq-meta;3.14.16 +org.junit.jupiter:junit-jupiter;5.8.2 +org.junit.jupiter:junit-jupiter-api;5.8.2 +org.junit.jupiter:junit-jupiter-engine;5.8.2 +org.junit.jupiter:junit-jupiter-migrationsupport;5.8.2 +org.junit.jupiter:junit-jupiter-params;5.8.2 +org.junit.platform:junit-platform-commons;1.8.2 +org.junit.platform:junit-platform-console;1.8.2 +org.junit.platform:junit-platform-engine;1.8.2 +org.junit.platform:junit-platform-jfr;1.8.2 +org.junit.platform:junit-platform-launcher;1.8.2 +org.junit.platform:junit-platform-reporting;1.8.2 +org.junit.platform:junit-platform-runner;1.8.2 +org.junit.platform:junit-platform-suite;1.8.2 +org.junit.platform:junit-platform-suite-api;1.8.2 +org.junit.platform:junit-platform-suite-commons;1.8.2 +org.junit.platform:junit-platform-suite-engine;1.8.2 +org.junit.platform:junit-platform-testkit;1.8.2 +org.junit.vintage:junit-vintage-engine;5.8.2 +org.junit:junit-bom;5.8.2 +org.liquibase:liquibase-cdi;4.9.1 +org.liquibase:liquibase-core;4.9.1 +org.mariadb.jdbc:mariadb-java-client;3.0.10 +org.mariadb:r2dbc-mariadb;1.1.2 +org.messaginghub:pooled-jms;1.2.4 +org.mockito:mockito-android;4.5.1 +org.mockito:mockito-bom;4.5.1 +org.mockito:mockito-core;4.5.1 +org.mockito:mockito-errorprone;4.5.1 +org.mockito:mockito-inline;4.5.1 +org.mockito:mockito-junit-jupiter;4.5.1 +org.mockito:mockito-proxy;4.5.1 +org.mongodb:bson;4.6.1 +org.mongodb:bson-record-codec;4.6.1 +org.mongodb:mongodb-driver-core;4.6.1 +org.mongodb:mongodb-driver-legacy;4.6.1 +org.mongodb:mongodb-driver-reactivestreams;4.6.1 +org.mongodb:mongodb-driver-sync;4.6.1 +org.mortbay.jasper:apache-el;9.0.52 +org.neo4j.driver:neo4j-java-driver;4.4.11 +org.postgresql:postgresql;42.3.8 +org.postgresql:r2dbc-postgresql;0.9.2.RELEASE +org.projectlombok:lombok;1.18.26 +org.quartz-scheduler:quartz;2.3.2 +org.quartz-scheduler:quartz-jobs;2.3.2 +org.reactivestreams:reactive-streams;1.0.4 +org.seleniumhq.selenium:htmlunit-driver;3.61.0 +org.seleniumhq.selenium:lift;4.1.4 +org.seleniumhq.selenium:selenium-api;4.1.4 +org.seleniumhq.selenium:selenium-chrome-driver;4.1.4 +org.seleniumhq.selenium:selenium-chromium-driver;4.1.4 +org.seleniumhq.selenium:selenium-devtools-v100;4.1.4 +org.seleniumhq.selenium:selenium-devtools-v101;4.1.4 +org.seleniumhq.selenium:selenium-devtools-v85;4.1.4 +org.seleniumhq.selenium:selenium-devtools-v99;4.1.4 +org.seleniumhq.selenium:selenium-edge-driver;4.1.4 +org.seleniumhq.selenium:selenium-firefox-driver;4.1.4 +org.seleniumhq.selenium:selenium-grid;4.1.4 +org.seleniumhq.selenium:selenium-http;4.1.4 +org.seleniumhq.selenium:selenium-ie-driver;4.1.4 +org.seleniumhq.selenium:selenium-java;4.1.4 +org.seleniumhq.selenium:selenium-json;4.1.4 +org.seleniumhq.selenium:selenium-opera-driver;4.1.4 +org.seleniumhq.selenium:selenium-remote-driver;4.1.4 +org.seleniumhq.selenium:selenium-safari-driver;4.1.4 +org.seleniumhq.selenium:selenium-session-map-jdbc;4.1.4 +org.seleniumhq.selenium:selenium-session-map-redis;4.1.4 +org.seleniumhq.selenium:selenium-support;4.1.4 +org.skyscreamer:jsonassert;1.5.1 +org.slf4j:jcl-over-slf4j;1.7.36 +org.slf4j:jul-to-slf4j;1.7.36 +org.slf4j:log4j-over-slf4j;1.7.36 +org.slf4j:slf4j-api;1.7.36 +org.slf4j:slf4j-ext;1.7.36 +org.slf4j:slf4j-jcl;1.7.36 +org.slf4j:slf4j-jdk14;1.7.36 +org.slf4j:slf4j-log4j12;1.7.36 +org.slf4j:slf4j-nop;1.7.36 +org.slf4j:slf4j-simple;1.7.36 +org.springframework.amqp:spring-amqp;2.4.12 +org.springframework.amqp:spring-rabbit;2.4.12 +org.springframework.amqp:spring-rabbit-junit;2.4.12 +org.springframework.amqp:spring-rabbit-stream;2.4.12 +org.springframework.amqp:spring-rabbit-test;2.4.12 +org.springframework.batch:spring-batch-core;4.3.8 +org.springframework.batch:spring-batch-infrastructure;4.3.8 +org.springframework.batch:spring-batch-integration;4.3.8 +org.springframework.batch:spring-batch-test;4.3.8 +org.springframework.boot:spring-boot;2.7.11 +org.springframework.boot:spring-boot-actuator;2.7.11 +org.springframework.boot:spring-boot-actuator-autoconfigure;2.7.11 +org.springframework.boot:spring-boot-autoconfigure;2.7.11 +org.springframework.boot:spring-boot-autoconfigure-processor;2.7.11 +org.springframework.boot:spring-boot-buildpack-platform;2.7.11 +org.springframework.boot:spring-boot-configuration-metadata;2.7.11 +org.springframework.boot:spring-boot-configuration-processor;2.7.11 +org.springframework.boot:spring-boot-dependencies;2.7.11 +org.springframework.boot:spring-boot-devtools;2.7.11 +org.springframework.boot:spring-boot-jarmode-layertools;2.7.11 +org.springframework.boot:spring-boot-loader;2.7.11 +org.springframework.boot:spring-boot-loader-tools;2.7.11 +org.springframework.boot:spring-boot-properties-migrator;2.7.11 +org.springframework.boot:spring-boot-starter;2.7.11 +org.springframework.boot:spring-boot-starter-activemq;2.7.11 +org.springframework.boot:spring-boot-starter-actuator;2.7.11 +org.springframework.boot:spring-boot-starter-amqp;2.7.11 +org.springframework.boot:spring-boot-starter-aop;2.7.11 +org.springframework.boot:spring-boot-starter-artemis;2.7.11 +org.springframework.boot:spring-boot-starter-batch;2.7.11 +org.springframework.boot:spring-boot-starter-cache;2.7.11 +org.springframework.boot:spring-boot-starter-data-cassandra;2.7.11 +org.springframework.boot:spring-boot-starter-data-cassandra-reactive;2.7.11 +org.springframework.boot:spring-boot-starter-data-couchbase;2.7.11 +org.springframework.boot:spring-boot-starter-data-couchbase-reactive;2.7.11 +org.springframework.boot:spring-boot-starter-data-elasticsearch;2.7.11 +org.springframework.boot:spring-boot-starter-data-jdbc;2.7.11 +org.springframework.boot:spring-boot-starter-data-jpa;2.7.11 +org.springframework.boot:spring-boot-starter-data-ldap;2.7.11 +org.springframework.boot:spring-boot-starter-data-mongodb;2.7.11 +org.springframework.boot:spring-boot-starter-data-mongodb-reactive;2.7.11 +org.springframework.boot:spring-boot-starter-data-neo4j;2.7.11 +org.springframework.boot:spring-boot-starter-data-r2dbc;2.7.11 +org.springframework.boot:spring-boot-starter-data-redis;2.7.11 +org.springframework.boot:spring-boot-starter-data-redis-reactive;2.7.11 +org.springframework.boot:spring-boot-starter-data-rest;2.7.11 +org.springframework.boot:spring-boot-starter-freemarker;2.7.11 +org.springframework.boot:spring-boot-starter-graphql;2.7.11 +org.springframework.boot:spring-boot-starter-groovy-templates;2.7.11 +org.springframework.boot:spring-boot-starter-hateoas;2.7.11 +org.springframework.boot:spring-boot-starter-integration;2.7.11 +org.springframework.boot:spring-boot-starter-jdbc;2.7.11 +org.springframework.boot:spring-boot-starter-jersey;2.7.11 +org.springframework.boot:spring-boot-starter-jetty;2.7.11 +org.springframework.boot:spring-boot-starter-jooq;2.7.11 +org.springframework.boot:spring-boot-starter-json;2.7.11 +org.springframework.boot:spring-boot-starter-jta-atomikos;2.7.11 +org.springframework.boot:spring-boot-starter-log4j2;2.7.11 +org.springframework.boot:spring-boot-starter-logging;2.7.11 +org.springframework.boot:spring-boot-starter-mail;2.7.11 +org.springframework.boot:spring-boot-starter-mustache;2.7.11 +org.springframework.boot:spring-boot-starter-oauth2-client;2.7.11 +org.springframework.boot:spring-boot-starter-oauth2-resource-server;2.7.11 +org.springframework.boot:spring-boot-starter-parent;2.7.11 +org.springframework.boot:spring-boot-starter-quartz;2.7.11 +org.springframework.boot:spring-boot-starter-reactor-netty;2.7.11 +org.springframework.boot:spring-boot-starter-rsocket;2.7.11 +org.springframework.boot:spring-boot-starter-security;2.7.11 +org.springframework.boot:spring-boot-starter-test;2.7.11 +org.springframework.boot:spring-boot-starter-thymeleaf;2.7.11 +org.springframework.boot:spring-boot-starter-tomcat;2.7.11 +org.springframework.boot:spring-boot-starter-undertow;2.7.11 +org.springframework.boot:spring-boot-starter-validation;2.7.11 +org.springframework.boot:spring-boot-starter-web;2.7.11 +org.springframework.boot:spring-boot-starter-web-services;2.7.11 +org.springframework.boot:spring-boot-starter-webflux;2.7.11 +org.springframework.boot:spring-boot-starter-websocket;2.7.11 +org.springframework.boot:spring-boot-test;2.7.11 +org.springframework.boot:spring-boot-test-autoconfigure;2.7.11 +org.springframework.cloud:spring-cloud-bus;3.1.2 +org.springframework.cloud:spring-cloud-bus-dependencies;3.1.2 +org.springframework.cloud:spring-cloud-bus-rsocket;3.1.2 +org.springframework.cloud:spring-cloud-circuitbreaker-dependencies;2.1.7 +org.springframework.cloud:spring-cloud-circuitbreaker-resilience4j;2.1.7 +org.springframework.cloud:spring-cloud-circuitbreaker-spring-retry;2.1.7 +org.springframework.cloud:spring-cloud-cloudfoundry-commons;3.1.3 +org.springframework.cloud:spring-cloud-cloudfoundry-dependencies;3.1.3 +org.springframework.cloud:spring-cloud-cloudfoundry-discovery;3.1.3 +org.springframework.cloud:spring-cloud-cloudfoundry-web;3.1.3 +org.springframework.cloud:spring-cloud-commons;3.1.6 +org.springframework.cloud:spring-cloud-commons-dependencies;3.1.6 +org.springframework.cloud:spring-cloud-config-client;3.1.7 +org.springframework.cloud:spring-cloud-config-dependencies;3.1.7 +org.springframework.cloud:spring-cloud-config-monitor;3.1.7 +org.springframework.cloud:spring-cloud-config-server;3.1.7 +org.springframework.cloud:spring-cloud-consul-binder;3.1.3 +org.springframework.cloud:spring-cloud-consul-config;3.1.3 +org.springframework.cloud:spring-cloud-consul-core;3.1.3 +org.springframework.cloud:spring-cloud-consul-dependencies;3.1.3 +org.springframework.cloud:spring-cloud-consul-discovery;3.1.3 +org.springframework.cloud:spring-cloud-context;3.1.6 +org.springframework.cloud:spring-cloud-contract-converters;3.1.7 +org.springframework.cloud:spring-cloud-contract-dependencies;3.1.7 +org.springframework.cloud:spring-cloud-contract-gradle-plugin;3.1.7 +org.springframework.cloud:spring-cloud-contract-maven-plugin;3.1.7 +org.springframework.cloud:spring-cloud-contract-pact;3.1.7 +org.springframework.cloud:spring-cloud-contract-shade;3.1.7 +org.springframework.cloud:spring-cloud-contract-spec;3.1.7 +org.springframework.cloud:spring-cloud-contract-spec-groovy;3.1.7 +org.springframework.cloud:spring-cloud-contract-spec-java;3.1.7 +org.springframework.cloud:spring-cloud-contract-spec-kotlin;3.1.7 +org.springframework.cloud:spring-cloud-contract-stub-runner;3.1.7 +org.springframework.cloud:spring-cloud-contract-stub-runner-boot;3.1.7 +org.springframework.cloud:spring-cloud-contract-verifier;3.1.7 +org.springframework.cloud:spring-cloud-contract-wiremock;3.1.7 +org.springframework.cloud:spring-cloud-dependencies;2021.0.7 +org.springframework.cloud:spring-cloud-function-adapter-aws;3.2.10 +org.springframework.cloud:spring-cloud-function-adapter-azure;3.2.10 +org.springframework.cloud:spring-cloud-function-adapter-gcp;3.2.10 +org.springframework.cloud:spring-cloud-function-adapter-openwhisk;3.2.10 +org.springframework.cloud:spring-cloud-function-context;3.2.10 +org.springframework.cloud:spring-cloud-function-core;3.2.10 +org.springframework.cloud:spring-cloud-function-dependencies;3.2.10 +org.springframework.cloud:spring-cloud-function-deployer;3.2.10 +org.springframework.cloud:spring-cloud-function-grpc;3.2.10 +org.springframework.cloud:spring-cloud-function-grpc-cloudevent-ext;3.2.10 +org.springframework.cloud:spring-cloud-function-kotlin;3.2.10 +org.springframework.cloud:spring-cloud-function-rsocket;3.2.10 +org.springframework.cloud:spring-cloud-function-web;3.2.10 +org.springframework.cloud:spring-cloud-gateway-dependencies;3.1.7 +org.springframework.cloud:spring-cloud-gateway-mvc;3.1.7 +org.springframework.cloud:spring-cloud-gateway-server;3.1.7 +org.springframework.cloud:spring-cloud-gateway-webflux;3.1.7 +org.springframework.cloud:spring-cloud-kubernetes-client-autoconfig;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-client-config;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-client-discovery;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-client-loadbalancer;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-commons;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-dependencies;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-discovery;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-fabric8-autoconfig;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-fabric8-config;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-fabric8-discovery;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-fabric8-istio;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-fabric8-leader;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-fabric8-loadbalancer;2.1.7 +org.springframework.cloud:spring-cloud-kubernetes-test-support;2.1.7 +org.springframework.cloud:spring-cloud-loadbalancer;3.1.6 +org.springframework.cloud:spring-cloud-netflix-dependencies;3.1.6 +org.springframework.cloud:spring-cloud-netflix-eureka-client;3.1.6 +org.springframework.cloud:spring-cloud-netflix-eureka-server;3.1.6 +org.springframework.cloud:spring-cloud-openfeign-core;3.1.7 +org.springframework.cloud:spring-cloud-openfeign-dependencies;3.1.7 +org.springframework.cloud:spring-cloud-sleuth-api;3.1.8 +org.springframework.cloud:spring-cloud-sleuth-autoconfigure;3.1.8 +org.springframework.cloud:spring-cloud-sleuth-brave;3.1.8 +org.springframework.cloud:spring-cloud-sleuth-dependencies;3.1.8 +org.springframework.cloud:spring-cloud-sleuth-instrumentation;3.1.8 +org.springframework.cloud:spring-cloud-sleuth-tests-common;3.1.8 +org.springframework.cloud:spring-cloud-sleuth-zipkin;3.1.8 +org.springframework.cloud:spring-cloud-starter;3.1.6 +org.springframework.cloud:spring-cloud-starter-bootstrap;3.1.6 +org.springframework.cloud:spring-cloud-starter-bus-amqp;3.1.2 +org.springframework.cloud:spring-cloud-starter-bus-kafka;3.1.2 +org.springframework.cloud:spring-cloud-starter-bus-stream;3.1.2 +org.springframework.cloud:spring-cloud-starter-circuitbreaker-reactor-resilience4j;2.1.7 +org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j;2.1.7 +org.springframework.cloud:spring-cloud-starter-cloudfoundry;3.1.3 +org.springframework.cloud:spring-cloud-starter-config;3.1.7 +org.springframework.cloud:spring-cloud-starter-consul;3.1.3 +org.springframework.cloud:spring-cloud-starter-consul-all;3.1.3 +org.springframework.cloud:spring-cloud-starter-consul-bus;3.1.3 +org.springframework.cloud:spring-cloud-starter-consul-config;3.1.3 +org.springframework.cloud:spring-cloud-starter-consul-discovery;3.1.3 +org.springframework.cloud:spring-cloud-starter-contract-stub-runner;3.1.7 +org.springframework.cloud:spring-cloud-starter-contract-stub-runner-jetty;3.1.7 +org.springframework.cloud:spring-cloud-starter-contract-verifier;3.1.7 +org.springframework.cloud:spring-cloud-starter-function-web;3.2.10 +org.springframework.cloud:spring-cloud-starter-function-webflux;3.2.10 +org.springframework.cloud:spring-cloud-starter-gateway;3.1.7 +org.springframework.cloud:spring-cloud-starter-kubernetes-client;2.1.7 +org.springframework.cloud:spring-cloud-starter-kubernetes-client-all;2.1.7 +org.springframework.cloud:spring-cloud-starter-kubernetes-client-config;2.1.7 +org.springframework.cloud:spring-cloud-starter-kubernetes-client-loadbalancer;2.1.7 +org.springframework.cloud:spring-cloud-starter-kubernetes-discoveryclient;2.1.7 +org.springframework.cloud:spring-cloud-starter-kubernetes-fabric8;2.1.7 +org.springframework.cloud:spring-cloud-starter-kubernetes-fabric8-all;2.1.7 +org.springframework.cloud:spring-cloud-starter-kubernetes-fabric8-config;2.1.7 +org.springframework.cloud:spring-cloud-starter-kubernetes-fabric8-loadbalancer;2.1.7 +org.springframework.cloud:spring-cloud-starter-loadbalancer;3.1.6 +org.springframework.cloud:spring-cloud-starter-netflix-eureka-client;3.1.6 +org.springframework.cloud:spring-cloud-starter-netflix-eureka-server;3.1.6 +org.springframework.cloud:spring-cloud-starter-openfeign;3.1.7 +org.springframework.cloud:spring-cloud-starter-sleuth;3.1.8 +org.springframework.cloud:spring-cloud-starter-stream-kafka;3.2.8 +org.springframework.cloud:spring-cloud-starter-stream-rabbit;3.2.8 +org.springframework.cloud:spring-cloud-starter-task;2.4.6 +org.springframework.cloud:spring-cloud-starter-vault-config;3.1.3 +org.springframework.cloud:spring-cloud-starter-zookeeper;3.1.3 +org.springframework.cloud:spring-cloud-starter-zookeeper-all;3.1.3 +org.springframework.cloud:spring-cloud-starter-zookeeper-config;3.1.3 +org.springframework.cloud:spring-cloud-starter-zookeeper-discovery;3.1.3 +org.springframework.cloud:spring-cloud-stream;3.2.8 +org.springframework.cloud:spring-cloud-stream-binder-kafka;3.2.8 +org.springframework.cloud:spring-cloud-stream-binder-kafka-core;3.2.8 +org.springframework.cloud:spring-cloud-stream-binder-kafka-streams;3.2.8 +org.springframework.cloud:spring-cloud-stream-binder-rabbit;3.2.8 +org.springframework.cloud:spring-cloud-stream-binder-rabbit-core;3.2.8 +org.springframework.cloud:spring-cloud-stream-binder-rabbit-test-support;3.2.8 +org.springframework.cloud:spring-cloud-stream-binder-test;3.2.8 +org.springframework.cloud:spring-cloud-stream-dependencies;3.2.8 +org.springframework.cloud:spring-cloud-stream-test-support;3.2.8 +org.springframework.cloud:spring-cloud-task-batch;2.4.6 +org.springframework.cloud:spring-cloud-task-core;2.4.6 +org.springframework.cloud:spring-cloud-task-dependencies;2.4.6 +org.springframework.cloud:spring-cloud-task-stream;2.4.6 +org.springframework.cloud:spring-cloud-test-support;3.1.6 +org.springframework.cloud:spring-cloud-vault-config;3.1.3 +org.springframework.cloud:spring-cloud-vault-config-aws;3.1.3 +org.springframework.cloud:spring-cloud-vault-config-consul;3.1.3 +org.springframework.cloud:spring-cloud-vault-config-databases;3.1.3 +org.springframework.cloud:spring-cloud-vault-config-rabbitmq;3.1.3 +org.springframework.cloud:spring-cloud-vault-dependencies;3.1.3 +org.springframework.cloud:spring-cloud-zookeeper-config;3.1.3 +org.springframework.cloud:spring-cloud-zookeeper-core;3.1.3 +org.springframework.cloud:spring-cloud-zookeeper-dependencies;3.1.3 +org.springframework.cloud:spring-cloud-zookeeper-discovery;3.1.3 +org.springframework.credhub:spring-credhub-core;2.1.1.RELEASE +org.springframework.data:spring-data-bom;2021.2.11 +org.springframework.data:spring-data-cassandra;3.4.11 +org.springframework.data:spring-data-commons;2.7.11 +org.springframework.data:spring-data-couchbase;4.4.11 +org.springframework.data:spring-data-elasticsearch;4.4.11 +org.springframework.data:spring-data-envers;2.7.11 +org.springframework.data:spring-data-geode;2.7.11 +org.springframework.data:spring-data-jdbc;2.4.11 +org.springframework.data:spring-data-jpa;2.7.11 +org.springframework.data:spring-data-keyvalue;2.7.11 +org.springframework.data:spring-data-ldap;2.7.11 +org.springframework.data:spring-data-mongodb;3.4.11 +org.springframework.data:spring-data-neo4j;6.3.11 +org.springframework.data:spring-data-r2dbc;1.5.11 +org.springframework.data:spring-data-redis;2.7.11 +org.springframework.data:spring-data-relational;2.4.11 +org.springframework.data:spring-data-rest-core;3.7.11 +org.springframework.data:spring-data-rest-hal-explorer;3.7.11 +org.springframework.data:spring-data-rest-webmvc;3.7.11 +org.springframework.graphql:spring-graphql;1.0.4 +org.springframework.graphql:spring-graphql-test;1.0.4 +org.springframework.hateoas:spring-hateoas;1.5.4 +org.springframework.integration:spring-integration-amqp;5.5.17 +org.springframework.integration:spring-integration-bom;5.5.17 +org.springframework.integration:spring-integration-core;5.5.17 +org.springframework.integration:spring-integration-event;5.5.17 +org.springframework.integration:spring-integration-feed;5.5.17 +org.springframework.integration:spring-integration-file;5.5.17 +org.springframework.integration:spring-integration-ftp;5.5.17 +org.springframework.integration:spring-integration-gemfire;5.5.17 +org.springframework.integration:spring-integration-groovy;5.5.17 +org.springframework.integration:spring-integration-http;5.5.17 +org.springframework.integration:spring-integration-ip;5.5.17 +org.springframework.integration:spring-integration-jdbc;5.5.17 +org.springframework.integration:spring-integration-jms;5.5.17 +org.springframework.integration:spring-integration-jmx;5.5.17 +org.springframework.integration:spring-integration-jpa;5.5.17 +org.springframework.integration:spring-integration-kafka;5.5.17 +org.springframework.integration:spring-integration-mail;5.5.17 +org.springframework.integration:spring-integration-mongodb;5.5.17 +org.springframework.integration:spring-integration-mqtt;5.5.17 +org.springframework.integration:spring-integration-r2dbc;5.5.17 +org.springframework.integration:spring-integration-redis;5.5.17 +org.springframework.integration:spring-integration-rmi;5.5.17 +org.springframework.integration:spring-integration-rsocket;5.5.17 +org.springframework.integration:spring-integration-scripting;5.5.17 +org.springframework.integration:spring-integration-security;5.5.17 +org.springframework.integration:spring-integration-sftp;5.5.17 +org.springframework.integration:spring-integration-stomp;5.5.17 +org.springframework.integration:spring-integration-stream;5.5.17 +org.springframework.integration:spring-integration-syslog;5.5.17 +org.springframework.integration:spring-integration-test;5.5.17 +org.springframework.integration:spring-integration-test-support;5.5.17 +org.springframework.integration:spring-integration-webflux;5.5.17 +org.springframework.integration:spring-integration-websocket;5.5.17 +org.springframework.integration:spring-integration-ws;5.5.17 +org.springframework.integration:spring-integration-xml;5.5.17 +org.springframework.integration:spring-integration-xmpp;5.5.17 +org.springframework.integration:spring-integration-zeromq;5.5.17 +org.springframework.integration:spring-integration-zookeeper;5.5.17 +org.springframework.kafka:spring-kafka;2.8.11 +org.springframework.kafka:spring-kafka-test;2.8.11 +org.springframework.ldap:spring-ldap-core;2.4.1 +org.springframework.ldap:spring-ldap-core-tiger;2.4.1 +org.springframework.ldap:spring-ldap-ldif-core;2.4.1 +org.springframework.ldap:spring-ldap-odm;2.4.1 +org.springframework.ldap:spring-ldap-test;2.4.1 +org.springframework.restdocs:spring-restdocs-asciidoctor;2.0.7.RELEASE +org.springframework.restdocs:spring-restdocs-core;2.0.7.RELEASE +org.springframework.restdocs:spring-restdocs-mockmvc;2.0.7.RELEASE +org.springframework.restdocs:spring-restdocs-restassured;2.0.7.RELEASE +org.springframework.restdocs:spring-restdocs-webtestclient;2.0.7.RELEASE +org.springframework.retry:spring-retry;1.3.4 +org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure;2.5.2 +org.springframework.security:spring-security-acl;5.7.8 +org.springframework.security:spring-security-aspects;5.7.8 +org.springframework.security:spring-security-bom;5.7.8 +org.springframework.security:spring-security-cas;5.7.8 +org.springframework.security:spring-security-config;5.7.8 +org.springframework.security:spring-security-core;5.7.8 +org.springframework.security:spring-security-crypto;5.7.8 +org.springframework.security:spring-security-data;5.7.8 +org.springframework.security:spring-security-ldap;5.7.8 +org.springframework.security:spring-security-messaging;5.7.8 +org.springframework.security:spring-security-oauth2-client;5.7.8 +org.springframework.security:spring-security-oauth2-core;5.7.8 +org.springframework.security:spring-security-oauth2-jose;5.7.8 +org.springframework.security:spring-security-oauth2-resource-server;5.7.8 +org.springframework.security:spring-security-openid;5.7.8 +org.springframework.security:spring-security-remoting;5.7.8 +org.springframework.security:spring-security-rsa;1.0.11.RELEASE +org.springframework.security:spring-security-rsocket;5.7.8 +org.springframework.security:spring-security-saml2-service-provider;5.7.8 +org.springframework.security:spring-security-taglibs;5.7.8 +org.springframework.security:spring-security-test;5.7.8 +org.springframework.security:spring-security-web;5.7.8 +org.springframework.session:spring-session-bom;2021.2.1 +org.springframework.session:spring-session-core;2.7.1 +org.springframework.session:spring-session-data-geode;2.7.1 +org.springframework.session:spring-session-data-mongodb;2.7.1 +org.springframework.session:spring-session-data-redis;2.7.1 +org.springframework.session:spring-session-hazelcast;2.7.1 +org.springframework.session:spring-session-jdbc;2.7.1 +org.springframework.vault:spring-vault-core;2.3.2 +org.springframework.ws:spring-ws-core;3.1.6 +org.springframework.ws:spring-ws-security;3.1.6 +org.springframework.ws:spring-ws-support;3.1.6 +org.springframework.ws:spring-ws-test;3.1.6 +org.springframework.ws:spring-xml;3.1.6 +org.springframework:spring-aop;5.3.27 +org.springframework:spring-aspects;5.3.27 +org.springframework:spring-beans;5.3.27 +org.springframework:spring-context;5.3.27 +org.springframework:spring-context-indexer;5.3.27 +org.springframework:spring-context-support;5.3.27 +org.springframework:spring-core;5.3.27 +org.springframework:spring-expression;5.3.27 +org.springframework:spring-framework-bom;5.3.27 +org.springframework:spring-instrument;5.3.27 +org.springframework:spring-jcl;5.3.27 +org.springframework:spring-jdbc;5.3.27 +org.springframework:spring-jms;5.3.27 +org.springframework:spring-messaging;5.3.27 +org.springframework:spring-orm;5.3.27 +org.springframework:spring-oxm;5.3.27 +org.springframework:spring-r2dbc;5.3.27 +org.springframework:spring-test;5.3.27 +org.springframework:spring-tx;5.3.27 +org.springframework:spring-web;5.3.27 +org.springframework:spring-webflux;5.3.27 +org.springframework:spring-webmvc;5.3.27 +org.springframework:spring-websocket;5.3.27 +org.thymeleaf.extras:thymeleaf-extras-java8time;3.0.4.RELEASE +org.thymeleaf.extras:thymeleaf-extras-springsecurity5;3.0.5.RELEASE +org.thymeleaf:thymeleaf;3.0.15.RELEASE +org.thymeleaf:thymeleaf-spring5;3.0.15.RELEASE +org.tmatesoft.svnkit:svnkit;1.10.1 +org.webjars:webjars-locator-core;0.50 +org.xerial:sqlite-jdbc;3.36.0.3 +org.xmlunit:xmlunit-assertj;2.9.1 +org.xmlunit:xmlunit-assertj3;2.9.1 +org.xmlunit:xmlunit-core;2.9.1 +org.xmlunit:xmlunit-legacy;2.9.1 +org.xmlunit:xmlunit-matchers;2.9.1 +org.xmlunit:xmlunit-placeholders;2.9.1 +org.yaml:snakeyaml;1.30 +redis.clients:jedis;3.8.0 +wsdl4j:wsdl4j;1.6.3 diff --git a/sdk/spring/scripts/version_util.py b/sdk/spring/scripts/version_util.py new file mode 100644 index 000000000000..042162ee1c95 --- /dev/null +++ b/sdk/spring/scripts/version_util.py @@ -0,0 +1,40 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import unittest +from itertools import takewhile + + +def version_greater_than(version1, version2): + v1 = version1.split('.') + v2 = version2.split('.') + len_1 = len(v1) + len_2 = len(v2) + max_len = max(len_1, len_1) + for i in range(max_len): + if i < len_1 and i < len_2: + int_1 = int('0' + ''.join(takewhile(str.isdigit, v1[i]))) + int_2 = int('0' + ''.join(takewhile(str.isdigit, v2[i]))) + if int_1 != int_2: + return int_1 > int_2 + elif i < len_1: + return True + else: + return False + return False + + +class Tests(unittest.TestCase): + def test_version_greater_than(self): + self.assertEqual(version_greater_than('1', '2'), False) + self.assertEqual(version_greater_than('2', '1'), True) + self.assertEqual(version_greater_than('1.0', '2'), False) + self.assertEqual(version_greater_than('2.0', '1'), True) + self.assertEqual(version_greater_than('1.1', '1'), True) + self.assertEqual(version_greater_than('1', '1.1'), False) + self.assertEqual(version_greater_than('1.0-RELEASE', '1.1'), False) + self.assertEqual(version_greater_than('1.1-RELEASE', '1'), True) + self.assertEqual(version_greater_than('1.1-RELEASE', '1.0'), True) + self.assertEqual(version_greater_than('1.1-RELEASE', '1.0.1'), True) + self.assertEqual(version_greater_than('1.1-RELEASE', '1.0.1-RELEASE'), True) + self.assertEqual(version_greater_than('1.1-RELEASE', '1.1.1-RELEASE'), False) diff --git a/sdk/storage/azure-storage-blob-batch/assets.json b/sdk/storage/azure-storage-blob-batch/assets.json new file mode 100644 index 000000000000..ba14e26b5311 --- /dev/null +++ b/sdk/storage/azure-storage-blob-batch/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "java", + "TagPrefix": "java/storage/azure-storage-blob-batch", + "Tag": "java/storage/azure-storage-blob-batch_469f26eff9" +} diff --git a/sdk/storage/azure-storage-blob-cryptography/assets.json b/sdk/storage/azure-storage-blob-cryptography/assets.json new file mode 100644 index 000000000000..102a40f2d374 --- /dev/null +++ b/sdk/storage/azure-storage-blob-cryptography/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "java", + "TagPrefix": "java/storage/azure-storage-blob-cryptography", + "Tag": "java/storage/azure-storage-blob-cryptography_4846eec0ff" +} diff --git a/sdk/storage/azure-storage-blob-nio/assets.json b/sdk/storage/azure-storage-blob-nio/assets.json new file mode 100644 index 000000000000..c262f7ebafc7 --- /dev/null +++ b/sdk/storage/azure-storage-blob-nio/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "java", + "TagPrefix": "java/storage/azure-storage-blob-nio", + "Tag": "java/storage/azure-storage-blob-nio_b2a0ce219e" +} diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/HttpFaultInjectingTests.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/HttpFaultInjectingTests.groovy new file mode 100644 index 000000000000..7fa4ef0549e6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/HttpFaultInjectingTests.groovy @@ -0,0 +1,212 @@ +package com.azure.storage.blob.specialized + +import com.azure.core.http.HttpClient +import com.azure.core.http.HttpClientProvider +import com.azure.core.http.HttpHeaderName +import com.azure.core.http.HttpRequest +import com.azure.core.http.HttpResponse +import com.azure.core.test.utils.TestUtils +import com.azure.core.util.BinaryData +import com.azure.core.util.Context +import com.azure.core.util.HttpClientOptions +import com.azure.core.util.UrlBuilder +import com.azure.core.util.logging.ClientLogger +import com.azure.storage.blob.APISpec +import com.azure.storage.blob.BlobClientBuilder +import com.azure.storage.common.implementation.Constants +import com.azure.storage.common.test.shared.TestHttpClientType +import com.azure.storage.common.test.shared.extensions.LiveOnly +import reactor.core.publisher.Mono +import spock.lang.IgnoreIf +import spock.util.environment.OperatingSystem + +import java.nio.file.Files +import java.time.Duration +import java.util.concurrent.ThreadLocalRandom +import java.util.concurrent.atomic.AtomicInteger +/** + * Set of tests that use HTTP fault injecting to simulate scenarios where the network has random errors. + */ +@LiveOnly +// macOS has known issues running HTTP fault injector, change this once +// https://github.com/Azure/azure-sdk-tools/pull/6216 is resolved +@IgnoreIf({ OperatingSystem.current.family == OperatingSystem.Family.MAC_OS }) +class HttpFaultInjectingTests extends APISpec { + private static final def LOGGER = new ClientLogger(HttpFaultInjectingTests.class) + private static final def UPSTREAM_URI_HEADER = HttpHeaderName.fromString("X-Upstream-Base-Uri") + private static final def HTTP_FAULT_INJECTOR_RESPONSE_HEADER + = HttpHeaderName.fromString("x-ms-faultinjector-response-option") + + /** + * Tests downloading to file with fault injection. + * + * This test will upload a single blob of about 9MB and then download it in parallel 500 times. Each download will + * have its file contents compared to the original blob data. The test only cares about files that were properly + * downloaded, if a download fails with a network error it will be ignored. A requirement of 90% of files being + * successfully downloaded is also a requirement to prevent a case where most files failed to download and passing, + * hiding a true issue. + */ + def "download to file with fault injection"() { + setup: + def realFileBytes = new byte[9 * Constants.MB - 1] + ThreadLocalRandom.current().nextBytes(realFileBytes) + + def blobName = generateBlobName() + cc.getBlobClient(blobName).upload(BinaryData.fromBytes(realFileBytes), true) + + def downloadClient = new BlobClientBuilder() + .connectionString(environment.primaryAccount.connectionString) + .containerName(cc.getBlobContainerName()) + .blobName(blobName) + .httpClient(new HttpFaultInjectingHttpClient(getFaultInjectingWrappedHttpClient())) + .buildClient() + + def files = new ArrayList(500) + for (def i = 0; i < 500; i++) { + def file = File.createTempFile(UUID.randomUUID().toString() + i, ".txt") + file.deleteOnExit() + files.add(file) + } + def successCount = new AtomicInteger() + + when: + files.stream().parallel().forEach { + def validateFile = true + try { + downloadClient.downloadToFile(it.getAbsolutePath(), true) + } catch (Exception ex) { + // Don't let network exceptions fail the download + LOGGER.atWarning() + .log(() -> "Failed to complete download, target download file: " + it.getAbsolutePath(), ex) + validateFile = false + } + + if (validateFile) { + def actualFileBytes = Files.readAllBytes(it.toPath()) + TestUtils.assertArraysEqual(realFileBytes, actualFileBytes) + successCount.incrementAndGet() + } + + Files.deleteIfExists(it.toPath()) + } + + then: + successCount.get() >= 450 + + cleanup: + files.forEach {Files.deleteIfExists(it.toPath()) } + } + + def getFaultInjectingWrappedHttpClient() { + switch (environment.httpClientType) { + case TestHttpClientType.NETTY: + return HttpClient.createDefault(new HttpClientOptions() + .readTimeout(Duration.ofSeconds(5)) + .responseTimeout(Duration.ofSeconds(5)) + .setHttpClientProvider(Class.forName("com.azure.core.http.netty.NettyAsyncHttpClientProvider") as Class)) + + case TestHttpClientType.OK_HTTP: + return HttpClient.createDefault(new HttpClientOptions() + .readTimeout(Duration.ofSeconds(5)) + .responseTimeout(Duration.ofSeconds(5)) + .setHttpClientProvider(Class.forName("com.azure.core.http.okhttp.OkHttpAsyncClientProvider") as Class)) + + default: + throw new IllegalArgumentException("Unknown http client type: " + environment.httpClientType) + } + } + + // For now a local implementation is here in azure-storage-blob until this is released in azure-core-test. + // Since this is a local definition with a clear set of configurations everything is simplified. + private static final class HttpFaultInjectingHttpClient implements HttpClient { + private final HttpClient wrappedHttpClient + + HttpFaultInjectingHttpClient(HttpClient wrappedHttpClient) { + this.wrappedHttpClient = wrappedHttpClient + } + + @Override + Mono send(HttpRequest request) { + return send(request, Context.NONE) + } + + @Override + Mono send(HttpRequest request, Context context) { + URL originalUrl = request.getUrl() + request.setHeader(UPSTREAM_URI_HEADER, originalUrl.toString()).setUrl(rewriteUrl(originalUrl)) + String faultType = faultInjectorHandling() + request.setHeader(HTTP_FAULT_INJECTOR_RESPONSE_HEADER, faultType) + + return wrappedHttpClient.send(request, context) + .map(response -> { + HttpRequest request1 = response.getRequest() + request1.getHeaders().remove(UPSTREAM_URI_HEADER) + request1.setUrl(originalUrl) + + return response + }) + } + + @Override + HttpResponse sendSync(HttpRequest request, Context context) { + URL originalUrl = request.getUrl() + request.setHeader(UPSTREAM_URI_HEADER, originalUrl.toString()).setUrl(rewriteUrl(originalUrl)) + String faultType = faultInjectorHandling() + request.setHeader(HTTP_FAULT_INJECTOR_RESPONSE_HEADER, faultType) + + HttpResponse response = wrappedHttpClient.sendSync(request, context) + response.getRequest().setUrl(originalUrl) + response.getRequest().getHeaders().remove(UPSTREAM_URI_HEADER) + + return response + } + + private static URL rewriteUrl(URL originalUrl) { + try { + return UrlBuilder.parse(originalUrl) + .setScheme("http") + .setHost("localhost") + .setPort(7777) + .toUrl() + } catch (MalformedURLException e) { + throw new RuntimeException(e) + } + } + + private static String faultInjectorHandling() { + // f: Full response + // p: Partial Response (full headers, 50% of body), then wait indefinitely + // pc: Partial Response (full headers, 50% of body), then close (TCP FIN) + // pa: Partial Response (full headers, 50% of body), then abort (TCP RST) + // pn: Partial Response (full headers, 50% of body), then finish normally + // n: No response, then wait indefinitely + // nc: No response, then close (TCP FIN) + // na: No response, then abort (TCP RST) + def random = ThreadLocalRandom.current().nextDouble() + def choice = (int) (random * 100) + + if (choice >= 25) { + // 75% of requests complete without error. + return "f" + } else if (choice >= 1) { + if (random <= 0.34D) { + return "n" + } else if (random <= 0.67D) { + return "nc" + } else { + return "na" + } + } else { + if (random <= 0.25D) { + return "p" + } else if (random <= 0.50D) { + return "pc" + } else if (random <= 0.75D) { + return "pa" + } else { + return "pn" + } + } + } + } +} diff --git a/sdk/storage/azure-storage-queue/assets.json b/sdk/storage/azure-storage-queue/assets.json new file mode 100644 index 000000000000..2dac58cb0592 --- /dev/null +++ b/sdk/storage/azure-storage-queue/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "java", + "TagPrefix": "java/storage/azure-storage-queue", + "Tag": "java/storage/azure-storage-queue_b7c7493aab" +} diff --git a/sdk/tables/azure-data-tables/assets.json b/sdk/tables/azure-data-tables/assets.json new file mode 100644 index 000000000000..9992ddc261f7 --- /dev/null +++ b/sdk/tables/azure-data-tables/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "java", + "TagPrefix": "java/tables/azure-data-tables", + "Tag": "java/tables/azure-data-tables_a3e59c4ede" +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/assets.json b/sdk/textanalytics/azure-ai-textanalytics/assets.json new file mode 100644 index 000000000000..f4ed7d36a2aa --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "java", + "TagPrefix": "java/textanalytics/azure-ai-textanalytics", + "Tag": "java/textanalytics/azure-ai-textanalytics_20f07a95c8" +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AbstractiveSummaryUtilClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AbstractiveSummaryUtilClient.java new file mode 100644 index 000000000000..11cafc46c72d --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AbstractiveSummaryUtilClient.java @@ -0,0 +1,418 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.implementation.AbstractiveSummaryOperationDetailPropertiesHelper; +import com.azure.ai.textanalytics.implementation.AbstractiveSummaryResultCollectionPropertiesHelper; +import com.azure.ai.textanalytics.implementation.AnalyzeTextsImpl; +import com.azure.ai.textanalytics.implementation.TextAnalyticsExceptionPropertiesHelper; +import com.azure.ai.textanalytics.implementation.Utility; +import com.azure.ai.textanalytics.implementation.models.AbstractiveSummarizationLROResult; +import com.azure.ai.textanalytics.implementation.models.AbstractiveSummarizationLROTask; +import com.azure.ai.textanalytics.implementation.models.AbstractiveSummarizationResult; +import com.azure.ai.textanalytics.implementation.models.AbstractiveSummarizationTaskParameters; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextJobState; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextJobsInput; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLROResult; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLROTask; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextsCancelJobHeaders; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextsSubmitJobHeaders; +import com.azure.ai.textanalytics.implementation.models.Error; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; +import com.azure.ai.textanalytics.implementation.models.MultiLanguageAnalysisInput; +import com.azure.ai.textanalytics.implementation.models.RequestStatistics; +import com.azure.ai.textanalytics.implementation.models.State; +import com.azure.ai.textanalytics.implementation.models.StringIndexType; +import com.azure.ai.textanalytics.models.AbstractiveSummaryOperationDetail; +import com.azure.ai.textanalytics.models.AbstractiveSummaryOptions; +import com.azure.ai.textanalytics.models.TextAnalyticsError; +import com.azure.ai.textanalytics.models.TextAnalyticsException; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.ai.textanalytics.util.AbstractiveSummaryPagedFlux; +import com.azure.ai.textanalytics.util.AbstractiveSummaryPagedIterable; +import com.azure.ai.textanalytics.util.AbstractiveSummaryResultCollection; +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.ResponseBase; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.IterableStream; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.SyncPoller; +import reactor.core.publisher.Mono; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.function.BiFunction; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static com.azure.ai.textanalytics.implementation.Utility.DEFAULT_POLL_INTERVAL; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; +import static com.azure.ai.textanalytics.implementation.Utility.getHttpResponseException; +import static com.azure.ai.textanalytics.implementation.Utility.getNotNullContext; +import static com.azure.ai.textanalytics.implementation.Utility.getShowStatsContinuesToken; +import static com.azure.ai.textanalytics.implementation.Utility.getSkipContinuesToken; +import static com.azure.ai.textanalytics.implementation.Utility.getTopContinuesToken; +import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; +import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.parseNextLink; +import static com.azure.ai.textanalytics.implementation.Utility.parseOperationId; +import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; +import static com.azure.ai.textanalytics.implementation.Utility.toAbstractiveSummaryResultCollection; +import static com.azure.ai.textanalytics.implementation.Utility.toMultiLanguageInput; +import static com.azure.ai.textanalytics.implementation.models.State.CANCELLED; +import static com.azure.ai.textanalytics.implementation.models.State.NOT_STARTED; +import static com.azure.ai.textanalytics.implementation.models.State.RUNNING; +import static com.azure.ai.textanalytics.implementation.models.State.SUCCEEDED; +import static com.azure.core.util.FluxUtil.monoError; + +/** + * Helper class for managing abstractive summarization endpoints. + */ +class AbstractiveSummaryUtilClient { + private final AnalyzeTextsImpl service; + private final TextAnalyticsServiceVersion serviceVersion; + + private static final ClientLogger LOGGER = new ClientLogger(AbstractiveSummaryUtilClient.class); + + AbstractiveSummaryUtilClient(AnalyzeTextsImpl service, TextAnalyticsServiceVersion serviceVersion) { + this.service = service; + this.serviceVersion = serviceVersion; + } + + PollerFlux abstractiveSummaryAsync( + Iterable documents, AbstractiveSummaryOptions options, Context context) { + try { + checkUnsupportedServiceVersionForAbstractiveSummary(); + inputDocumentsValidation(documents); + options = getNotNullAbstractiveSummaryOptions(options); + final Context finalContext = getNotNullContext(context); + final boolean finalIncludeStatistics = options.isIncludeStatistics(); + + return new PollerFlux<>( + DEFAULT_POLL_INTERVAL, + activationOperation( + service.submitJobWithResponseAsync( + new AnalyzeTextJobsInput() + .setDisplayName(options.getDisplayName()) + .setAnalysisInput( + new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))) + .setTasks(Arrays.asList( + new AbstractiveSummarizationLROTask().setParameters( + new AbstractiveSummarizationTaskParameters() + .setStringIndexType(StringIndexType.UTF16CODE_UNIT) + .setSentenceCount(options.getSentenceCount()) + .setModelVersion(options.getModelVersion()) + .setLoggingOptOut(options.isServiceLogsDisabled()) + ))), + finalContext) + .map(responseBase -> { + final AbstractiveSummaryOperationDetail operationDetail = + new AbstractiveSummaryOperationDetail(); + AbstractiveSummaryOperationDetailPropertiesHelper.setOperationId(operationDetail, + parseOperationId(responseBase.getDeserializedHeaders().getOperationLocation())); + return operationDetail; + }) + ), + pollingOperation( + operationId -> service.jobStatusWithResponseAsync(operationId, + finalIncludeStatistics, null, null, finalContext)), + cancelOperation( + operationId -> service.cancelJobWithResponseAsync(operationId, finalContext)), + fetchingOperation( + operationId -> Mono.just(getAbstractiveSummaryPagedFlux(operationId, null, null, + finalIncludeStatistics, finalContext))) + ); + } catch (RuntimeException ex) { + return PollerFlux.error(ex); + } + } + + SyncPoller abstractiveSummaryPagedIterable( + Iterable documents, AbstractiveSummaryOptions options, Context context) { + try { + checkUnsupportedServiceVersionForAbstractiveSummary(); + inputDocumentsValidation(documents); + options = getNotNullAbstractiveSummaryOptions(options); + final Context finalContext = enableSyncRestProxy(getNotNullContext(context)); + final boolean finalIncludeStatistics = options.isIncludeStatistics(); + final String displayName = options.getDisplayName(); + + final AbstractiveSummarizationLROTask task = new AbstractiveSummarizationLROTask().setParameters( + new AbstractiveSummarizationTaskParameters() + .setStringIndexType(StringIndexType.UTF16CODE_UNIT) + .setSentenceCount(options.getSentenceCount()) + .setModelVersion(options.getModelVersion()) + .setLoggingOptOut(options.isServiceLogsDisabled())); + return SyncPoller.createPoller( + DEFAULT_POLL_INTERVAL, + cxt -> new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, + activationOperationSync(documents, task, displayName, finalContext).apply(cxt)), + pollingOperationSync(operationId -> service.jobStatusWithResponse(operationId, + finalIncludeStatistics, null, null, finalContext)), + cancelOperationSync(operationId -> service.cancelJobWithResponse(operationId, finalContext)), + fetchingOperationIterable( + operationId -> getAbstractiveSummaryPagedIterable(operationId, null, null, + finalIncludeStatistics, finalContext))); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError(getHttpResponseException(ex)); + } + } + + AbstractiveSummaryPagedFlux getAbstractiveSummaryPagedFlux( + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + return new AbstractiveSummaryPagedFlux( + () -> (continuationToken, pageSize) -> + getPagedResult(continuationToken, operationId, top, skip, showStats, context).flux()); + } + + AbstractiveSummaryPagedIterable getAbstractiveSummaryPagedIterable( + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + return new AbstractiveSummaryPagedIterable( + () -> (continuationToken, pageSize) -> + getPagedResultSync(continuationToken, operationId, top, skip, showStats, context)); + } + + Mono> getPagedResult(String continuationToken, + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + try { + if (continuationToken != null) { + final Map continuationTokenMap = parseNextLink(continuationToken); + top = getTopContinuesToken(continuationTokenMap); + skip = getSkipContinuesToken(continuationTokenMap); + showStats = getShowStatsContinuesToken(continuationTokenMap); + } + return service.jobStatusWithResponseAsync(operationId, showStats, top, skip, context) + .map(this::toAbstractiveSummaryResultCollectionPagedResponse) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + } catch (RuntimeException ex) { + return monoError(LOGGER, ex); + } + } + + PagedResponse getPagedResultSync(String continuationToken, + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + if (continuationToken != null) { + final Map continuationTokenMap = parseNextLink(continuationToken); + top = getTopContinuesToken(continuationTokenMap); + skip = getSkipContinuesToken(continuationTokenMap); + showStats = getShowStatsContinuesToken(continuationTokenMap); + } + return toAbstractiveSummaryResultCollectionPagedResponse( + service.jobStatusWithResponse(operationId, showStats, top, skip, context)); + } + + private PagedResponse toAbstractiveSummaryResultCollectionPagedResponse( + Response response) { + + final AnalyzeTextJobState jobState = response.getValue(); + final List lroResults = jobState.getTasks().getItems(); + + final AbstractiveSummarizationResult abstractiveSummarizationResult; + final AnalyzeTextLROResult lroResult = lroResults.get(0); + if (lroResult instanceof AbstractiveSummarizationLROResult) { + AbstractiveSummarizationLROResult abstractiveSummarizationLROResult = + (AbstractiveSummarizationLROResult) lroResults.get(0); + abstractiveSummarizationResult = abstractiveSummarizationLROResult.getResults(); + } else { + throw LOGGER.logExceptionAsError( + new RuntimeException("Invalid class type returned: " + lroResult.getClass().getName())); + } + + final AbstractiveSummaryResultCollection abstractiveSummaryResultCollection = + toAbstractiveSummaryResultCollection(abstractiveSummarizationResult); + final RequestStatistics requestStatistics = abstractiveSummarizationResult.getStatistics(); + if (requestStatistics != null) { + final TextDocumentBatchStatistics batchStatistic = new TextDocumentBatchStatistics( + requestStatistics.getDocumentsCount(), requestStatistics.getValidDocumentsCount(), + requestStatistics.getErroneousDocumentsCount(), requestStatistics.getTransactionsCount()); + AbstractiveSummaryResultCollectionPropertiesHelper.setStatistics( + abstractiveSummaryResultCollection, batchStatistic); + } + + final List errors = jobState.getErrors(); + + if (!CoreUtils.isNullOrEmpty(errors)) { + final TextAnalyticsException textAnalyticsException = new TextAnalyticsException( + "Abstractive summary operation failed", null, null); + final IterableStream textAnalyticsErrors = + IterableStream.of(errors.stream().map(Utility::toTextAnalyticsError).collect(Collectors.toList())); + TextAnalyticsExceptionPropertiesHelper.setErrors(textAnalyticsException, textAnalyticsErrors); + throw LOGGER.logExceptionAsError(textAnalyticsException); + } + + return new PagedResponseBase( + response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + Arrays.asList(abstractiveSummaryResultCollection), + jobState.getNextLink(), + null); + } + + // Activation operation + private Function, + Mono> activationOperation( + Mono operationResult) { + return pollingContext -> { + try { + return operationResult.onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + } catch (RuntimeException ex) { + return monoError(LOGGER, ex); + } + }; + } + + private Function, AbstractiveSummaryOperationDetail> + activationOperationSync(Iterable documents, AnalyzeTextLROTask task, String displayName, + Context context) { + return pollingContext -> { + final ResponseBase analyzeResponse = + service.submitJobWithResponse( + new AnalyzeTextJobsInput() + .setDisplayName(displayName) + .setAnalysisInput(new MultiLanguageAnalysisInput() + .setDocuments(toMultiLanguageInput(documents))) + .setTasks(Arrays.asList(task)), + context); + final AbstractiveSummaryOperationDetail operationDetail = new AbstractiveSummaryOperationDetail(); + AbstractiveSummaryOperationDetailPropertiesHelper.setOperationId(operationDetail, + parseOperationId(analyzeResponse.getDeserializedHeaders().getOperationLocation())); + return operationDetail; + }; + } + + // Polling operation + private Function, + Mono>> pollingOperation( + Function>> pollingFunction) { + return pollingContext -> { + try { + final PollResponse operationResultPollResponse = + pollingContext.getLatestResponse(); + final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); + return pollingFunction.apply(operationId) + .flatMap(modelResponse -> + Mono.just(processAnalyzeTextModelResponse(modelResponse, operationResultPollResponse))) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + } catch (RuntimeException ex) { + return monoError(LOGGER, ex); + } + }; + } + + private Function, + PollResponse> pollingOperationSync( + Function> pollingFunction) { + return pollingContext -> { + final PollResponse operationResultPollResponse = + pollingContext.getLatestResponse(); + final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); + return processAnalyzeTextModelResponse(pollingFunction.apply(operationId), operationResultPollResponse); + }; + } + + // Fetching operation + private Function, Mono> + fetchingOperation(Function> fetchingFunction) { + return pollingContext -> { + try { + final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); + return fetchingFunction.apply(resultUuid); + } catch (RuntimeException ex) { + return monoError(LOGGER, ex); + } + }; + } + + private Function, AbstractiveSummaryPagedIterable> + fetchingOperationIterable(final Function fetchingFunction) { + return pollingContext -> { + final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); + return fetchingFunction.apply(resultUuid); + }; + } + + // Cancel operation + private BiFunction, + PollResponse, + Mono> cancelOperation( + Function>> cancelFunction) { + return (activationResponse, pollingContext) -> { + final UUID resultUuid = UUID.fromString(pollingContext.getValue().getOperationId()); + try { + return cancelFunction.apply(resultUuid) + .map(cancelJobResponse -> { + final AbstractiveSummaryOperationDetail operationResult = new AbstractiveSummaryOperationDetail(); + AbstractiveSummaryOperationDetailPropertiesHelper.setOperationId(operationResult, + parseOperationId(cancelJobResponse.getDeserializedHeaders().getOperationLocation())); + return operationResult; + }).onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + } catch (RuntimeException ex) { + return monoError(LOGGER, ex); + } + }; + } + + private BiFunction, + PollResponse, + AbstractiveSummaryOperationDetail> cancelOperationSync( + Function> cancelFunction) { + return (activationResponse, pollingContext) -> { + final UUID resultUuid = UUID.fromString(pollingContext.getValue().getOperationId()); + ResponseBase cancelJobResponse = cancelFunction.apply(resultUuid); + final AbstractiveSummaryOperationDetail operationResult = new AbstractiveSummaryOperationDetail(); + AbstractiveSummaryOperationDetailPropertiesHelper.setOperationId(operationResult, + parseOperationId(cancelJobResponse.getDeserializedHeaders().getOperationLocation())); + return operationResult; + }; + } + + private PollResponse processAnalyzeTextModelResponse( + Response analyzeOperationResultResponse, + PollResponse operationResultPollResponse) { + LongRunningOperationStatus status; + State state = analyzeOperationResultResponse.getValue().getStatus(); + if (NOT_STARTED.equals(state) || RUNNING.equals(state)) { + status = LongRunningOperationStatus.IN_PROGRESS; + } else if (SUCCEEDED.equals(state)) { + status = LongRunningOperationStatus.SUCCESSFULLY_COMPLETED; + } else if (CANCELLED.equals(state)) { + status = LongRunningOperationStatus.USER_CANCELLED; + } else { + status = LongRunningOperationStatus.fromString( + analyzeOperationResultResponse.getValue().getStatus().toString(), true); + } + AbstractiveSummaryOperationDetailPropertiesHelper.setDisplayName(operationResultPollResponse.getValue(), + analyzeOperationResultResponse.getValue().getDisplayName()); + AbstractiveSummaryOperationDetailPropertiesHelper.setCreatedAt(operationResultPollResponse.getValue(), + analyzeOperationResultResponse.getValue().getCreatedDateTime()); + AbstractiveSummaryOperationDetailPropertiesHelper.setLastModifiedAt( + operationResultPollResponse.getValue(), analyzeOperationResultResponse.getValue().getLastUpdatedDateTime()); + AbstractiveSummaryOperationDetailPropertiesHelper.setExpiresAt(operationResultPollResponse.getValue(), + analyzeOperationResultResponse.getValue().getExpirationDateTime()); + return new PollResponse<>(status, operationResultPollResponse.getValue()); + } + + private AbstractiveSummaryOptions getNotNullAbstractiveSummaryOptions(AbstractiveSummaryOptions options) { + return options == null ? new AbstractiveSummaryOptions() : options; + } + + private void checkUnsupportedServiceVersionForAbstractiveSummary() { + throwIfTargetServiceVersionFound(this.serviceVersion, + Arrays.asList(TextAnalyticsServiceVersion.V3_0, TextAnalyticsServiceVersion.V3_1, + TextAnalyticsServiceVersion.V2022_05_01), + getUnsupportedServiceApiVersionMessage("Abstractive Summarization", serviceVersion, + TextAnalyticsServiceVersion.V2023_04_01)); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractiveSummaryUtilClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractiveSummaryUtilClient.java new file mode 100644 index 000000000000..937f3af24ee7 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/ExtractiveSummaryUtilClient.java @@ -0,0 +1,424 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics; + +import com.azure.ai.textanalytics.implementation.AnalyzeTextsImpl; +import com.azure.ai.textanalytics.implementation.ExtractiveSummaryOperationDetailPropertiesHelper; +import com.azure.ai.textanalytics.implementation.ExtractiveSummaryResultCollectionPropertiesHelper; +import com.azure.ai.textanalytics.implementation.TextAnalyticsExceptionPropertiesHelper; +import com.azure.ai.textanalytics.implementation.Utility; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextJobState; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextJobsInput; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLROResult; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextLROTask; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextsCancelJobHeaders; +import com.azure.ai.textanalytics.implementation.models.AnalyzeTextsSubmitJobHeaders; +import com.azure.ai.textanalytics.implementation.models.Error; +import com.azure.ai.textanalytics.implementation.models.ErrorResponseException; +import com.azure.ai.textanalytics.implementation.models.ExtractiveSummarizationLROResult; +import com.azure.ai.textanalytics.implementation.models.ExtractiveSummarizationLROTask; +import com.azure.ai.textanalytics.implementation.models.ExtractiveSummarizationResult; +import com.azure.ai.textanalytics.implementation.models.ExtractiveSummarizationSortingCriteria; +import com.azure.ai.textanalytics.implementation.models.ExtractiveSummarizationTaskParameters; +import com.azure.ai.textanalytics.implementation.models.MultiLanguageAnalysisInput; +import com.azure.ai.textanalytics.implementation.models.RequestStatistics; +import com.azure.ai.textanalytics.implementation.models.State; +import com.azure.ai.textanalytics.implementation.models.StringIndexType; +import com.azure.ai.textanalytics.models.ExtractiveSummaryOperationDetail; +import com.azure.ai.textanalytics.models.ExtractiveSummaryOptions; +import com.azure.ai.textanalytics.models.ExtractiveSummarySentencesOrder; +import com.azure.ai.textanalytics.models.TextAnalyticsError; +import com.azure.ai.textanalytics.models.TextAnalyticsException; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.models.TextDocumentInput; +import com.azure.ai.textanalytics.util.ExtractiveSummaryPagedFlux; +import com.azure.ai.textanalytics.util.ExtractiveSummaryPagedIterable; +import com.azure.ai.textanalytics.util.ExtractiveSummaryResultCollection; +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.ResponseBase; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.IterableStream; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.SyncPoller; +import reactor.core.publisher.Mono; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.function.BiFunction; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static com.azure.ai.textanalytics.implementation.Utility.DEFAULT_POLL_INTERVAL; +import static com.azure.ai.textanalytics.implementation.Utility.enableSyncRestProxy; +import static com.azure.ai.textanalytics.implementation.Utility.getHttpResponseException; +import static com.azure.ai.textanalytics.implementation.Utility.getNotNullContext; +import static com.azure.ai.textanalytics.implementation.Utility.getShowStatsContinuesToken; +import static com.azure.ai.textanalytics.implementation.Utility.getSkipContinuesToken; +import static com.azure.ai.textanalytics.implementation.Utility.getTopContinuesToken; +import static com.azure.ai.textanalytics.implementation.Utility.getUnsupportedServiceApiVersionMessage; +import static com.azure.ai.textanalytics.implementation.Utility.inputDocumentsValidation; +import static com.azure.ai.textanalytics.implementation.Utility.parseNextLink; +import static com.azure.ai.textanalytics.implementation.Utility.parseOperationId; +import static com.azure.ai.textanalytics.implementation.Utility.throwIfTargetServiceVersionFound; +import static com.azure.ai.textanalytics.implementation.Utility.toExtractiveSummaryResultCollection; +import static com.azure.ai.textanalytics.implementation.Utility.toMultiLanguageInput; +import static com.azure.ai.textanalytics.implementation.models.State.CANCELLED; +import static com.azure.ai.textanalytics.implementation.models.State.NOT_STARTED; +import static com.azure.ai.textanalytics.implementation.models.State.RUNNING; +import static com.azure.ai.textanalytics.implementation.models.State.SUCCEEDED; +import static com.azure.core.util.FluxUtil.monoError; + +/** + * Helper class for managing extractive summarization endpoints. + */ +class ExtractiveSummaryUtilClient { + private final AnalyzeTextsImpl service; + private final TextAnalyticsServiceVersion serviceVersion; + + private static final ClientLogger LOGGER = new ClientLogger(ExtractiveSummaryUtilClient.class); + + ExtractiveSummaryUtilClient(AnalyzeTextsImpl service, TextAnalyticsServiceVersion serviceVersion) { + this.service = service; + this.serviceVersion = serviceVersion; + } + + PollerFlux extractiveSummaryAsync( + Iterable documents, ExtractiveSummaryOptions options, Context context) { + try { + checkUnsupportedServiceVersionForExtractiveSummary(); + inputDocumentsValidation(documents); + options = getNotNullExtractiveSummaryOptions(options); + final Context finalContext = getNotNullContext(context); + final boolean finalIncludeStatistics = options.isIncludeStatistics(); + final ExtractiveSummarySentencesOrder orderBy = options.getOrderBy(); + return new PollerFlux<>( + DEFAULT_POLL_INTERVAL, + activationOperation( + service.submitJobWithResponseAsync( + new AnalyzeTextJobsInput() + .setDisplayName(options.getDisplayName()) + .setAnalysisInput( + new MultiLanguageAnalysisInput().setDocuments(toMultiLanguageInput(documents))) + .setTasks(Arrays.asList( + new ExtractiveSummarizationLROTask().setParameters( + new ExtractiveSummarizationTaskParameters() + .setStringIndexType(StringIndexType.UTF16CODE_UNIT) + .setSortBy(orderBy == null ? null + : ExtractiveSummarizationSortingCriteria.fromString(orderBy.toString())) + .setSentenceCount(options.getMaxSentenceCount()) + .setModelVersion(options.getModelVersion()) + .setLoggingOptOut(options.isServiceLogsDisabled()) + ))), + finalContext) + .map(responseBase -> { + final ExtractiveSummaryOperationDetail operationDetail = + new ExtractiveSummaryOperationDetail(); + ExtractiveSummaryOperationDetailPropertiesHelper.setOperationId(operationDetail, + parseOperationId(responseBase.getDeserializedHeaders().getOperationLocation())); + return operationDetail; + }) + ), + pollingOperation( + operationId -> service.jobStatusWithResponseAsync(operationId, + finalIncludeStatistics, null, null, finalContext)), + cancelOperation( + operationId -> service.cancelJobWithResponseAsync(operationId, finalContext)), + fetchingOperation( + operationId -> Mono.just(getExtractiveSummaryPagedFlux(operationId, null, null, + finalIncludeStatistics, finalContext))) + ); + } catch (RuntimeException ex) { + return PollerFlux.error(ex); + } + } + + SyncPoller extractiveSummaryPagedIterable( + Iterable documents, ExtractiveSummaryOptions options, Context context) { + try { + checkUnsupportedServiceVersionForExtractiveSummary(); + inputDocumentsValidation(documents); + options = getNotNullExtractiveSummaryOptions(options); + final Context finalContext = enableSyncRestProxy(getNotNullContext(context)); + final boolean finalIncludeStatistics = options.isIncludeStatistics(); + final String displayName = options.getDisplayName(); + final ExtractiveSummarySentencesOrder orderBy = options.getOrderBy(); + + final ExtractiveSummarizationLROTask task = new ExtractiveSummarizationLROTask().setParameters( + new ExtractiveSummarizationTaskParameters() + .setStringIndexType(StringIndexType.UTF16CODE_UNIT) + .setSortBy(orderBy == null ? null + : ExtractiveSummarizationSortingCriteria.fromString(orderBy.toString())) + .setSentenceCount(options.getMaxSentenceCount()) + .setModelVersion(options.getModelVersion()) + .setLoggingOptOut(options.isServiceLogsDisabled())); + return SyncPoller.createPoller( + DEFAULT_POLL_INTERVAL, + cxt -> new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, + activationOperationSync(documents, task, displayName, finalContext).apply(cxt)), + pollingOperationSync(operationId -> service.jobStatusWithResponse(operationId, + finalIncludeStatistics, null, null, finalContext)), + cancelOperationSync(operationId -> service.cancelJobWithResponse(operationId, finalContext)), + fetchingOperationIterable( + operationId -> getExtractiveSummaryPagedIterable(operationId, null, null, + finalIncludeStatistics, finalContext))); + } catch (ErrorResponseException ex) { + throw LOGGER.logExceptionAsError(getHttpResponseException(ex)); + } + } + + ExtractiveSummaryPagedFlux getExtractiveSummaryPagedFlux( + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + return new ExtractiveSummaryPagedFlux( + () -> (continuationToken, pageSize) -> + getPagedResult(continuationToken, operationId, top, skip, showStats, context).flux()); + } + + ExtractiveSummaryPagedIterable getExtractiveSummaryPagedIterable( + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + return new ExtractiveSummaryPagedIterable( + () -> (continuationToken, pageSize) -> + getPagedResultSync(continuationToken, operationId, top, skip, showStats, context)); + } + + Mono> getPagedResult(String continuationToken, + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + try { + if (continuationToken != null) { + final Map continuationTokenMap = parseNextLink(continuationToken); + top = getTopContinuesToken(continuationTokenMap); + skip = getSkipContinuesToken(continuationTokenMap); + showStats = getShowStatsContinuesToken(continuationTokenMap); + } + return service.jobStatusWithResponseAsync(operationId, showStats, top, skip, context) + .map(this::toExtractiveSummaryResultCollectionPagedResponse) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + } catch (RuntimeException ex) { + return monoError(LOGGER, ex); + } + } + + PagedResponse getPagedResultSync(String continuationToken, + UUID operationId, Integer top, Integer skip, boolean showStats, Context context) { + if (continuationToken != null) { + final Map continuationTokenMap = parseNextLink(continuationToken); + top = getTopContinuesToken(continuationTokenMap); + skip = getSkipContinuesToken(continuationTokenMap); + showStats = getShowStatsContinuesToken(continuationTokenMap); + } + return toExtractiveSummaryResultCollectionPagedResponse( + service.jobStatusWithResponse(operationId, showStats, top, skip, context)); + } + + private PagedResponse toExtractiveSummaryResultCollectionPagedResponse( + Response response) { + + final AnalyzeTextJobState jobState = response.getValue(); + final List lroResults = jobState.getTasks().getItems(); + + final ExtractiveSummarizationResult extractiveSummarizationResult; + final AnalyzeTextLROResult lroResult = lroResults.get(0); + if (lroResult instanceof ExtractiveSummarizationLROResult) { + ExtractiveSummarizationLROResult extractiveSummarizationLROResult = + (ExtractiveSummarizationLROResult) lroResults.get(0); + extractiveSummarizationResult = extractiveSummarizationLROResult.getResults(); + } else { + throw LOGGER.logExceptionAsError( + new RuntimeException("Invalid class type returned: " + lroResult.getClass().getName())); + } + + final ExtractiveSummaryResultCollection extractiveSummaryResultCollection = + toExtractiveSummaryResultCollection(extractiveSummarizationResult); + final RequestStatistics requestStatistics = extractiveSummarizationResult.getStatistics(); + if (requestStatistics != null) { + final TextDocumentBatchStatistics batchStatistic = new TextDocumentBatchStatistics( + requestStatistics.getDocumentsCount(), requestStatistics.getValidDocumentsCount(), + requestStatistics.getErroneousDocumentsCount(), requestStatistics.getTransactionsCount()); + ExtractiveSummaryResultCollectionPropertiesHelper.setStatistics( + extractiveSummaryResultCollection, batchStatistic); + } + + final List errors = jobState.getErrors(); + + if (!CoreUtils.isNullOrEmpty(errors)) { + final TextAnalyticsException textAnalyticsException = new TextAnalyticsException( + "Extract summary operation failed", null, null); + final IterableStream textAnalyticsErrors = + IterableStream.of(errors.stream().map(Utility::toTextAnalyticsError).collect(Collectors.toList())); + TextAnalyticsExceptionPropertiesHelper.setErrors(textAnalyticsException, textAnalyticsErrors); + throw LOGGER.logExceptionAsError(textAnalyticsException); + } + + return new PagedResponseBase( + response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + Arrays.asList(extractiveSummaryResultCollection), + jobState.getNextLink(), + null); + } + + // Activation operation + private Function, + Mono> activationOperation( + Mono operationResult) { + return pollingContext -> { + try { + return operationResult.onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + } catch (RuntimeException ex) { + return monoError(LOGGER, ex); + } + }; + } + + private Function, ExtractiveSummaryOperationDetail> + activationOperationSync(Iterable documents, AnalyzeTextLROTask task, String displayName, + Context context) { + return pollingContext -> { + final ResponseBase analyzeResponse = + service.submitJobWithResponse( + new AnalyzeTextJobsInput() + .setDisplayName(displayName) + .setAnalysisInput(new MultiLanguageAnalysisInput() + .setDocuments(toMultiLanguageInput(documents))) + .setTasks(Arrays.asList(task)), + context); + final ExtractiveSummaryOperationDetail operationDetail = new ExtractiveSummaryOperationDetail(); + ExtractiveSummaryOperationDetailPropertiesHelper.setOperationId(operationDetail, + parseOperationId(analyzeResponse.getDeserializedHeaders().getOperationLocation())); + return operationDetail; + }; + } + + // Polling operation + private Function, + Mono>> pollingOperation( + Function>> pollingFunction) { + return pollingContext -> { + try { + final PollResponse operationResultPollResponse = + pollingContext.getLatestResponse(); + final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); + return pollingFunction.apply(operationId) + .flatMap(modelResponse -> + Mono.just(processAnalyzeTextModelResponse(modelResponse, operationResultPollResponse))) + .onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + } catch (RuntimeException ex) { + return monoError(LOGGER, ex); + } + }; + } + + private Function, + PollResponse> pollingOperationSync( + Function> pollingFunction) { + return pollingContext -> { + final PollResponse operationResultPollResponse = + pollingContext.getLatestResponse(); + final UUID operationId = UUID.fromString(operationResultPollResponse.getValue().getOperationId()); + return processAnalyzeTextModelResponse(pollingFunction.apply(operationId), operationResultPollResponse); + }; + } + + // Fetching operation + private Function, Mono> + fetchingOperation(Function> fetchingFunction) { + return pollingContext -> { + try { + final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); + return fetchingFunction.apply(resultUuid); + } catch (RuntimeException ex) { + return monoError(LOGGER, ex); + } + }; + } + + private Function, ExtractiveSummaryPagedIterable> + fetchingOperationIterable(final Function fetchingFunction) { + return pollingContext -> { + final UUID resultUuid = UUID.fromString(pollingContext.getLatestResponse().getValue().getOperationId()); + return fetchingFunction.apply(resultUuid); + }; + } + + // Cancel operation + private BiFunction, + PollResponse, + Mono> cancelOperation( + Function>> cancelFunction) { + return (activationResponse, pollingContext) -> { + final UUID resultUuid = UUID.fromString(pollingContext.getValue().getOperationId()); + try { + return cancelFunction.apply(resultUuid) + .map(cancelJobResponse -> { + final ExtractiveSummaryOperationDetail operationResult = new ExtractiveSummaryOperationDetail(); + ExtractiveSummaryOperationDetailPropertiesHelper.setOperationId(operationResult, + parseOperationId(cancelJobResponse.getDeserializedHeaders().getOperationLocation())); + return operationResult; + }).onErrorMap(Utility::mapToHttpResponseExceptionIfExists); + } catch (RuntimeException ex) { + return monoError(LOGGER, ex); + } + }; + } + + private BiFunction, + PollResponse, ExtractiveSummaryOperationDetail> cancelOperationSync( + Function> cancelFunction) { + return (activationResponse, pollingContext) -> { + final UUID resultUuid = UUID.fromString(pollingContext.getValue().getOperationId()); + ResponseBase cancelJobResponse = cancelFunction.apply(resultUuid); + final ExtractiveSummaryOperationDetail operationResult = new ExtractiveSummaryOperationDetail(); + ExtractiveSummaryOperationDetailPropertiesHelper.setOperationId(operationResult, + parseOperationId(cancelJobResponse.getDeserializedHeaders().getOperationLocation())); + return operationResult; + }; + } + + private PollResponse processAnalyzeTextModelResponse( + Response analyzeOperationResultResponse, + PollResponse operationResultPollResponse) { + LongRunningOperationStatus status; + State state = analyzeOperationResultResponse.getValue().getStatus(); + if (NOT_STARTED.equals(state) || RUNNING.equals(state)) { + status = LongRunningOperationStatus.IN_PROGRESS; + } else if (SUCCEEDED.equals(state)) { + status = LongRunningOperationStatus.SUCCESSFULLY_COMPLETED; + } else if (CANCELLED.equals(state)) { + status = LongRunningOperationStatus.USER_CANCELLED; + } else { + status = LongRunningOperationStatus.fromString( + analyzeOperationResultResponse.getValue().getStatus().toString(), true); + } + ExtractiveSummaryOperationDetailPropertiesHelper.setDisplayName(operationResultPollResponse.getValue(), + analyzeOperationResultResponse.getValue().getDisplayName()); + ExtractiveSummaryOperationDetailPropertiesHelper.setCreatedAt(operationResultPollResponse.getValue(), + analyzeOperationResultResponse.getValue().getCreatedDateTime()); + ExtractiveSummaryOperationDetailPropertiesHelper.setLastModifiedAt( + operationResultPollResponse.getValue(), analyzeOperationResultResponse.getValue().getLastUpdatedDateTime()); + ExtractiveSummaryOperationDetailPropertiesHelper.setExpiresAt(operationResultPollResponse.getValue(), + analyzeOperationResultResponse.getValue().getExpirationDateTime()); + return new PollResponse<>(status, operationResultPollResponse.getValue()); + } + + private ExtractiveSummaryOptions getNotNullExtractiveSummaryOptions(ExtractiveSummaryOptions options) { + return options == null ? new ExtractiveSummaryOptions() : options; + } + + private void checkUnsupportedServiceVersionForExtractiveSummary() { + throwIfTargetServiceVersionFound(this.serviceVersion, + Arrays.asList(TextAnalyticsServiceVersion.V3_0, TextAnalyticsServiceVersion.V3_1, + TextAnalyticsServiceVersion.V2022_05_01), + getUnsupportedServiceApiVersionMessage("Extractive Summarization", serviceVersion, + TextAnalyticsServiceVersion.V2023_04_01)); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryActionResultPropertiesHelper.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryActionResultPropertiesHelper.java new file mode 100644 index 000000000000..7e2db01b6c31 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryActionResultPropertiesHelper.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.implementation; + +import com.azure.ai.textanalytics.models.AbstractiveSummaryActionResult; +import com.azure.ai.textanalytics.util.AbstractiveSummaryResultCollection; + +/** + * The helper class to set the non-public properties of an {@link AbstractiveSummaryActionResult} instance. + */ +public final class AbstractiveSummaryActionResultPropertiesHelper { + private static AbstractiveSummaryActionResultAccessor accessor; + + private AbstractiveSummaryActionResultPropertiesHelper() { } + + /** + * Type defining the methods to set the non-public properties of an {@link AbstractiveSummaryActionResult} + * instance. + */ + public interface AbstractiveSummaryActionResultAccessor { + void setDocumentsResults(AbstractiveSummaryActionResult actionResult, + AbstractiveSummaryResultCollection documentsResults); + } + + /** + * The method called from {@link AbstractiveSummaryActionResult} to set it's accessor. + * + * @param abstractiveSummaryActionResultAccessor The accessor. + */ + public static void setAccessor( + final AbstractiveSummaryActionResultAccessor abstractiveSummaryActionResultAccessor) { + accessor = abstractiveSummaryActionResultAccessor; + } + + public static void setDocumentsResults(AbstractiveSummaryActionResult actionResult, + AbstractiveSummaryResultCollection documentsResults) { + accessor.setDocumentsResults(actionResult, documentsResults); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryContextPropertiesHelper.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryContextPropertiesHelper.java new file mode 100644 index 000000000000..526dafc3394c --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryContextPropertiesHelper.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.implementation; + +import com.azure.ai.textanalytics.models.AbstractiveSummaryContext; + +/** + * The helper class to set the non-public properties of an {@link AbstractiveSummaryContext} instance. + */ +public final class AbstractiveSummaryContextPropertiesHelper { + private static AbstractiveSummaryContextAccessor accessor; + + private AbstractiveSummaryContextPropertiesHelper() { } + + /** + * Type defining the methods to set the non-public properties of an {@link AbstractiveSummaryContext} + * instance. + */ + public interface AbstractiveSummaryContextAccessor { + void setOffset(AbstractiveSummaryContext abstractiveSummaryContext, int offset); + void setLength(AbstractiveSummaryContext abstractiveSummaryContext, int length); + } + + /** + * The method called from {@link AbstractiveSummaryContext} to set it's accessor. + * + * @param abstractiveSummaryContextAccessor The accessor. + */ + public static void setAccessor( + final AbstractiveSummaryContextAccessor abstractiveSummaryContextAccessor) { + accessor = abstractiveSummaryContextAccessor; + } + + public static void setOffset(AbstractiveSummaryContext abstractiveSummaryContext, int offset) { + accessor.setOffset(abstractiveSummaryContext, offset); + } + + public static void setLength(AbstractiveSummaryContext abstractiveSummaryContext, int length) { + accessor.setLength(abstractiveSummaryContext, length); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryOperationDetailPropertiesHelper.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryOperationDetailPropertiesHelper.java new file mode 100644 index 000000000000..a5dcdfd17e01 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryOperationDetailPropertiesHelper.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.implementation; + +import com.azure.ai.textanalytics.models.AbstractiveSummaryOperationDetail; + +import java.time.OffsetDateTime; + +/** + * The helper class to set the non-public properties of an {@link AbstractiveSummaryOperationDetail} instance. + */ +public final class AbstractiveSummaryOperationDetailPropertiesHelper { + private static AbstractiveSummaryOperationDetailAccessor accessor; + + private AbstractiveSummaryOperationDetailPropertiesHelper() { } + + /** + * Type defining the methods to set the non-public properties of an {@link AbstractiveSummaryOperationDetail} + * instance. + */ + public interface AbstractiveSummaryOperationDetailAccessor { + void setOperationId(AbstractiveSummaryOperationDetail operationDetail, String operationId); + void setDisplayName(AbstractiveSummaryOperationDetail operationDetail, String name); + void setCreatedAt(AbstractiveSummaryOperationDetail operationDetail, OffsetDateTime createdAt); + void setExpiresAt(AbstractiveSummaryOperationDetail operationDetail, OffsetDateTime expiresAt); + void setLastModifiedAt(AbstractiveSummaryOperationDetail operationDetail, OffsetDateTime lastModifiedAt); + } + + /** + * The method called from {@link AbstractiveSummaryOperationDetail} to set it's accessor. + * + * @param abstractiveSummaryOperationDetailAccessor The accessor. + */ + public static void setAccessor( + final AbstractiveSummaryOperationDetailAccessor abstractiveSummaryOperationDetailAccessor) { + accessor = abstractiveSummaryOperationDetailAccessor; + } + + public static void setOperationId(AbstractiveSummaryOperationDetail operationDetail, String operationId) { + accessor.setOperationId(operationDetail, operationId); + } + + public static void setDisplayName(AbstractiveSummaryOperationDetail operationDetail, String name) { + accessor.setDisplayName(operationDetail, name); + } + + public static void setCreatedAt(AbstractiveSummaryOperationDetail operationDetail, OffsetDateTime createdAt) { + accessor.setCreatedAt(operationDetail, createdAt); + } + + public static void setExpiresAt(AbstractiveSummaryOperationDetail operationDetail, OffsetDateTime expiresAt) { + accessor.setExpiresAt(operationDetail, expiresAt); + } + + public static void setLastModifiedAt(AbstractiveSummaryOperationDetail operationDetail, + OffsetDateTime lastModifiedAt) { + accessor.setLastModifiedAt(operationDetail, lastModifiedAt); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryResultCollectionPropertiesHelper.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryResultCollectionPropertiesHelper.java new file mode 100644 index 000000000000..ca75165ba009 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryResultCollectionPropertiesHelper.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.implementation; + +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.util.AbstractiveSummaryResultCollection; + +/** + * The helper class to set the non-public properties of an {@link AbstractiveSummaryResultCollection} instance. + */ +public final class AbstractiveSummaryResultCollectionPropertiesHelper { + private static AbstractiveSummaryResultCollectionAccessor accessor; + + private AbstractiveSummaryResultCollectionPropertiesHelper() { } + + /** + * Type defining the methods to set the non-public properties of an + * {@link AbstractiveSummaryResultCollection} instance. + */ + public interface AbstractiveSummaryResultCollectionAccessor { + void setModelVersion(AbstractiveSummaryResultCollection resultCollection, String modelVersion); + void setStatistics(AbstractiveSummaryResultCollection resultCollection, + TextDocumentBatchStatistics statistics); + } + + /** + * The method called from {@link AbstractiveSummaryResultCollection} to set it's accessor. + * + * @param abstractiveSummaryResultCollectionAccessor The accessor. + */ + public static void setAccessor( + final AbstractiveSummaryResultCollectionAccessor abstractiveSummaryResultCollectionAccessor) { + accessor = abstractiveSummaryResultCollectionAccessor; + } + + public static void setModelVersion( + AbstractiveSummaryResultCollection resultCollection, String modelVersion) { + accessor.setModelVersion(resultCollection, modelVersion); + } + + public static void setStatistics( + AbstractiveSummaryResultCollection resultCollection, TextDocumentBatchStatistics statistics) { + accessor.setStatistics(resultCollection, statistics); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryResultPropertiesHelper.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryResultPropertiesHelper.java new file mode 100644 index 000000000000..101774d1eb18 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/AbstractiveSummaryResultPropertiesHelper.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.implementation; + +import com.azure.ai.textanalytics.models.AbstractiveSummary; +import com.azure.ai.textanalytics.models.AbstractiveSummaryResult; +import com.azure.ai.textanalytics.models.TextAnalyticsWarning; +import com.azure.core.util.IterableStream; + +/** + * The helper class to set the non-public properties of an {@link AbstractiveSummaryResult} instance. + */ +public final class AbstractiveSummaryResultPropertiesHelper { + private static AbstractiveSummaryResultAccessor accessor; + + private AbstractiveSummaryResultPropertiesHelper() { } + + /** + * Type defining the methods to set the non-public properties of an {@link AbstractiveSummaryResult} + * instance. + */ + public interface AbstractiveSummaryResultAccessor { + void setWarnings(AbstractiveSummaryResult documentResult, IterableStream warnings); + void setSummaries(AbstractiveSummaryResult documentResult, IterableStream summaries); + } + + /** + * The method called from {@link AbstractiveSummaryResult} to set it's accessor. + * + * @param abstractiveSummaryResultAccessor The accessor. + */ + public static void setAccessor(final AbstractiveSummaryResultAccessor abstractiveSummaryResultAccessor) { + accessor = abstractiveSummaryResultAccessor; + } + + public static void setWarnings(AbstractiveSummaryResult documentResult, + IterableStream warnings) { + accessor.setWarnings(documentResult, warnings); + } + + public static void setSummaries(AbstractiveSummaryResult documentResult, + IterableStream summaries) { + accessor.setSummaries(documentResult, summaries); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryActionResultPropertiesHelper.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryActionResultPropertiesHelper.java new file mode 100644 index 000000000000..854d6ea0f695 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryActionResultPropertiesHelper.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.implementation; + +import com.azure.ai.textanalytics.models.ExtractiveSummaryActionResult; +import com.azure.ai.textanalytics.util.ExtractiveSummaryResultCollection; + +/** + * The helper class to set the non-public properties of an {@link ExtractiveSummaryActionResult} instance. + */ +public final class ExtractiveSummaryActionResultPropertiesHelper { + private static ExtractiveSummaryActionResultAccessor accessor; + + private ExtractiveSummaryActionResultPropertiesHelper() { } + + /** + * Type defining the methods to set the non-public properties of an {@link ExtractiveSummaryActionResult} + * instance. + */ + public interface ExtractiveSummaryActionResultAccessor { + void setDocumentsResults(ExtractiveSummaryActionResult actionResult, + ExtractiveSummaryResultCollection documentsResults); + } + + /** + * The method called from {@link ExtractiveSummaryActionResult} to set it's accessor. + * + * @param extractiveSummaryActionResultAccessor The accessor. + */ + public static void setAccessor(final ExtractiveSummaryActionResultAccessor extractiveSummaryActionResultAccessor) { + accessor = extractiveSummaryActionResultAccessor; + } + + public static void setDocumentsResults(ExtractiveSummaryActionResult actionResult, + ExtractiveSummaryResultCollection documentsResults) { + accessor.setDocumentsResults(actionResult, documentsResults); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryOperationDetailPropertiesHelper.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryOperationDetailPropertiesHelper.java new file mode 100644 index 000000000000..9ac443eadd7e --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryOperationDetailPropertiesHelper.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.implementation; + +import com.azure.ai.textanalytics.models.ExtractiveSummaryOperationDetail; + +import java.time.OffsetDateTime; + +/** + * The helper class to set the non-public properties of an {@link ExtractiveSummaryOperationDetail} instance. + */ +public final class ExtractiveSummaryOperationDetailPropertiesHelper { + private static ExtractiveSummaryOperationDetailAccessor accessor; + + private ExtractiveSummaryOperationDetailPropertiesHelper() { } + + /** + * Type defining the methods to set the non-public properties of an {@link ExtractiveSummaryOperationDetail} + * instance. + */ + public interface ExtractiveSummaryOperationDetailAccessor { + void setOperationId(ExtractiveSummaryOperationDetail operationDetail, String operationId); + void setDisplayName(ExtractiveSummaryOperationDetail operationDetail, String name); + void setCreatedAt(ExtractiveSummaryOperationDetail operationDetail, OffsetDateTime createdAt); + void setExpiresAt(ExtractiveSummaryOperationDetail operationDetail, OffsetDateTime expiresAt); + void setLastModifiedAt(ExtractiveSummaryOperationDetail operationDetail, OffsetDateTime lastModifiedAt); + } + + /** + * The method called from {@link ExtractiveSummaryOperationDetail} to set it's accessor. + * + * @param extractiveSummaryOperationDetailAccessor The accessor. + */ + public static void setAccessor( + final ExtractiveSummaryOperationDetailAccessor extractiveSummaryOperationDetailAccessor) { + accessor = extractiveSummaryOperationDetailAccessor; + } + + public static void setOperationId(ExtractiveSummaryOperationDetail operationDetail, String operationId) { + accessor.setOperationId(operationDetail, operationId); + } + + public static void setDisplayName(ExtractiveSummaryOperationDetail operationDetail, String name) { + accessor.setDisplayName(operationDetail, name); + } + + public static void setCreatedAt(ExtractiveSummaryOperationDetail operationDetail, OffsetDateTime createdAt) { + accessor.setCreatedAt(operationDetail, createdAt); + } + + public static void setExpiresAt(ExtractiveSummaryOperationDetail operationDetail, OffsetDateTime expiresAt) { + accessor.setExpiresAt(operationDetail, expiresAt); + } + + public static void setLastModifiedAt(ExtractiveSummaryOperationDetail operationDetail, OffsetDateTime lastModifiedAt) { + accessor.setLastModifiedAt(operationDetail, lastModifiedAt); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryResultCollectionPropertiesHelper.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryResultCollectionPropertiesHelper.java new file mode 100644 index 000000000000..18c5180158e7 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryResultCollectionPropertiesHelper.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.implementation; + +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.ai.textanalytics.util.ExtractiveSummaryResultCollection; + +/** + * The helper class to set the non-public properties of an {@link ExtractiveSummaryResultCollection} instance. + */ +public final class ExtractiveSummaryResultCollectionPropertiesHelper { + private static ExtractiveSummaryResultCollectionAccessor accessor; + + private ExtractiveSummaryResultCollectionPropertiesHelper() { } + + /** + * Type defining the methods to set the non-public properties of an + * {@link ExtractiveSummaryResultCollection} instance. + */ + public interface ExtractiveSummaryResultCollectionAccessor { + void setModelVersion(ExtractiveSummaryResultCollection resultCollection, String modelVersion); + void setStatistics(ExtractiveSummaryResultCollection resultCollection, + TextDocumentBatchStatistics statistics); + } + + /** + * The method called from {@link ExtractiveSummaryResultCollection} to set it's accessor. + * + * @param extractiveSummaryResultCollectionAccessor The accessor. + */ + public static void setAccessor( + final ExtractiveSummaryResultCollectionAccessor extractiveSummaryResultCollectionAccessor) { + accessor = extractiveSummaryResultCollectionAccessor; + } + + public static void setModelVersion(ExtractiveSummaryResultCollection resultCollection, String modelVersion) { + accessor.setModelVersion(resultCollection, modelVersion); + } + + public static void setStatistics(ExtractiveSummaryResultCollection resultCollection, + TextDocumentBatchStatistics statistics) { + accessor.setStatistics(resultCollection, statistics); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryResultPropertiesHelper.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryResultPropertiesHelper.java new file mode 100644 index 000000000000..b9b9a96b40f0 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummaryResultPropertiesHelper.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.implementation; + +import com.azure.ai.textanalytics.models.ExtractiveSummaryResult; +import com.azure.ai.textanalytics.models.ExtractiveSummarySentence; +import com.azure.ai.textanalytics.models.TextAnalyticsWarning; +import com.azure.core.util.IterableStream; + +/** + * The helper class to set the non-public properties of an {@link ExtractiveSummaryResult} instance. + */ +public final class ExtractiveSummaryResultPropertiesHelper { + private static ExtractiveSummaryResultAccessor accessor; + + private ExtractiveSummaryResultPropertiesHelper() { } + + /** + * Type defining the methods to set the non-public properties of an {@link ExtractiveSummaryResult} instance. + */ + public interface ExtractiveSummaryResultAccessor { + void setSentences(ExtractiveSummaryResult documentResult, IterableStream sentences); + void setWarnings(ExtractiveSummaryResult documentResult, IterableStream warnings); + } + + /** + * The method called from {@link ExtractiveSummaryResult} to set it's accessor. + * + * @param extractiveSummaryResultAccessor The accessor. + */ + public static void setAccessor(final ExtractiveSummaryResultAccessor extractiveSummaryResultAccessor) { + accessor = extractiveSummaryResultAccessor; + } + + public static void setSentences(ExtractiveSummaryResult documentResult, + IterableStream sentences) { + accessor.setSentences(documentResult, sentences); + } + + public static void setWarnings(ExtractiveSummaryResult documentResult, + IterableStream warnings) { + accessor.setWarnings(documentResult, warnings); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummarySentencePropertiesHelper.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummarySentencePropertiesHelper.java new file mode 100644 index 000000000000..f943ebed96b7 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/ExtractiveSummarySentencePropertiesHelper.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.implementation; + +import com.azure.ai.textanalytics.models.ExtractiveSummarySentence; + +/** + * The helper class to set the non-public properties of an {@link ExtractiveSummarySentence} instance. + */ +public final class ExtractiveSummarySentencePropertiesHelper { + private static ExtractiveSummarySentenceAccessor accessor; + + private ExtractiveSummarySentencePropertiesHelper() { } + + /** + * Type defining the methods to set the non-public properties of an {@link ExtractiveSummarySentence} instance. + */ + public interface ExtractiveSummarySentenceAccessor { + void setText(ExtractiveSummarySentence extractiveSummarySentence, String text); + void setRankScore(ExtractiveSummarySentence extractiveSummarySentence, double rankScore); + void setOffset(ExtractiveSummarySentence extractiveSummarySentence, int offset); + void setLength(ExtractiveSummarySentence extractiveSummarySentence, int length); + } + + /** + * The method called from {@link ExtractiveSummarySentence} to set it's accessor. + * + * @param extractiveSummarySentenceAccessor The accessor. + */ + public static void setAccessor(final ExtractiveSummarySentenceAccessor extractiveSummarySentenceAccessor) { + accessor = extractiveSummarySentenceAccessor; + } + + public static void setText(ExtractiveSummarySentence extractiveSummarySentence, String text) { + accessor.setText(extractiveSummarySentence, text); + } + + public static void setRankScore(ExtractiveSummarySentence extractiveSummarySentence, double rankScore) { + accessor.setRankScore(extractiveSummarySentence, rankScore); + } + + public static void setOffset(ExtractiveSummarySentence extractiveSummarySentence, int offset) { + accessor.setOffset(extractiveSummarySentence, offset); + } + + public static void setLength(ExtractiveSummarySentence extractiveSummarySentence, int length) { + accessor.setLength(extractiveSummarySentence, length); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryAction.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryAction.java new file mode 100644 index 000000000000..d6391438b47f --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryAction.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Fluent; + +/** + * Configurations that allow callers to specify details about how to execute an abstractive summarization action in a + * set of documents. + */ +@Fluent +public final class AbstractiveSummaryAction { + private String actionName; + private String modelVersion; + private Boolean disableServiceLogs; + private Integer sentenceCount; + + /** + * Get the name of action. + * + * @return the name of action. + */ + public String getActionName() { + return actionName; + } + + /** + * Set the custom name for the action. + * + * @param actionName the custom name for the action. + * + * @return The {@link AbstractiveSummaryAction} object itself. + */ + public AbstractiveSummaryAction setActionName(String actionName) { + this.actionName = actionName; + return this; + } + + /** + * Gets the version of the text analytics model used by this operation. + * + * @return The model version. + */ + public String getModelVersion() { + return modelVersion; + } + + /** + * Sets the model version. This value indicates which model will be used for scoring, e.g. "latest", "2019-10-01". + * If a model-version is not specified, the API will default to the latest, non-preview version. + * + * @param modelVersion The model version. + * + * @return The {@link AbstractiveSummaryAction} object itself. + */ + public AbstractiveSummaryAction setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + /** + * Gets the value of service logs disable status. The default value of this property is 'true'. This means, + * Text Analytics service won't log your input text. Setting this property to 'false', enables logging your input + * text for 48 hours, solely to allow for troubleshooting issues. + * + * @return true if service logging of input text is disabled. + */ + public boolean isServiceLogsDisabled() { + return disableServiceLogs == null ? true : disableServiceLogs; + } + + /** + * Sets the value of service logs disable status. + * + * @param disableServiceLogs The default value of this property is 'true'. This means, Text Analytics service won't + * log your input text. Setting this property to 'false', enables logging your input text for 48 hours, + * solely to allow for troubleshooting issues. + * + * @return The {@link AbstractiveSummaryAction} object itself. + */ + public AbstractiveSummaryAction setServiceLogsDisabled(boolean disableServiceLogs) { + this.disableServiceLogs = disableServiceLogs; + return this; + } + + /** + * Get the sentenceCount property: It controls the approximate number of sentences in the output summaries. + * + * @return the sentenceCount value. + */ + public Integer getSentenceCount() { + return this.sentenceCount; + } + + /** + * Set the sentenceCount property: It controls the approximate number of sentences in the output summaries. + * + * @param sentenceCount the sentenceCount value to set. + * @return the AbstractiveSummaryAction object itself. + */ + public AbstractiveSummaryAction setSentenceCount(Integer sentenceCount) { + this.sentenceCount = sentenceCount; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryActionResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryActionResult.java new file mode 100644 index 000000000000..dac65c6c55f2 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryActionResult.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.ai.textanalytics.implementation.AbstractiveSummaryActionResultPropertiesHelper; +import com.azure.ai.textanalytics.util.AbstractiveSummaryResultCollection; +import com.azure.core.annotation.Immutable; + +/** + * The {@link AnalyzeHealthcareEntitiesActionResult} model. + */ +@Immutable +public final class AbstractiveSummaryActionResult extends TextAnalyticsActionResult { + private AbstractiveSummaryResultCollection documentsResults; + + static { + AbstractiveSummaryActionResultPropertiesHelper.setAccessor( + (actionResult, documentsResults) -> actionResult.setDocumentsResults(documentsResults)); + } + + /** + * Gets the abstractive summarization action result. + * + * @return The abstractive summarization analysis action result. + * + * @throws TextAnalyticsException if result has {@code isError} equals to true and when a non-error property + * was accessed. + */ + public AbstractiveSummaryResultCollection getDocumentsResults() { + throwExceptionIfError(); + return documentsResults; + } + + private void setDocumentsResults(AbstractiveSummaryResultCollection documentsResults) { + this.documentsResults = documentsResults; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryContext.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryContext.java new file mode 100644 index 000000000000..10e4a3db5460 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryContext.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.ai.textanalytics.implementation.AbstractiveSummaryContextPropertiesHelper; +import com.azure.core.annotation.Immutable; + +/** + * {@link AbstractiveSummaryContext} model. + */ +@Immutable +public final class AbstractiveSummaryContext { + /* + * Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + */ + private int offset; + + /* + * The length of the context. Use of different 'stringIndexType' values can affect the length returned. + */ + private int length; + + static { + AbstractiveSummaryContextPropertiesHelper.setAccessor( + new AbstractiveSummaryContextPropertiesHelper.AbstractiveSummaryContextAccessor() { + @Override + public void setOffset(AbstractiveSummaryContext abstractiveSummaryContext, int offset) { + abstractiveSummaryContext.setOffset(offset); + } + + @Override + public void setLength(AbstractiveSummaryContext abstractiveSummaryContext, int length) { + abstractiveSummaryContext.setLength(length); + } + } + ); + } + + /** + * Get the offset property: Start position for the context. Use of different 'stringIndexType' values can affect the + * offset returned. + * + * @return the offset value. + */ + public int getOffset() { + return this.offset; + } + + /** + * Get the length property: The length of the context. Use of different 'stringIndexType' values can affect the + * length returned. + * + * @return the length value. + */ + public int getLength() { + return this.length; + } + + private void setOffset(int offset) { + this.offset = offset; + } + + private void setLength(int length) { + this.length = length; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryOperationDetail.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryOperationDetail.java new file mode 100644 index 000000000000..b744d5f75772 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryOperationDetail.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.ai.textanalytics.implementation.AbstractiveSummaryOperationDetailPropertiesHelper; +import com.azure.core.annotation.Immutable; + +import java.time.OffsetDateTime; + +/** + * The {@link AbstractiveSummaryOperationDetail} model. + */ +@Immutable +public final class AbstractiveSummaryOperationDetail { + private String operationId; + private String displayName; + private OffsetDateTime createdAt; + private OffsetDateTime expiresAt; + private OffsetDateTime lastModifiedAt; + + static { + AbstractiveSummaryOperationDetailPropertiesHelper.setAccessor( + new AbstractiveSummaryOperationDetailPropertiesHelper.AbstractiveSummaryOperationDetailAccessor() { + @Override + public void setOperationId(AbstractiveSummaryOperationDetail operationResult, + String operationId) { + operationResult.setOperationId(operationId); + } + + @Override + public void setDisplayName(AbstractiveSummaryOperationDetail operationDetail, String name) { + operationDetail.setDisplayName(name); + } + + @Override + public void setExpiresAt(AbstractiveSummaryOperationDetail operationDetail, + OffsetDateTime expiresAt) { + operationDetail.setExpiresAt(expiresAt); + } + + @Override + public void setCreatedAt(AbstractiveSummaryOperationDetail operationDetail, + OffsetDateTime createdAt) { + operationDetail.setCreatedAt(createdAt); + } + + @Override + public void setLastModifiedAt(AbstractiveSummaryOperationDetail operationDetail, + OffsetDateTime lastModifiedAt) { + operationDetail.setLastModifiedAt(lastModifiedAt); + } + } + ); + } + + /** + * Gets the operationId property of the {@link AbstractiveSummaryOperationDetail}. + * + * @return The operationId property of the {@link AbstractiveSummaryOperationDetail}. + */ + public String getOperationId() { + return operationId; + } + + /** + * Gets the displayName property of the {@link AbstractiveSummaryOperationDetail}. + * + * @return The displayName property of the {@link AbstractiveSummaryOperationDetail}. + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the created time of an action. + * + * @return The created time of an action. + */ + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Gets the expiration time of an action. + * + * @return The expiration time of an action. + */ + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * Gets the last updated time of an action. + * + * @return The last updated time of an action. + */ + public OffsetDateTime getLastModifiedAt() { + return lastModifiedAt; + } + + private void setOperationId(String operationId) { + this.operationId = operationId; + } + + private void setDisplayName(String displayName) { + this.displayName = displayName; + } + + private void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + private void setExpiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + private void setLastModifiedAt(OffsetDateTime lastModifiedAt) { + this.lastModifiedAt = lastModifiedAt; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryOptions.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryOptions.java new file mode 100644 index 000000000000..9084cdf4959a --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryOptions.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Fluent; + +/** + * Configurations that allow callers to specify details about how to execute an abstractive summarization in a + * set of documents. + */ +@Fluent +public final class AbstractiveSummaryOptions extends TextAnalyticsRequestOptions { + private String displayName; + private Integer sentenceCount; + + /** + * Sets the model version. This value indicates which model will be used for scoring, e.g. "latest", "2019-10-01". + * If a model-version is not specified, the API will default to the latest, non-preview version. + * + * @param modelVersion The model version. + * + * @return The {@link AbstractiveSummaryOptions} object itself. + */ + @Override + public AbstractiveSummaryOptions setModelVersion(String modelVersion) { + super.setModelVersion(modelVersion); + return this; + } + + /** + * Sets the value of {@code includeStatistics}. The default value is false by default. + * If set to true, indicates that the service should return document and document batch statistics + * with the results of the operation. + * + * @param includeStatistics If a boolean value was specified in the request this field will contain + * information about the document payload. + * + * @return The {@link AbstractiveSummaryOptions} object itself. + */ + @Override + public AbstractiveSummaryOptions setIncludeStatistics(boolean includeStatistics) { + super.setIncludeStatistics(includeStatistics); + return this; + } + + /** + * Sets the value of service logs disable status. + * + * @param disableServiceLogs The default value of this property is 'false', except for methods like + * 'beginAnalyzeHealthcareEntities' and 'recognizePiiEntities'. This means, Text Analytics service logs + * your input text for 48 hours, solely to allow for troubleshooting issues. Setting this property to true, + * disables input logging and may limit our ability to investigate issues that occur. + * + * @return The {@link AbstractiveSummaryOptions} object itself. + */ + @Override + public AbstractiveSummaryOptions setServiceLogsDisabled(boolean disableServiceLogs) { + super.setServiceLogsDisabled(disableServiceLogs); + return this; + } + + /** + * Gets display name of the operation. + * + * @return Display name of the operation. + */ + public String getDisplayName() { + return displayName; + } + + /** + * Sets display name of the operation. + * + * @param displayName Display name of the operation. + * + * @return The {@link AbstractiveSummaryOptions} object itself. + */ + public AbstractiveSummaryOptions setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the sentenceCount property: It controls the approximate number of sentences in the output summaries. + * + * @return the sentenceCount value. + */ + public Integer getSentenceCount() { + return this.sentenceCount; + } + + /** + * Set the sentenceCount property: It controls the approximate number of sentences in the output summaries. + * + * @param sentenceCount the sentenceCount value to set. + * @return the AbstractiveSummaryOptions object itself. + */ + public AbstractiveSummaryOptions setSentenceCount(Integer sentenceCount) { + this.sentenceCount = sentenceCount; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryResult.java new file mode 100644 index 000000000000..a88238674042 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AbstractiveSummaryResult.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.ai.textanalytics.implementation.AbstractiveSummaryResultPropertiesHelper; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.IterableStream; + +/** + * The {@link AbstractiveSummaryResult} model. + */ +@Immutable +public final class AbstractiveSummaryResult extends TextAnalyticsResult { + private IterableStream summaries; + private IterableStream warnings; + + static { + AbstractiveSummaryResultPropertiesHelper.setAccessor( + new AbstractiveSummaryResultPropertiesHelper.AbstractiveSummaryResultAccessor() { + @Override + public void setWarnings(AbstractiveSummaryResult documentResult, + IterableStream warnings) { + documentResult.setWarnings(warnings); + } + + @Override + public void setSummaries(AbstractiveSummaryResult documentResult, + IterableStream summaries) { + documentResult.setSummaries(summaries); + } + }); + } + + /** + * Creates a {@link AbstractiveSummaryResult} model that describes the abstractive summarization result. + * + * @param id Unique, non-empty document identifier. + * @param textDocumentStatistics The text document statistics. + * @param error The document error. + */ + public AbstractiveSummaryResult(String id, TextDocumentStatistics textDocumentStatistics, TextAnalyticsError error) { + super(id, textDocumentStatistics, error); + } + + /** + * Gets the abstractive summaries of document. + * + * @return The abstractive summaries of document. + * + * @throws TextAnalyticsException if result has {@code isError} equals to true and when a non-error property + * was accessed. + */ + public IterableStream getSummaries() { + throwExceptionIfError(); + return summaries; + } + + /** + * Gets the {@link IterableStream} of {@link TextAnalyticsWarning Text Analytics warnings}. + * + * @return {@link IterableStream} of {@link TextAnalyticsWarning}. + */ + public IterableStream getWarnings() { + return this.warnings; + } + + private void setWarnings(IterableStream warnings) { + this.warnings = warnings; + } + + private void setSummaries(IterableStream summaries) { + this.summaries = summaries; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryAction.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryAction.java new file mode 100644 index 000000000000..d14ab06753b7 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryAction.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Fluent; + +/** + * Configurations that allow callers to specify details about how to execute an extractive summarization action in a + * set of documents. + */ +@Fluent +public final class ExtractiveSummaryAction { + private String actionName; + private String modelVersion; + private Integer maxSentenceCount; + private ExtractiveSummarySentencesOrder orderBy; + private boolean disableServiceLogs; + + /** + * Get the name of action. + * + * @return the name of action. + */ + public String getActionName() { + return actionName; + } + + /** + * Set the custom name for the action. + * + * @param actionName the custom name for the action. + * + * @return The {@link ExtractiveSummaryAction} object itself. + */ + public ExtractiveSummaryAction setActionName(String actionName) { + this.actionName = actionName; + return this; + } + + /** + * Gets the version of the text analytics model used by this operation. + * + * @return The model version. + */ + public String getModelVersion() { + return modelVersion; + } + + /** + * Set the model version. This value indicates which model will be used for scoring, e.g. "latest", "2019-10-01". + * If a model-version is not specified, the API will default to the latest, non-preview version. + * + * @param modelVersion The model version. + * + * @return The {@link ExtractiveSummaryAction} object itself. + */ + public ExtractiveSummaryAction setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + return this; + } + + /** + * Gets the value of {@code disableServiceLogs}. + * + * @return The value of {@code disableServiceLogs}. The default value of this property is 'false'. This means, + * Text Analytics service logs your input text for 48 hours, solely to allow for troubleshooting issues. Setting + * this property to true, disables input logging and may limit our ability to investigate issues that occur. + */ + public boolean isServiceLogsDisabled() { + return disableServiceLogs; + } + + /** + * Sets the value of {@code disableServiceLogs}. + * + * @param disableServiceLogs The default value of this property is 'false'. This means, Text Analytics service logs + * your input text for 48 hours, solely to allow for troubleshooting issues. Setting this property to true, + * disables input logging and may limit our ability to investigate issues that occur. + * + * @return The {@link ExtractiveSummaryAction} object itself. + */ + public ExtractiveSummaryAction setServiceLogsDisabled(boolean disableServiceLogs) { + this.disableServiceLogs = disableServiceLogs; + return this; + } + + /** + * Gets the maximum extractive summarization sentences number to be returned in the response. + * If 'null' or not specified, a default value of 3 will be used as the maximum sentences number in the service + * side. + * + * @return The maximum extractive summarization sentences number to be returned in the response. + */ + public Integer getMaxSentenceCount() { + return this.maxSentenceCount; + } + + /** + * Sets the maximum extractive summarization sentences number to be returned in the response. + * If 'null' or not specified, a default value of 3 will be used as the maximum sentences number in the service + * side. + * + * @param maxSentenceCount The maximum extractive summarization sentences number to be returned in the response. + * + * @return The {@link ExtractiveSummaryAction} object itself. + */ + public ExtractiveSummaryAction setMaxSentenceCount(Integer maxSentenceCount) { + this.maxSentenceCount = maxSentenceCount; + return this; + } + + /** + * Gets the order in which the summary sentences will be presented by. + * + * @return The order in which the summary sentences will be presented by. + */ + public ExtractiveSummarySentencesOrder getOrderBy() { + return orderBy; + } + + /** + * Sets the order in which the summary sentences will be presented by. + * Defaults to {@link ExtractiveSummarySentencesOrder#OFFSET} if not specified. + * + * @param orderBy The type of summary sentences order. Defaults to {@link ExtractiveSummarySentencesOrder#OFFSET} + * if not specified. + * + * @return The {@link ExtractiveSummaryAction} object itself. + */ + public ExtractiveSummaryAction setOrderBy(ExtractiveSummarySentencesOrder orderBy) { + this.orderBy = orderBy; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryActionResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryActionResult.java new file mode 100644 index 000000000000..6fcddab0cf60 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryActionResult.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.ai.textanalytics.implementation.ExtractiveSummaryActionResultPropertiesHelper; +import com.azure.ai.textanalytics.util.ExtractiveSummaryResultCollection; +import com.azure.core.annotation.Immutable; + +/** + * The {@link ExtractiveSummaryActionResult} model. + */ +@Immutable +public final class ExtractiveSummaryActionResult extends TextAnalyticsActionResult { + private ExtractiveSummaryResultCollection documentsResults; + + static { + ExtractiveSummaryActionResultPropertiesHelper.setAccessor( + (actionResult, documentsResults) -> actionResult.setDocumentsResults(documentsResults)); + } + + /** + * Gets the extractive summarization action result. + * + * @return The extractive summarization action result. + * + * @throws TextAnalyticsException if result has {@code isError} equals to true and when a non-error property + * was accessed. + */ + public ExtractiveSummaryResultCollection getDocumentsResults() { + throwExceptionIfError(); + return documentsResults; + } + + private void setDocumentsResults(ExtractiveSummaryResultCollection documentsResults) { + this.documentsResults = documentsResults; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryOperationDetail.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryOperationDetail.java new file mode 100644 index 000000000000..d84eec84e400 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryOperationDetail.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.ai.textanalytics.implementation.ExtractiveSummaryOperationDetailPropertiesHelper; +import com.azure.core.annotation.Immutable; + +import java.time.OffsetDateTime; + +/** + * The {@link ExtractiveSummaryOperationDetail} model. + */ +@Immutable +public final class ExtractiveSummaryOperationDetail { + private String operationId; + private String displayName; + private OffsetDateTime createdAt; + private OffsetDateTime expiresAt; + private OffsetDateTime lastModifiedAt; + + static { + ExtractiveSummaryOperationDetailPropertiesHelper.setAccessor( + new ExtractiveSummaryOperationDetailPropertiesHelper.ExtractiveSummaryOperationDetailAccessor() { + @Override + public void setOperationId(ExtractiveSummaryOperationDetail operationResult, + String operationId) { + operationResult.setOperationId(operationId); + } + + @Override + public void setDisplayName(ExtractiveSummaryOperationDetail operationDetail, String name) { + operationDetail.setDisplayName(name); + } + + @Override + public void setExpiresAt(ExtractiveSummaryOperationDetail operationDetail, + OffsetDateTime expiresAt) { + operationDetail.setExpiresAt(expiresAt); + } + + @Override + public void setCreatedAt(ExtractiveSummaryOperationDetail operationDetail, + OffsetDateTime createdAt) { + operationDetail.setCreatedAt(createdAt); + } + + @Override + public void setLastModifiedAt(ExtractiveSummaryOperationDetail operationDetail, + OffsetDateTime lastModifiedAt) { + operationDetail.setLastModifiedAt(lastModifiedAt); + } + } + ); + } + + /** + * Gets the operationId property of the {@link ExtractiveSummaryOperationDetail}. + * + * @return The operationId property of the {@link ExtractiveSummaryOperationDetail}. + */ + public String getOperationId() { + return operationId; + } + + /** + * Gets the displayName property of the {@link ExtractiveSummaryOperationDetail}. + * + * @return The displayName property of the {@link ExtractiveSummaryOperationDetail}. + */ + public String getDisplayName() { + return displayName; + } + + /** + * Gets the created time of an action. + * + * @return The created time of an action. + */ + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * Gets the expiration time of an action. + * + * @return The expiration time of an action. + */ + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * Gets the last updated time of an action. + * + * @return The last updated time of an action. + */ + public OffsetDateTime getLastModifiedAt() { + return lastModifiedAt; + } + + private void setOperationId(String operationId) { + this.operationId = operationId; + } + + private void setDisplayName(String displayName) { + this.displayName = displayName; + } + + private void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + private void setExpiresAt(OffsetDateTime expiresAt) { + this.expiresAt = expiresAt; + } + + private void setLastModifiedAt(OffsetDateTime lastModifiedAt) { + this.lastModifiedAt = lastModifiedAt; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryOptions.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryOptions.java new file mode 100644 index 000000000000..dd8f3ec76237 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryOptions.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Fluent; + +/** + * Configurations that allow callers to specify details about how to execute an extractive summarization in a + * set of documents. + */ +@Fluent +public final class ExtractiveSummaryOptions extends TextAnalyticsRequestOptions { + private String displayName; + private Integer maxSentenceCount; + private ExtractiveSummarySentencesOrder orderBy; + + /** + * Sets the model version. This value indicates which model will be used for scoring, e.g. "latest", "2019-10-01". + * If a model-version is not specified, the API will default to the latest, non-preview version. + * + * @param modelVersion The model version. + * + * @return The {@link ExtractiveSummaryOptions} object itself. + */ + @Override + public ExtractiveSummaryOptions setModelVersion(String modelVersion) { + super.setModelVersion(modelVersion); + return this; + } + + /** + * Sets the value of {@code includeStatistics}. The default value is false by default. + * If set to true, indicates that the service should return document and document batch statistics + * with the results of the operation. + * + * @param includeStatistics If a boolean value was specified in the request this field will contain + * information about the document payload. + * + * @return The {@link ExtractiveSummaryOptions} object itself. + */ + @Override + public ExtractiveSummaryOptions setIncludeStatistics(boolean includeStatistics) { + super.setIncludeStatistics(includeStatistics); + return this; + } + + /** + * Sets the value of service logs disable status. + * + * @param disableServiceLogs The default value of this property is 'false', except for methods like + * 'beginAnalyzeHealthcareEntities' and 'recognizePiiEntities'. This means, Text Analytics service logs + * your input text for 48 hours, solely to allow for troubleshooting issues. Setting this property to true, + * disables input logging and may limit our ability to investigate issues that occur. + * + * @return The {@link ExtractiveSummaryOptions} object itself. + */ + @Override + public ExtractiveSummaryOptions setServiceLogsDisabled(boolean disableServiceLogs) { + super.setServiceLogsDisabled(disableServiceLogs); + return this; + } + + /** + * Gets display name of the operation. + * + * @return Display name of the operation. + */ + public String getDisplayName() { + return displayName; + } + + /** + * Sets display name of the operation. + * + * @param displayName Display name of the operation. + * + * @return The {@link ExtractiveSummaryOptions} object itself. + */ + public ExtractiveSummaryOptions setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Gets the maximum extractive summarization sentences number to be returned in the response. + * If 'null' or not specified, a default value of 3 will be used as the maximum sentences number in the service + * side. + * + * @return The maximum extractive summarization sentences number to be returned in the response. + */ + public Integer getMaxSentenceCount() { + return this.maxSentenceCount; + } + + /** + * Sets the maximum extractive summarization sentences number to be returned in the response. + * If 'null' or not specified, a default value of 3 will be used as the maximum sentences number in the service + * side. + * + * @param maxSentenceCount The maximum extractive summarization sentences number to be returned in the response. + * + * @return The {@link ExtractiveSummaryOptions} object itself. + */ + public ExtractiveSummaryOptions setMaxSentenceCount(Integer maxSentenceCount) { + this.maxSentenceCount = maxSentenceCount; + return this; + } + + /** + * Gets the order in which the summary sentences will be presented by. + * + * @return The order in which the summary sentences will be presented by. + */ + public ExtractiveSummarySentencesOrder getOrderBy() { + return orderBy; + } + + /** + * Sets the order in which the summary sentences will be presented by. + * Defaults to {@link ExtractiveSummarySentencesOrder#OFFSET} if not specified. + * + * @param orderBy The type of summary sentences order. Defaults to {@link ExtractiveSummarySentencesOrder#OFFSET} + * if not specified. + * + * @return The {@link ExtractiveSummaryOptions} object itself. + */ + public ExtractiveSummaryOptions setOrderBy(ExtractiveSummarySentencesOrder orderBy) { + this.orderBy = orderBy; + return this; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryResult.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryResult.java new file mode 100644 index 000000000000..9869ba649f51 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummaryResult.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.ai.textanalytics.implementation.ExtractiveSummaryResultPropertiesHelper; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.IterableStream; + +/** + * The {@link ExtractiveSummaryResult} model. + */ +@Immutable +public final class ExtractiveSummaryResult extends TextAnalyticsResult { + private IterableStream sentences; + private IterableStream warnings; + + static { + ExtractiveSummaryResultPropertiesHelper.setAccessor( + new ExtractiveSummaryResultPropertiesHelper.ExtractiveSummaryResultAccessor() { + @Override + public void setSentences(ExtractiveSummaryResult documentResult, + IterableStream sentences) { + documentResult.setSentences(sentences); + } + + @Override + public void setWarnings(ExtractiveSummaryResult documentResult, + IterableStream warnings) { + documentResult.setWarnings(warnings); + } + }); + } + + /** + * Creates a {@link ExtractiveSummaryResult} model that describes extractive summarization result. + * + * @param id Unique, non-empty document identifier. + * @param textDocumentStatistics The text document statistics. + * @param error The document error. + */ + public ExtractiveSummaryResult(String id, TextDocumentStatistics textDocumentStatistics, TextAnalyticsError error) { + super(id, textDocumentStatistics, error); + } + + /** + * Get the extractive summarization sentence collection. + * + * @return The extractive summarization sentence collection. + * + * @throws TextAnalyticsException if result has {@code isError} equals to true and when a non-error property + * was accessed. + */ + public IterableStream getSentences() { + throwExceptionIfError(); + return sentences; + } + + /** + * Get the {@link IterableStream} of {@link TextAnalyticsWarning Text Analytics warnings}. + * + * @return {@link IterableStream} of {@link TextAnalyticsWarning}. + */ + public IterableStream getWarnings() { + return this.warnings; + } + + private void setSentences(IterableStream sentences) { + this.sentences = sentences; + } + + private void setWarnings(IterableStream warnings) { + this.warnings = warnings; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummarySentence.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummarySentence.java new file mode 100644 index 000000000000..927996c5e8fa --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummarySentence.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.ai.textanalytics.implementation.ExtractiveSummarySentencePropertiesHelper; +import com.azure.core.annotation.Immutable; + +/** + * The {@link ExtractiveSummarySentence} model. + */ +@Immutable +public final class ExtractiveSummarySentence { + private String text; + private double rankScore; + private int length; + private int offset; + + static { + ExtractiveSummarySentencePropertiesHelper.setAccessor( + new ExtractiveSummarySentencePropertiesHelper.ExtractiveSummarySentenceAccessor() { + @Override + public void setText(ExtractiveSummarySentence extractiveSummarySentence, String text) { + extractiveSummarySentence.setText(text); + } + + @Override + public void setRankScore(ExtractiveSummarySentence extractiveSummarySentence, double rankScore) { + extractiveSummarySentence.setRankScore(rankScore); + } + + @Override + public void setOffset(ExtractiveSummarySentence extractiveSummarySentence, int offset) { + extractiveSummarySentence.setOffset(offset); + } + + @Override + public void setLength(ExtractiveSummarySentence extractiveSummarySentence, int length) { + extractiveSummarySentence.setLength(length); + } + } + ); + } + + /** + * Gets the text property: extractive summarization sentence text. + * + * @return The {@code text} value. + */ + public String getText() { + return text; + } + + /** + * Gets the rank score of the extractive text summarization. Higher the score, higher importance of the sentence. + * + * @return The rank score value. + */ + public double getRankScore() { + return rankScore; + } + + /** + * Gets the length of sentence. + * + * @return The length of sentence. + */ + public int getLength() { + return length; + } + + /** + * Gets the offset of sentence. + * + * @return The offset of sentence. + */ + public int getOffset() { + return offset; + } + + private void setText(String text) { + this.text = text; + } + + private void setRankScore(double rankScore) { + this.rankScore = rankScore; + } + + private void setOffset(int offset) { + this.offset = offset; + } + + private void setLength(int length) { + this.length = length; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummarySentencesOrder.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummarySentencesOrder.java new file mode 100644 index 000000000000..ac87076dfef1 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/ExtractiveSummarySentencesOrder.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.ExpandableStringEnum; + +import java.util.Collection; + +/** + * Defines values for ExtractiveSummarySentencesOrder. + */ +@Immutable +public final class ExtractiveSummarySentencesOrder extends ExpandableStringEnum { + /** + * offset as the ExtractiveSummarySentencesOrder. + */ + public static final ExtractiveSummarySentencesOrder OFFSET = fromString("Offset"); + + /** + * rank as the ExtractiveSummarySentencesOrder. + */ + public static final ExtractiveSummarySentencesOrder RANK = fromString("Rank"); + + /** + * Creates or finds a {@link ExtractiveSummarySentencesOrder} from its string representation. + * + * @param name The string name to look for. + * @return The corresponding {@link ExtractiveSummarySentencesOrder}. + */ + public static ExtractiveSummarySentencesOrder fromString(String name) { + return fromString(name, ExtractiveSummarySentencesOrder.class); + } + + /** @return known ExtractiveSummarySentencesOrder values. */ + public static Collection values() { + return values(ExtractiveSummarySentencesOrder.class); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AbstractiveSummaryPagedFlux.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AbstractiveSummaryPagedFlux.java new file mode 100644 index 000000000000..07ccda75dab2 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AbstractiveSummaryPagedFlux.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.util; + +import com.azure.core.annotation.Immutable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.util.paging.ContinuablePagedFluxCore; +import com.azure.core.util.paging.PageRetriever; + +import java.util.function.Supplier; + +/** + * An implementation of {@link ContinuablePagedFluxCore} that uses default {@link PagedResponse}. + * + * @see ContinuablePagedFluxCore + */ +@Immutable +public final class AbstractiveSummaryPagedFlux extends ContinuablePagedFluxCore> { + /** + * Creates an instance of {@link AbstractiveSummaryPagedFlux} + * + * @param pageRetrieverProvider a provider that returns {@link PageRetriever} + */ + public AbstractiveSummaryPagedFlux( + Supplier>> pageRetrieverProvider) { + super(pageRetrieverProvider); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AbstractiveSummaryPagedIterable.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AbstractiveSummaryPagedIterable.java new file mode 100644 index 000000000000..650cb49b77de --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AbstractiveSummaryPagedIterable.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.util; + +import com.azure.core.annotation.Immutable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.paging.ContinuablePagedIterable; +import com.azure.core.util.paging.PageRetrieverSync; + +import java.util.function.Supplier; +import java.util.stream.Stream; + +/** + * This class provides utility to iterate over {@link PagedResponse} using {@link Stream} and {@link Iterable} + * interfaces. + */ +@Immutable +public final class AbstractiveSummaryPagedIterable extends ContinuablePagedIterable> { + + /** + * Creates an instance of {@link AbstractiveSummaryPagedIterable}. The constructor takes a {@code Supplier} and + * {@code Function}. The {@code Supplier} returns the first page of {@link AbstractiveSummaryResultCollection}, + * the {@code Function} retrieves subsequent pages of {@link AbstractiveSummaryResultCollection}. + * + * @param provider Supplier that retrieves the first page + */ + public AbstractiveSummaryPagedIterable( + Supplier>> provider) { + super(provider, (Integer) null, (token) -> { + return !CoreUtils.isNullOrEmpty(token); + }); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AbstractiveSummaryResultCollection.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AbstractiveSummaryResultCollection.java new file mode 100644 index 000000000000..e926ed59ce4f --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/AbstractiveSummaryResultCollection.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.util; + +import com.azure.ai.textanalytics.implementation.AbstractiveSummaryResultCollectionPropertiesHelper; +import com.azure.ai.textanalytics.models.AbstractiveSummaryResult; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.IterableStream; + +/** + * A collection model that contains a list of {@link AbstractiveSummaryResult} along with model version and + * batch's statistics. + */ +@Immutable +public final class AbstractiveSummaryResultCollection extends IterableStream { + private String modelVersion; + private TextDocumentBatchStatistics statistics; + + static { + AbstractiveSummaryResultCollectionPropertiesHelper.setAccessor( + new AbstractiveSummaryResultCollectionPropertiesHelper.AbstractiveSummaryResultCollectionAccessor() { + @Override + public void setModelVersion(AbstractiveSummaryResultCollection resultCollection, + String modelVersion) { + resultCollection.setModelVersion(modelVersion); + } + + @Override + public void setStatistics(AbstractiveSummaryResultCollection resultCollection, + TextDocumentBatchStatistics statistics) { + resultCollection.setStatistics(statistics); + } + }); + } + + /** + * Create a {@link AbstractiveSummaryResultCollection} model that maintains a list of + * {@link AbstractiveSummaryResult} along with model version and batch's statistics. + * + * @param documentResults A list of {@link AbstractiveSummaryResult}. + */ + public AbstractiveSummaryResultCollection(Iterable documentResults) { + super(documentResults); + } + + /** + * Gets the version of the text analytics model used by this operation. + * + * @return The model version. + */ + public String getModelVersion() { + return modelVersion; + } + + /** + * Get the batch statistics of response. + * + * @return The batch statistics of response. + */ + public TextDocumentBatchStatistics getStatistics() { + return statistics; + } + + private void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + private void setStatistics(TextDocumentBatchStatistics statistics) { + this.statistics = statistics; + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ExtractiveSummaryPagedFlux.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ExtractiveSummaryPagedFlux.java new file mode 100644 index 000000000000..2d1882ddd666 --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ExtractiveSummaryPagedFlux.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.util; + +import com.azure.core.annotation.Immutable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.util.paging.ContinuablePagedFluxCore; +import com.azure.core.util.paging.PageRetriever; + +import java.util.function.Supplier; + +/** + * An implementation of {@link ContinuablePagedFluxCore} that uses default {@link PagedResponse}. + * + * @see ContinuablePagedFluxCore + */ +@Immutable +public final class ExtractiveSummaryPagedFlux extends ContinuablePagedFluxCore> { + /** + * Creates an instance of {@link ExtractiveSummaryPagedFlux} + * + * @param pageRetrieverProvider a provider that returns {@link PageRetriever} + */ + public ExtractiveSummaryPagedFlux( + Supplier>> pageRetrieverProvider) { + super(pageRetrieverProvider); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ExtractiveSummaryPagedIterable.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ExtractiveSummaryPagedIterable.java new file mode 100644 index 000000000000..9e10536046aa --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ExtractiveSummaryPagedIterable.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.util; + +import com.azure.core.annotation.Immutable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.paging.ContinuablePagedIterable; +import com.azure.core.util.paging.PageRetrieverSync; + +import java.util.function.Supplier; +import java.util.stream.Stream; + +/** + * This class provides utility to iterate over {@link PagedResponse} using {@link Stream} and {@link Iterable} + * interfaces. + */ +@Immutable +public final class ExtractiveSummaryPagedIterable extends ContinuablePagedIterable> { + + /** + * Creates an instance of {@link ExtractiveSummaryPagedIterable}. The constructor takes a {@code Supplier} and + * {@code Function}. The {@code Supplier} returns the first page of {@link ExtractiveSummaryResultCollection}, + * the {@code Function} retrieves subsequent pages of {@link ExtractiveSummaryResultCollection}. + * + * @param provider Supplier that retrieves the first page + */ + public ExtractiveSummaryPagedIterable( + Supplier>> provider) { + super(provider, (Integer) null, (token) -> { + return !CoreUtils.isNullOrEmpty(token); + }); + } +} diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ExtractiveSummaryResultCollection.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ExtractiveSummaryResultCollection.java new file mode 100644 index 000000000000..84a4783e19ac --- /dev/null +++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/util/ExtractiveSummaryResultCollection.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.textanalytics.util; + +import com.azure.ai.textanalytics.implementation.ExtractiveSummaryResultCollectionPropertiesHelper; +import com.azure.ai.textanalytics.models.ExtractiveSummaryResult; +import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.IterableStream; + +/** + * A collection model that contains a list of {@link ExtractiveSummaryResult} along with model version and + * batch's statistics. + */ +@Immutable +public final class ExtractiveSummaryResultCollection extends IterableStream { + private String modelVersion; + private TextDocumentBatchStatistics statistics; + + static { + ExtractiveSummaryResultCollectionPropertiesHelper.setAccessor( + new ExtractiveSummaryResultCollectionPropertiesHelper.ExtractiveSummaryResultCollectionAccessor() { + @Override + public void setModelVersion(ExtractiveSummaryResultCollection resultCollection, + String modelVersion) { + resultCollection.setModelVersion(modelVersion); + } + + @Override + public void setStatistics(ExtractiveSummaryResultCollection resultCollection, + TextDocumentBatchStatistics statistics) { + resultCollection.setStatistics(statistics); + } + }); + } + + /** + * Create a {@link ExtractiveSummaryResultCollection} model that maintains a list of + * {@link ExtractiveSummaryResult} along with model version and batch's statistics. + * + * @param documentResults A list of {@link ExtractiveSummaryResult}. + */ + public ExtractiveSummaryResultCollection(Iterable documentResults) { + super(documentResults); + } + + /** + * Get the model version trained in service for the request. + * + * @return The model version trained in service for the request. + */ + public String getModelVersion() { + return modelVersion; + } + + /** + * Get the batch statistics of response. + * + * @return The batch statistics of response. + */ + public TextDocumentBatchStatistics getStatistics() { + return statistics; + } + + private void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + private void setStatistics(TextDocumentBatchStatistics statistics) { + this.statistics = statistics; + } +} From 77c32224f2f457b3925ee886f82e6ec35c1c56a8 Mon Sep 17 00:00:00 2001 From: Trevor Anderson Date: Thu, 15 Jun 2023 13:10:41 -0400 Subject: [PATCH 2/2] Updating yaml filters to have a new param to support dynamic filtering in SB3. --- eng/pipelines/templates/stages/cosmos-sdk-client.yml | 9 +++++++-- sdk/spring/ci.cosmos.yml | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/stages/cosmos-sdk-client.yml b/eng/pipelines/templates/stages/cosmos-sdk-client.yml index 0c30f7aff96c..a99f4b7ec3bd 100644 --- a/eng/pipelines/templates/stages/cosmos-sdk-client.yml +++ b/eng/pipelines/templates/stages/cosmos-sdk-client.yml @@ -30,6 +30,9 @@ parameters: - name: MatrixFilters type: object default: [] +- name: LanguageFilter + type: object + default: [] variables: - template: /eng/pipelines/templates/variables/globals.yml @@ -56,8 +59,9 @@ stages: Selection: sparse NonSparseParameters: Agent GenerateVMJobs: true - MatrixFilters: + MatrixFilters: - TestFromSource=^$|false + - ${{ parameters.MatrixFilters }} MatrixReplace: - AZURE_TEST.*=.*/ BuildParallelization: 1 @@ -75,7 +79,8 @@ stages: Path: eng/pipelines/templates/stages/cosmos-emulator-matrix.json Selection: all GenerateVMJobs: true - MatrixFilters: + MatrixFilters: + - ${{ parameters.LanguageFilter }} - ${{ parameters.MatrixFilters }} AdditionalParameters: BuildParallelization: 1 diff --git a/sdk/spring/ci.cosmos.yml b/sdk/spring/ci.cosmos.yml index 467cd727b997..174eb7e192a9 100644 --- a/sdk/spring/ci.cosmos.yml +++ b/sdk/spring/ci.cosmos.yml @@ -35,7 +35,7 @@ extends: groupId: com.azure safeName: azurespringdatacosmos releaseInBatch: true - MatrixFilters: + LanguageFilter: - Language=.*(Spring).* AdditionalModules: - name: azure-spring-data-cosmos