diff --git a/.vscode/cspell.json b/.vscode/cspell.json index acd03fb12e20..4d5dbc2789d6 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -1031,6 +1031,13 @@ "AUHOURS" ] }, + { + "filename": "**/sdk/discovery/**", + "words": [ + "milli", + "invst" + ] + }, { "filename": "**/sdk/communication/azure-communication-identity/CHANGELOG.md", "words": [ diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b219a26528da..9b6c2fdc0afa 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -41,6 +41,7 @@ com.azure:azure-ai-agents;2.2.0;2.3.0-beta.1 com.azure:azure-ai-anomalydetector;3.0.0-beta.5;3.0.0-beta.6 com.azure:azure-ai-contentsafety;1.0.19;1.1.0-beta.1 com.azure:azure-ai-contentunderstanding;1.0.0;1.1.0-beta.3 +com.azure:azure-ai-discovery;1.0.0;1.0.0 com.azure:azure-ai-documentintelligence;1.0.9;1.1.0-beta.1 com.azure:azure-ai-documenttranslator;1.0.0-beta.1;1.0.0-beta.2 com.azure:azure-ai-formrecognizer;4.1.13;4.2.0-beta.1 diff --git a/pom.xml b/pom.xml index 19f9517ddf8d..38ab701a83cf 100644 --- a/pom.xml +++ b/pom.xml @@ -106,6 +106,7 @@ sdk/devtestlabs sdk/digitaltwins sdk/disconnectedoperations + sdk/discovery sdk/dns sdk/dnsresolver sdk/documentintelligence diff --git a/sdk/discovery/azure-ai-discovery/CHANGELOG.md b/sdk/discovery/azure-ai-discovery/CHANGELOG.md new file mode 100644 index 000000000000..cee26e8c34f2 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/CHANGELOG.md @@ -0,0 +1,10 @@ +# Release History + +## 1.0.0 (2026-07-20) + +Initial general availability (GA) release of the Azure AI Discovery client library for Java. This package targets the Microsoft Discovery data-plane API version `2026-06-01`. + +### Features Added + +- `WorkspaceClient` and `WorkspaceAsyncClient` for working with Discovery workspaces, including conversations, investigations, tasks, and tools. +- `BookshelfClient` and `BookshelfAsyncClient` for managing knowledge bases, including long-running create/update, indexing, and search operations. diff --git a/sdk/discovery/azure-ai-discovery/README.md b/sdk/discovery/azure-ai-discovery/README.md new file mode 100644 index 000000000000..6689197bbde8 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/README.md @@ -0,0 +1,78 @@ +# Azure Discovery client library for Java + +Azure Discovery client library for Java. + +This package contains Microsoft Azure Discovery client library. + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] +- [Product documentation][product_documentation] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure:azure-ai-discovery;current}) +```xml + + com.azure + azure-ai-discovery + 1.0.0 + +``` +[//]: # ({x-version-update-end}) + +### Authentication + +[Azure Identity][azure_identity] package provides the default implementation for authenticating the client. + +## Key concepts + +## Examples + +```java com.azure.ai.discovery.readme +``` + +### Service API versions + +The client library targets the latest service API version by default. +The service client builder accepts an optional service API version parameter to specify which API version to communicate. + +#### Select a service API version + +You have the flexibility to explicitly select a supported service API version when initializing a service client via the service client builder. +This ensures that the client can communicate with services using the specified API version. + +When selecting an API version, it is important to verify that there are no breaking changes compared to the latest API version. +If there are significant differences, API calls may fail due to incompatibility. + +Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy. + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[product_documentation]: https://azure.microsoft.com/services/ +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity diff --git a/sdk/discovery/azure-ai-discovery/assets.json b/sdk/discovery/azure-ai-discovery/assets.json new file mode 100644 index 000000000000..65bfe0d80c0c --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo" : "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath" : "java", + "TagPrefix" : "java/discovery/azure-ai-discovery", + "Tag" : "java/discovery/azure-ai-discovery_2380bf9632" +} \ No newline at end of file diff --git a/sdk/discovery/azure-ai-discovery/checkstyle-suppressions.xml b/sdk/discovery/azure-ai-discovery/checkstyle-suppressions.xml new file mode 100644 index 000000000000..4e18c6ea8bca --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/checkstyle-suppressions.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/sdk/discovery/azure-ai-discovery/pom.xml b/sdk/discovery/azure-ai-discovery/pom.xml new file mode 100644 index 000000000000..54cb458cb349 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure + azure-ai-discovery + 1.0.0 + jar + + Microsoft Azure SDK for Discovery + This package contains Microsoft Azure Discovery client library. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + com.azure + azure-core + 1.58.1 + + + com.azure + azure-core-http-netty + 1.16.5 + + + com.azure + azure-core-test + 1.27.0-beta.16 + test + + + com.azure + azure-identity + 1.18.4 + test + + + diff --git a/sdk/discovery/azure-ai-discovery/spotbugs-exclude.xml b/sdk/discovery/azure-ai-discovery/spotbugs-exclude.xml new file mode 100644 index 000000000000..d0510c77ef73 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/spotbugs-exclude.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/BookshelfAsyncClient.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/BookshelfAsyncClient.java new file mode 100644 index 000000000000..be49b66c92ab --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/BookshelfAsyncClient.java @@ -0,0 +1,737 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.ai.discovery.implementation.KnowledgeBasesImpl; +import com.azure.ai.discovery.implementation.models.StartIndexingRequest; +import com.azure.ai.discovery.models.KnowledgeBase; +import com.azure.ai.discovery.models.KnowledgeBaseOperationResponse; +import com.azure.ai.discovery.models.SearchRequest; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +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.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous BookshelfClient type. + */ +@ServiceClient(builder = BookshelfClientBuilder.class, isAsync = true) +public final class BookshelfAsyncClient { + @Generated + private final KnowledgeBasesImpl serviceClient; + + /** + * Initializes an instance of BookshelfAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BookshelfAsyncClient(KnowledgeBasesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Creates or updates a KnowledgeBase. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of a knowledgeBase. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateOrUpdate(String knowledgeBaseName, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.beginCreateOrUpdateAsync(knowledgeBaseName, resource, requestOptions); + } + + /** + * Fetch a KnowledgeBase by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a knowledgeBase along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String knowledgeBaseName, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(knowledgeBaseName, requestOptions); + } + + /** + * List KnowledgeBase resources. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of KnowledgeBase items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(RequestOptions requestOptions) { + return this.serviceClient.listAsync(requestOptions); + } + + /** + * Get the status of a long-running operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationType: String(Indexing/CancelIndexing/Search/Delete) (Required)
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param operationId The unique ID of the operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the status of a long-running operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationStatusWithResponse(String knowledgeBaseName, String operationId, + RequestOptions requestOptions) { + return this.serviceClient.getOperationStatusWithResponseAsync(knowledgeBaseName, operationId, requestOptions); + } + + /** + * Start indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     nodePoolId: String (Optional)
+     *     projectId: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param startIndexingRequest The startIndexingRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginStartIndexing(String knowledgeBaseName, + BinaryData startIndexingRequest, RequestOptions requestOptions) { + return this.serviceClient.beginStartIndexingAsync(knowledgeBaseName, startIndexingRequest, requestOptions); + } + + /** + * Cancel indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCancelIndexing(String knowledgeBaseName, + RequestOptions requestOptions) { + return this.serviceClient.beginCancelIndexingAsync(knowledgeBaseName, requestOptions); + } + + /** + * Search the knowledge base. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     query: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param body The search request body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginSearch(String knowledgeBaseName, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.beginSearchAsync(knowledgeBaseName, body, requestOptions); + } + + /** + * Delete a KnowledgeBase. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDelete(String knowledgeBaseName, RequestOptions requestOptions) { + return this.serviceClient.beginDeleteAsync(knowledgeBaseName, requestOptions); + } + + /** + * Creates or updates a KnowledgeBase. + * + * @param knowledgeBaseName The knowledgeBase name. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a knowledgeBase. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateOrUpdate(String knowledgeBaseName, + KnowledgeBase resource) { + // Generated convenience method for beginCreateOrUpdateWithModel + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getKnowledgeBaseAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getKnowledgeBaseAccessor().prepareModelForJsonMergePatch(resource, false); + return serviceClient.beginCreateOrUpdateWithModelAsync(knowledgeBaseName, resourceInBinaryData, requestOptions); + } + + /** + * Fetch a KnowledgeBase by name. + * + * @param knowledgeBaseName The knowledgeBase name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a knowledgeBase on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String knowledgeBaseName) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(knowledgeBaseName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(KnowledgeBase.class)); + } + + /** + * List KnowledgeBase resources. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of KnowledgeBase items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = list(requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(KnowledgeBase.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Get the status of a long-running operation. + * + * @param knowledgeBaseName The knowledgeBase name. + * @param operationId The unique ID of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long-running operation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getOperationStatus(String knowledgeBaseName, String operationId) { + // Generated convenience method for getOperationStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getOperationStatusWithResponse(knowledgeBaseName, operationId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(KnowledgeBaseOperationResponse.class)); + } + + /** + * Start indexing. + * + * @param knowledgeBaseName The knowledgeBase name. + * @param nodePoolId Node pool ID. + * @param projectId Project ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginStartIndexing(String knowledgeBaseName, + String nodePoolId, String projectId) { + // Generated convenience method for beginStartIndexingWithModel + RequestOptions requestOptions = new RequestOptions(); + StartIndexingRequest startIndexingRequestObj + = new StartIndexingRequest().setNodePoolId(nodePoolId).setProjectId(projectId); + BinaryData startIndexingRequest = BinaryData.fromObject(startIndexingRequestObj); + return serviceClient.beginStartIndexingWithModelAsync(knowledgeBaseName, startIndexingRequest, requestOptions); + } + + /** + * Start indexing. + * + * @param knowledgeBaseName The knowledgeBase name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginStartIndexing(String knowledgeBaseName) { + // Generated convenience method for beginStartIndexingWithModel + RequestOptions requestOptions = new RequestOptions(); + StartIndexingRequest startIndexingRequestObj = new StartIndexingRequest(); + BinaryData startIndexingRequest = BinaryData.fromObject(startIndexingRequestObj); + return serviceClient.beginStartIndexingWithModelAsync(knowledgeBaseName, startIndexingRequest, requestOptions); + } + + /** + * Cancel indexing. + * + * @param knowledgeBaseName The knowledgeBase name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCancelIndexing(String knowledgeBaseName) { + // Generated convenience method for beginCancelIndexingWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginCancelIndexingWithModelAsync(knowledgeBaseName, requestOptions); + } + + /** + * Search the knowledge base. + * + * @param knowledgeBaseName The knowledgeBase name. + * @param body The search request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginSearch(String knowledgeBaseName, SearchRequest body) { + // Generated convenience method for beginSearchWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginSearchWithModelAsync(knowledgeBaseName, BinaryData.fromObject(body), requestOptions); + } + + /** + * Delete a KnowledgeBase. + * + * @param knowledgeBaseName The knowledgeBase name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDelete(String knowledgeBaseName) { + // Generated convenience method for beginDeleteWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginDeleteWithModelAsync(knowledgeBaseName, requestOptions); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/BookshelfClient.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/BookshelfClient.java new file mode 100644 index 000000000000..391c33f3a161 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/BookshelfClient.java @@ -0,0 +1,717 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.ai.discovery.implementation.KnowledgeBasesImpl; +import com.azure.ai.discovery.implementation.models.StartIndexingRequest; +import com.azure.ai.discovery.models.KnowledgeBase; +import com.azure.ai.discovery.models.KnowledgeBaseOperationResponse; +import com.azure.ai.discovery.models.SearchRequest; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +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.polling.SyncPoller; + +/** + * Initializes a new instance of the synchronous BookshelfClient type. + */ +@ServiceClient(builder = BookshelfClientBuilder.class) +public final class BookshelfClient { + @Generated + private final KnowledgeBasesImpl serviceClient; + + /** + * Initializes an instance of BookshelfClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + BookshelfClient(KnowledgeBasesImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Creates or updates a KnowledgeBase. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of a knowledgeBase. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateOrUpdate(String knowledgeBaseName, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.beginCreateOrUpdate(knowledgeBaseName, resource, requestOptions); + } + + /** + * Fetch a KnowledgeBase by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a knowledgeBase along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String knowledgeBaseName, RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(knowledgeBaseName, requestOptions); + } + + /** + * List KnowledgeBase resources. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of KnowledgeBase items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + return this.serviceClient.list(requestOptions); + } + + /** + * Get the status of a long-running operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationType: String(Indexing/CancelIndexing/Search/Delete) (Required)
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param operationId The unique ID of the operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the status of a long-running operation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationStatusWithResponse(String knowledgeBaseName, String operationId, + RequestOptions requestOptions) { + return this.serviceClient.getOperationStatusWithResponse(knowledgeBaseName, operationId, requestOptions); + } + + /** + * Start indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     nodePoolId: String (Optional)
+     *     projectId: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param startIndexingRequest The startIndexingRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginStartIndexing(String knowledgeBaseName, + BinaryData startIndexingRequest, RequestOptions requestOptions) { + return this.serviceClient.beginStartIndexing(knowledgeBaseName, startIndexingRequest, requestOptions); + } + + /** + * Cancel indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCancelIndexing(String knowledgeBaseName, + RequestOptions requestOptions) { + return this.serviceClient.beginCancelIndexing(knowledgeBaseName, requestOptions); + } + + /** + * Search the knowledge base. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     query: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param body The search request body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginSearch(String knowledgeBaseName, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.beginSearch(knowledgeBaseName, body, requestOptions); + } + + /** + * Delete a KnowledgeBase. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDelete(String knowledgeBaseName, RequestOptions requestOptions) { + return this.serviceClient.beginDelete(knowledgeBaseName, requestOptions); + } + + /** + * Creates or updates a KnowledgeBase. + * + * @param knowledgeBaseName The knowledgeBase name. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a knowledgeBase. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateOrUpdate(String knowledgeBaseName, + KnowledgeBase resource) { + // Generated convenience method for beginCreateOrUpdateWithModel + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getKnowledgeBaseAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getKnowledgeBaseAccessor().prepareModelForJsonMergePatch(resource, false); + return serviceClient.beginCreateOrUpdateWithModel(knowledgeBaseName, resourceInBinaryData, requestOptions); + } + + /** + * Fetch a KnowledgeBase by name. + * + * @param knowledgeBaseName The knowledgeBase name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a knowledgeBase. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public KnowledgeBase get(String knowledgeBaseName) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(knowledgeBaseName, requestOptions).getValue().toObject(KnowledgeBase.class); + } + + /** + * List KnowledgeBase resources. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of KnowledgeBase items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.list(requestOptions).mapPage(bodyItemValue -> bodyItemValue.toObject(KnowledgeBase.class)); + } + + /** + * Get the status of a long-running operation. + * + * @param knowledgeBaseName The knowledgeBase name. + * @param operationId The unique ID of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public KnowledgeBaseOperationResponse getOperationStatus(String knowledgeBaseName, String operationId) { + // Generated convenience method for getOperationStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getOperationStatusWithResponse(knowledgeBaseName, operationId, requestOptions).getValue() + .toObject(KnowledgeBaseOperationResponse.class); + } + + /** + * Start indexing. + * + * @param knowledgeBaseName The knowledgeBase name. + * @param nodePoolId Node pool ID. + * @param projectId Project ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginStartIndexing(String knowledgeBaseName, + String nodePoolId, String projectId) { + // Generated convenience method for beginStartIndexingWithModel + RequestOptions requestOptions = new RequestOptions(); + StartIndexingRequest startIndexingRequestObj + = new StartIndexingRequest().setNodePoolId(nodePoolId).setProjectId(projectId); + BinaryData startIndexingRequest = BinaryData.fromObject(startIndexingRequestObj); + return serviceClient.beginStartIndexingWithModel(knowledgeBaseName, startIndexingRequest, requestOptions); + } + + /** + * Start indexing. + * + * @param knowledgeBaseName The knowledgeBase name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginStartIndexing(String knowledgeBaseName) { + // Generated convenience method for beginStartIndexingWithModel + RequestOptions requestOptions = new RequestOptions(); + StartIndexingRequest startIndexingRequestObj = new StartIndexingRequest(); + BinaryData startIndexingRequest = BinaryData.fromObject(startIndexingRequestObj); + return serviceClient.beginStartIndexingWithModel(knowledgeBaseName, startIndexingRequest, requestOptions); + } + + /** + * Cancel indexing. + * + * @param knowledgeBaseName The knowledgeBase name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCancelIndexing(String knowledgeBaseName) { + // Generated convenience method for beginCancelIndexingWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginCancelIndexingWithModel(knowledgeBaseName, requestOptions); + } + + /** + * Search the knowledge base. + * + * @param knowledgeBaseName The knowledgeBase name. + * @param body The search request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginSearch(String knowledgeBaseName, SearchRequest body) { + // Generated convenience method for beginSearchWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginSearchWithModel(knowledgeBaseName, BinaryData.fromObject(body), requestOptions); + } + + /** + * Delete a KnowledgeBase. + * + * @param knowledgeBaseName The knowledgeBase name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDelete(String knowledgeBaseName) { + // Generated convenience method for beginDeleteWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginDeleteWithModel(knowledgeBaseName, requestOptions); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/BookshelfClientBuilder.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/BookshelfClientBuilder.java new file mode 100644 index 000000000000..5a5e213deeda --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/BookshelfClientBuilder.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.implementation.BookshelfClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.client.traits.TokenCredentialTrait; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the BookshelfClient type. + */ +@ServiceClientBuilder(serviceClients = { BookshelfClient.class, BookshelfAsyncClient.class }) +public final class BookshelfClientBuilder + implements HttpTrait, ConfigurationTrait, + TokenCredentialTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final String[] DEFAULT_SCOPES = new String[] { "https://discovery.azure.com/.default" }; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-ai-discovery.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the BookshelfClientBuilder. + */ + @Generated + public BookshelfClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BookshelfClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BookshelfClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BookshelfClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BookshelfClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BookshelfClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BookshelfClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BookshelfClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The TokenCredential used for authentication. + */ + @Generated + private TokenCredential tokenCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BookshelfClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public BookshelfClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private DiscoveryServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the BookshelfClientBuilder. + */ + @Generated + public BookshelfClientBuilder serviceVersion(DiscoveryServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the BookshelfClientBuilder. + */ + @Generated + public BookshelfClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of BookshelfClientImpl with the provided parameters. + * + * @return an instance of BookshelfClientImpl. + */ + @Generated + private BookshelfClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + DiscoveryServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : DiscoveryServiceVersion.getLatest(); + BookshelfClientImpl client = new BookshelfClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of BookshelfAsyncClient class. + * + * @return an instance of BookshelfAsyncClient. + */ + @Generated + public BookshelfAsyncClient buildAsyncClient() { + return new BookshelfAsyncClient(buildInnerClient().getKnowledgeBases()); + } + + /** + * Builds an instance of BookshelfClient class. + * + * @return an instance of BookshelfClient. + */ + @Generated + public BookshelfClient buildClient() { + return new BookshelfClient(buildInnerClient().getKnowledgeBases()); + } + + private static final ClientLogger LOGGER = new ClientLogger(BookshelfClientBuilder.class); +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/ConversationsAsyncClient.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/ConversationsAsyncClient.java new file mode 100644 index 000000000000..ca229ea5bf0f --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/ConversationsAsyncClient.java @@ -0,0 +1,433 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.implementation.ConversationsImpl; +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.ai.discovery.implementation.models.CreateRequest; +import com.azure.ai.discovery.models.Conversation; +import com.azure.ai.discovery.models.PagedConversation; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +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.FluxUtil; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous WorkspaceClient type. + */ +@ServiceClient(builder = WorkspaceClientBuilder.class, isAsync = true) +public final class ConversationsAsyncClient { + @Generated + private final ConversationsImpl serviceClient; + + /** + * Initializes an instance of ConversationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ConversationsAsyncClient(ConversationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Fetch a Conversation by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param conversationName The conversation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a conversation along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String conversationName, RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(conversationName, requestOptions); + } + + /** + * Creates a Conversation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     projectName: String (Required)
+     *     investigationName: String (Optional)
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param createRequest The createRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a conversation along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponse(BinaryData createRequest, RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(createRequest, requestOptions); + } + + /** + * Updates a Conversation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param conversationName The conversation name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a conversation along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stableUpdateWithResponse(String conversationName, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.stableUpdateWithResponseAsync(conversationName, resource, requestOptions); + } + + /** + * Deletes a Conversation. + * + * @param conversationName The conversation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponse(String conversationName, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(conversationName, requestOptions); + } + + /** + * List Conversation resources. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
investigationNameStringNoThe name of the associated Investigation
projectNameStringNoThe name of the associated Project
createdSinceOffsetDateTimeNoThe oldest creation timestamp to keep
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             name: String (Required)
+     *             createdAt: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             createdByType: String(User/Application/System) (Optional)
+     *             lastModifiedAt: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             lastModifiedByType: String(User/Application/System) (Optional)
+     *             displayName: String (Optional)
+     *             investigationName: String (Optional)
+     *             projectName: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Conversation items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listWithResponseAsync(requestOptions); + } + + /** + * Fetch a Conversation by name. + * + * @param conversationName The conversation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a conversation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String conversationName) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(conversationName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Conversation.class)); + } + + /** + * Creates a Conversation. + * + * @param projectName The name of the associated Project. + * @param investigationName The Name of the associated Investigation. + * @param displayName The title. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a conversation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono create(String projectName, String investigationName, String displayName) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateRequest createRequestObj + = new CreateRequest(projectName).setInvestigationName(investigationName).setDisplayName(displayName); + BinaryData createRequest = BinaryData.fromObject(createRequestObj); + return createWithResponse(createRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Conversation.class)); + } + + /** + * Creates a Conversation. + * + * @param projectName The name of the associated Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a conversation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono create(String projectName) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateRequest createRequestObj = new CreateRequest(projectName); + BinaryData createRequest = BinaryData.fromObject(createRequestObj); + return createWithResponse(createRequest, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Conversation.class)); + } + + /** + * Updates a Conversation. + * + * @param conversationName The conversation name. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a conversation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stableUpdate(String conversationName, Conversation resource) { + // Generated convenience method for stableUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getConversationAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getConversationAccessor().prepareModelForJsonMergePatch(resource, false); + return stableUpdateWithResponse(conversationName, resourceInBinaryData, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Conversation.class)); + } + + /** + * Deletes a Conversation. + * + * @param conversationName The conversation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @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. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono delete(String conversationName) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteWithResponse(conversationName, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * List Conversation resources. + * + * @param investigationName The name of the associated Investigation. + * @param projectName The name of the associated Project. + * @param createdSince The oldest creation timestamp to keep. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Conversation items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono list(String investigationName, String projectName, OffsetDateTime createdSince, + Integer top, Integer skip, Integer maxPageSize) { + // Generated convenience method for listWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (investigationName != null) { + requestOptions.addQueryParam("investigationName", investigationName, false); + } + if (projectName != null) { + requestOptions.addQueryParam("projectName", projectName, false); + } + if (createdSince != null) { + requestOptions.addQueryParam("createdSince", String.valueOf(createdSince), false); + } + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + if (maxPageSize != null) { + requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false); + } + return listWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PagedConversation.class)); + } + + /** + * List Conversation resources. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Conversation items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono list() { + // Generated convenience method for listWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PagedConversation.class)); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/ConversationsClient.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/ConversationsClient.java new file mode 100644 index 000000000000..48cedd46c9c0 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/ConversationsClient.java @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.implementation.ConversationsImpl; +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.ai.discovery.implementation.models.CreateRequest; +import com.azure.ai.discovery.models.Conversation; +import com.azure.ai.discovery.models.PagedConversation; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.time.OffsetDateTime; + +/** + * Initializes a new instance of the synchronous WorkspaceClient type. + */ +@ServiceClient(builder = WorkspaceClientBuilder.class) +public final class ConversationsClient { + @Generated + private final ConversationsImpl serviceClient; + + /** + * Initializes an instance of ConversationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ConversationsClient(ConversationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Fetch a Conversation by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param conversationName The conversation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a conversation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String conversationName, RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(conversationName, requestOptions); + } + + /** + * Creates a Conversation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     projectName: String (Required)
+     *     investigationName: String (Optional)
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param createRequest The createRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a conversation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(BinaryData createRequest, RequestOptions requestOptions) { + return this.serviceClient.createWithResponse(createRequest, requestOptions); + } + + /** + * Updates a Conversation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param conversationName The conversation name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a conversation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stableUpdateWithResponse(String conversationName, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.stableUpdateWithResponse(conversationName, resource, requestOptions); + } + + /** + * Deletes a Conversation. + * + * @param conversationName The conversation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String conversationName, RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponse(conversationName, requestOptions); + } + + /** + * List Conversation resources. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
investigationNameStringNoThe name of the associated Investigation
projectNameStringNoThe name of the associated Project
createdSinceOffsetDateTimeNoThe oldest creation timestamp to keep
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             name: String (Required)
+     *             createdAt: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             createdByType: String(User/Application/System) (Optional)
+     *             lastModifiedAt: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             lastModifiedByType: String(User/Application/System) (Optional)
+     *             displayName: String (Optional)
+     *             investigationName: String (Optional)
+     *             projectName: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Conversation items along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + return this.serviceClient.listWithResponse(requestOptions); + } + + /** + * Fetch a Conversation by name. + * + * @param conversationName The conversation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a conversation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Conversation get(String conversationName) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(conversationName, requestOptions).getValue().toObject(Conversation.class); + } + + /** + * Creates a Conversation. + * + * @param projectName The name of the associated Project. + * @param investigationName The Name of the associated Investigation. + * @param displayName The title. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a conversation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Conversation create(String projectName, String investigationName, String displayName) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateRequest createRequestObj + = new CreateRequest(projectName).setInvestigationName(investigationName).setDisplayName(displayName); + BinaryData createRequest = BinaryData.fromObject(createRequestObj); + return createWithResponse(createRequest, requestOptions).getValue().toObject(Conversation.class); + } + + /** + * Creates a Conversation. + * + * @param projectName The name of the associated Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a conversation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Conversation create(String projectName) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + CreateRequest createRequestObj = new CreateRequest(projectName); + BinaryData createRequest = BinaryData.fromObject(createRequestObj); + return createWithResponse(createRequest, requestOptions).getValue().toObject(Conversation.class); + } + + /** + * Updates a Conversation. + * + * @param conversationName The conversation name. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a conversation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Conversation stableUpdate(String conversationName, Conversation resource) { + // Generated convenience method for stableUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getConversationAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getConversationAccessor().prepareModelForJsonMergePatch(resource, false); + return stableUpdateWithResponse(conversationName, resourceInBinaryData, requestOptions).getValue() + .toObject(Conversation.class); + } + + /** + * Deletes a Conversation. + * + * @param conversationName The conversation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String conversationName) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteWithResponse(conversationName, requestOptions).getValue(); + } + + /** + * List Conversation resources. + * + * @param investigationName The name of the associated Investigation. + * @param projectName The name of the associated Project. + * @param createdSince The oldest creation timestamp to keep. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Conversation items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedConversation list(String investigationName, String projectName, OffsetDateTime createdSince, + Integer top, Integer skip, Integer maxPageSize) { + // Generated convenience method for listWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (investigationName != null) { + requestOptions.addQueryParam("investigationName", investigationName, false); + } + if (projectName != null) { + requestOptions.addQueryParam("projectName", projectName, false); + } + if (createdSince != null) { + requestOptions.addQueryParam("createdSince", String.valueOf(createdSince), false); + } + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + if (maxPageSize != null) { + requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false); + } + return listWithResponse(requestOptions).getValue().toObject(PagedConversation.class); + } + + /** + * List Conversation resources. + * + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Conversation items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedConversation list() { + // Generated convenience method for listWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listWithResponse(requestOptions).getValue().toObject(PagedConversation.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/DiscoveryServiceVersion.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/DiscoveryServiceVersion.java new file mode 100644 index 000000000000..100a957d33e1 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/DiscoveryServiceVersion.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.core.util.ServiceVersion; + +/** + * Service version of DiscoveryClient. + */ +public enum DiscoveryServiceVersion implements ServiceVersion { + /** + * Enum value 2026-06-01. + */ + V2026_06_01("2026-06-01"); + + private final String version; + + DiscoveryServiceVersion(String version) { + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + return this.version; + } + + /** + * Gets the latest service version supported by this client library. + * + * @return The latest {@link DiscoveryServiceVersion}. + */ + public static DiscoveryServiceVersion getLatest() { + return V2026_06_01; + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/InvestigationsAsyncClient.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/InvestigationsAsyncClient.java new file mode 100644 index 000000000000..135c79504b8a --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/InvestigationsAsyncClient.java @@ -0,0 +1,929 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.implementation.InvestigationsImpl; +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.ai.discovery.models.DiscoveryEngine; +import com.azure.ai.discovery.models.DiscoveryEngineUpdate; +import com.azure.ai.discovery.models.Investigation; +import com.azure.ai.discovery.models.InvestigationOperationStatus; +import com.azure.ai.discovery.models.PagedInvestigation; +import com.azure.ai.discovery.models.PagedWorkingMemoryEntry; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +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.FluxUtil; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous WorkspaceClient type. + */ +@ServiceClient(builder = WorkspaceClientBuilder.class, isAsync = true) +public final class InvestigationsAsyncClient { + @Generated + private final InvestigationsImpl serviceClient; + + /** + * Initializes an instance of InvestigationsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + InvestigationsAsyncClient(InvestigationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Fetch a Investigation by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a investigation list item along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(projectName, investigationName, requestOptions); + } + + /** + * Get the status of a long-running operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         projectName: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String(User/Application/System) (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *         lastModifiedBy: String (Optional)
+     *         lastModifiedByType: String(User/Application/System) (Optional)
+     *         status: String(Created/Validated/Failed) (Optional)
+     *         description: String (Optional)
+     *         tags (Optional): [
+     *              (Optional){
+     *                 key: String (Optional)
+     *                 value: String (Optional)
+     *             }
+     *         ]
+     *         displayName: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param operationId The unique ID of the operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the status of a long-running operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationStatusWithResponse(String projectName, String investigationName, + String operationId, RequestOptions requestOptions) { + return this.serviceClient.getOperationStatusWithResponseAsync(projectName, investigationName, operationId, + requestOptions); + } + + /** + * Creates an Investigation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a investigation list item along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrReplaceWithResponse(String projectName, String investigationName, + BinaryData resource, RequestOptions requestOptions) { + return this.serviceClient.createOrReplaceWithResponseAsync(projectName, investigationName, resource, + requestOptions); + } + + /** + * Updates an Investigation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a investigation list item along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponse(String projectName, String investigationName, + BinaryData resource, RequestOptions requestOptions) { + return this.serviceClient.updateWithResponseAsync(projectName, investigationName, resource, requestOptions); + } + + /** + * Delete a Investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDelete(String projectName, String investigationName, + RequestOptions requestOptions) { + return this.serviceClient.beginDeleteAsync(projectName, investigationName, requestOptions); + } + + /** + * List Investigation resources. + *

Query Parameters

+ * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
createdSinceOffsetDateTimeNoThe oldest creation timestamp to keep
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             name: String (Required)
+     *             projectName: String (Required)
+     *             createdAt: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             createdByType: String(User/Application/System) (Optional)
+     *             lastModifiedAt: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             lastModifiedByType: String(User/Application/System) (Optional)
+     *             status: String(Created/Validated/Failed) (Optional)
+     *             description: String (Optional)
+     *             tags (Optional): [
+     *                  (Optional){
+     *                     key: String (Optional)
+     *                     value: String (Optional)
+     *                 }
+     *             ]
+     *             displayName: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Investigation items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponse(String projectName, RequestOptions requestOptions) { + return this.serviceClient.listWithResponseAsync(projectName, requestOptions); + } + + /** + * Get the discovery engine for an investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the discovery engine for an investigation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDiscoveryEngineWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + return this.serviceClient.getDiscoveryEngineWithResponseAsync(projectName, investigationName, requestOptions); + } + + /** + * List discovery engine working memory entries for an investigation. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             content: String (Required)
+     *             type: String(Thought) (Required)
+     *             createdAt: OffsetDateTime (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of WorkingMemoryEntry items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDiscoveryEngineMemoryWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + return this.serviceClient.getDiscoveryEngineMemoryWithResponseAsync(projectName, investigationName, + requestOptions); + } + + /** + * Start the discovery engine for an investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return discovery engine instance along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> startDiscoveryEngineWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + return this.serviceClient.startDiscoveryEngineWithResponseAsync(projectName, investigationName, requestOptions); + } + + /** + * Stop the discovery engine for an investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return discovery engine instance along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stopDiscoveryEngineWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + return this.serviceClient.stopDiscoveryEngineWithResponseAsync(projectName, investigationName, requestOptions); + } + + /** + * Update the discovery engine for an investigation. This will create the discovery engine if it does not already + * exist. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param body The discovery engine update request. This will create the discovery engine if it does not already + * exist. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return discovery engine instance along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateDiscoveryEngineWithResponse(String projectName, String investigationName, + BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateDiscoveryEngineWithResponseAsync(projectName, investigationName, body, + requestOptions); + } + + /** + * Fetch a Investigation by name. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a investigation list item on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String projectName, String investigationName) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(projectName, investigationName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Investigation.class)); + } + + /** + * Get the status of a long-running operation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param operationId The unique ID of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long-running operation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getOperationStatus(String projectName, String investigationName, + String operationId) { + // Generated convenience method for getOperationStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getOperationStatusWithResponse(projectName, investigationName, operationId, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(InvestigationOperationStatus.class)); + } + + /** + * Creates an Investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a investigation list item on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createOrReplace(String projectName, String investigationName, Investigation resource) { + // Generated convenience method for createOrReplaceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrReplaceWithResponse(projectName, investigationName, BinaryData.fromObject(resource), + requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Investigation.class)); + } + + /** + * Updates an Investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a investigation list item on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono update(String projectName, String investigationName, Investigation resource) { + // Generated convenience method for updateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getInvestigationAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getInvestigationAccessor().prepareModelForJsonMergePatch(resource, false); + return updateWithResponse(projectName, investigationName, resourceInBinaryData, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Investigation.class)); + } + + /** + * Delete a Investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDelete(String projectName, String investigationName) { + // Generated convenience method for beginDeleteWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginDeleteWithModelAsync(projectName, investigationName, requestOptions); + } + + /** + * List Investigation resources. + * + * @param projectName The project name. + * @param createdSince The oldest creation timestamp to keep. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Investigation items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono list(String projectName, OffsetDateTime createdSince, Integer top, Integer skip, + Integer maxPageSize) { + // Generated convenience method for listWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (createdSince != null) { + requestOptions.addQueryParam("createdSince", String.valueOf(createdSince), false); + } + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + if (maxPageSize != null) { + requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false); + } + return listWithResponse(projectName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PagedInvestigation.class)); + } + + /** + * List Investigation resources. + * + * @param projectName The project name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Investigation items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono list(String projectName) { + // Generated convenience method for listWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listWithResponse(projectName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PagedInvestigation.class)); + } + + /** + * Get the discovery engine for an investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the discovery engine for an investigation on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDiscoveryEngine(String projectName, String investigationName) { + // Generated convenience method for getDiscoveryEngineWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDiscoveryEngineWithResponse(projectName, investigationName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DiscoveryEngine.class)); + } + + /** + * List discovery engine working memory entries for an investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of WorkingMemoryEntry items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDiscoveryEngineMemory(String projectName, String investigationName, + Integer top, Integer skip, Integer maxPageSize) { + // Generated convenience method for getDiscoveryEngineMemoryWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + if (maxPageSize != null) { + requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false); + } + return getDiscoveryEngineMemoryWithResponse(projectName, investigationName, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PagedWorkingMemoryEntry.class)); + } + + /** + * List discovery engine working memory entries for an investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of WorkingMemoryEntry items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDiscoveryEngineMemory(String projectName, String investigationName) { + // Generated convenience method for getDiscoveryEngineMemoryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDiscoveryEngineMemoryWithResponse(projectName, investigationName, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PagedWorkingMemoryEntry.class)); + } + + /** + * Start the discovery engine for an investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return discovery engine instance on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono startDiscoveryEngine(String projectName, String investigationName) { + // Generated convenience method for startDiscoveryEngineWithResponse + RequestOptions requestOptions = new RequestOptions(); + return startDiscoveryEngineWithResponse(projectName, investigationName, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DiscoveryEngine.class)); + } + + /** + * Stop the discovery engine for an investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return discovery engine instance on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stopDiscoveryEngine(String projectName, String investigationName) { + // Generated convenience method for stopDiscoveryEngineWithResponse + RequestOptions requestOptions = new RequestOptions(); + return stopDiscoveryEngineWithResponse(projectName, investigationName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DiscoveryEngine.class)); + } + + /** + * Update the discovery engine for an investigation. This will create the discovery engine if it does not already + * exist. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param body The discovery engine update request. This will create the discovery engine if it does not already + * exist. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return discovery engine instance on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateDiscoveryEngine(String projectName, String investigationName, + DiscoveryEngineUpdate body) { + // Generated convenience method for updateDiscoveryEngineWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateDiscoveryEngineWithResponse(projectName, investigationName, BinaryData.fromObject(body), + requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(DiscoveryEngine.class)); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/InvestigationsClient.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/InvestigationsClient.java new file mode 100644 index 000000000000..0f05e07be57f --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/InvestigationsClient.java @@ -0,0 +1,911 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.implementation.InvestigationsImpl; +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.ai.discovery.models.DiscoveryEngine; +import com.azure.ai.discovery.models.DiscoveryEngineUpdate; +import com.azure.ai.discovery.models.Investigation; +import com.azure.ai.discovery.models.InvestigationOperationStatus; +import com.azure.ai.discovery.models.PagedInvestigation; +import com.azure.ai.discovery.models.PagedWorkingMemoryEntry; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +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.polling.PollOperationDetails; +import com.azure.core.util.polling.SyncPoller; +import java.time.OffsetDateTime; + +/** + * Initializes a new instance of the synchronous WorkspaceClient type. + */ +@ServiceClient(builder = WorkspaceClientBuilder.class) +public final class InvestigationsClient { + @Generated + private final InvestigationsImpl serviceClient; + + /** + * Initializes an instance of InvestigationsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + InvestigationsClient(InvestigationsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Fetch a Investigation by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a investigation list item along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(projectName, investigationName, requestOptions); + } + + /** + * Get the status of a long-running operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         projectName: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String(User/Application/System) (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *         lastModifiedBy: String (Optional)
+     *         lastModifiedByType: String(User/Application/System) (Optional)
+     *         status: String(Created/Validated/Failed) (Optional)
+     *         description: String (Optional)
+     *         tags (Optional): [
+     *              (Optional){
+     *                 key: String (Optional)
+     *                 value: String (Optional)
+     *             }
+     *         ]
+     *         displayName: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param operationId The unique ID of the operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the status of a long-running operation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationStatusWithResponse(String projectName, String investigationName, + String operationId, RequestOptions requestOptions) { + return this.serviceClient.getOperationStatusWithResponse(projectName, investigationName, operationId, + requestOptions); + } + + /** + * Creates an Investigation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a investigation list item along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrReplaceWithResponse(String projectName, String investigationName, + BinaryData resource, RequestOptions requestOptions) { + return this.serviceClient.createOrReplaceWithResponse(projectName, investigationName, resource, requestOptions); + } + + /** + * Updates an Investigation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a investigation list item along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String projectName, String investigationName, BinaryData resource, + RequestOptions requestOptions) { + return this.serviceClient.updateWithResponse(projectName, investigationName, resource, requestOptions); + } + + /** + * Delete a Investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDelete(String projectName, String investigationName, + RequestOptions requestOptions) { + return this.serviceClient.beginDelete(projectName, investigationName, requestOptions); + } + + /** + * List Investigation resources. + *

Query Parameters

+ * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
createdSinceOffsetDateTimeNoThe oldest creation timestamp to keep
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             name: String (Required)
+     *             projectName: String (Required)
+     *             createdAt: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             createdByType: String(User/Application/System) (Optional)
+     *             lastModifiedAt: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             lastModifiedByType: String(User/Application/System) (Optional)
+     *             status: String(Created/Validated/Failed) (Optional)
+     *             description: String (Optional)
+     *             tags (Optional): [
+     *                  (Optional){
+     *                     key: String (Optional)
+     *                     value: String (Optional)
+     *                 }
+     *             ]
+     *             displayName: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Investigation items along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String projectName, RequestOptions requestOptions) { + return this.serviceClient.listWithResponse(projectName, requestOptions); + } + + /** + * Get the discovery engine for an investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the discovery engine for an investigation along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDiscoveryEngineWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + return this.serviceClient.getDiscoveryEngineWithResponse(projectName, investigationName, requestOptions); + } + + /** + * List discovery engine working memory entries for an investigation. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             content: String (Required)
+     *             type: String(Thought) (Required)
+     *             createdAt: OffsetDateTime (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of WorkingMemoryEntry items along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDiscoveryEngineMemoryWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + return this.serviceClient.getDiscoveryEngineMemoryWithResponse(projectName, investigationName, requestOptions); + } + + /** + * Start the discovery engine for an investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return discovery engine instance along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startDiscoveryEngineWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + return this.serviceClient.startDiscoveryEngineWithResponse(projectName, investigationName, requestOptions); + } + + /** + * Stop the discovery engine for an investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return discovery engine instance along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopDiscoveryEngineWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + return this.serviceClient.stopDiscoveryEngineWithResponse(projectName, investigationName, requestOptions); + } + + /** + * Update the discovery engine for an investigation. This will create the discovery engine if it does not already + * exist. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param body The discovery engine update request. This will create the discovery engine if it does not already + * exist. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return discovery engine instance along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateDiscoveryEngineWithResponse(String projectName, String investigationName, + BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.updateDiscoveryEngineWithResponse(projectName, investigationName, body, + requestOptions); + } + + /** + * Fetch a Investigation by name. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a investigation list item. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Investigation get(String projectName, String investigationName) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(projectName, investigationName, requestOptions).getValue().toObject(Investigation.class); + } + + /** + * Get the status of a long-running operation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param operationId The unique ID of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of a long-running operation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public InvestigationOperationStatus getOperationStatus(String projectName, String investigationName, + String operationId) { + // Generated convenience method for getOperationStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getOperationStatusWithResponse(projectName, investigationName, operationId, requestOptions).getValue() + .toObject(InvestigationOperationStatus.class); + } + + /** + * Creates an Investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a investigation list item. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Investigation createOrReplace(String projectName, String investigationName, Investigation resource) { + // Generated convenience method for createOrReplaceWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createOrReplaceWithResponse(projectName, investigationName, BinaryData.fromObject(resource), + requestOptions).getValue().toObject(Investigation.class); + } + + /** + * Updates an Investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a investigation list item. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Investigation update(String projectName, String investigationName, Investigation resource) { + // Generated convenience method for updateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getInvestigationAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getInvestigationAccessor().prepareModelForJsonMergePatch(resource, false); + return updateWithResponse(projectName, investigationName, resourceInBinaryData, requestOptions).getValue() + .toObject(Investigation.class); + } + + /** + * Delete a Investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDelete(String projectName, String investigationName) { + // Generated convenience method for beginDeleteWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginDeleteWithModel(projectName, investigationName, requestOptions); + } + + /** + * List Investigation resources. + * + * @param projectName The project name. + * @param createdSince The oldest creation timestamp to keep. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Investigation items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedInvestigation list(String projectName, OffsetDateTime createdSince, Integer top, Integer skip, + Integer maxPageSize) { + // Generated convenience method for listWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (createdSince != null) { + requestOptions.addQueryParam("createdSince", String.valueOf(createdSince), false); + } + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + if (maxPageSize != null) { + requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false); + } + return listWithResponse(projectName, requestOptions).getValue().toObject(PagedInvestigation.class); + } + + /** + * List Investigation resources. + * + * @param projectName The project name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Investigation items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedInvestigation list(String projectName) { + // Generated convenience method for listWithResponse + RequestOptions requestOptions = new RequestOptions(); + return listWithResponse(projectName, requestOptions).getValue().toObject(PagedInvestigation.class); + } + + /** + * Get the discovery engine for an investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the discovery engine for an investigation. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveryEngine getDiscoveryEngine(String projectName, String investigationName) { + // Generated convenience method for getDiscoveryEngineWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDiscoveryEngineWithResponse(projectName, investigationName, requestOptions).getValue() + .toObject(DiscoveryEngine.class); + } + + /** + * List discovery engine working memory entries for an investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of WorkingMemoryEntry items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedWorkingMemoryEntry getDiscoveryEngineMemory(String projectName, String investigationName, Integer top, + Integer skip, Integer maxPageSize) { + // Generated convenience method for getDiscoveryEngineMemoryWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + if (maxPageSize != null) { + requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false); + } + return getDiscoveryEngineMemoryWithResponse(projectName, investigationName, requestOptions).getValue() + .toObject(PagedWorkingMemoryEntry.class); + } + + /** + * List discovery engine working memory entries for an investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of WorkingMemoryEntry items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedWorkingMemoryEntry getDiscoveryEngineMemory(String projectName, String investigationName) { + // Generated convenience method for getDiscoveryEngineMemoryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getDiscoveryEngineMemoryWithResponse(projectName, investigationName, requestOptions).getValue() + .toObject(PagedWorkingMemoryEntry.class); + } + + /** + * Start the discovery engine for an investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return discovery engine instance. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveryEngine startDiscoveryEngine(String projectName, String investigationName) { + // Generated convenience method for startDiscoveryEngineWithResponse + RequestOptions requestOptions = new RequestOptions(); + return startDiscoveryEngineWithResponse(projectName, investigationName, requestOptions).getValue() + .toObject(DiscoveryEngine.class); + } + + /** + * Stop the discovery engine for an investigation. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return discovery engine instance. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveryEngine stopDiscoveryEngine(String projectName, String investigationName) { + // Generated convenience method for stopDiscoveryEngineWithResponse + RequestOptions requestOptions = new RequestOptions(); + return stopDiscoveryEngineWithResponse(projectName, investigationName, requestOptions).getValue() + .toObject(DiscoveryEngine.class); + } + + /** + * Update the discovery engine for an investigation. This will create the discovery engine if it does not already + * exist. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param body The discovery engine update request. This will create the discovery engine if it does not already + * exist. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return discovery engine instance. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoveryEngine updateDiscoveryEngine(String projectName, String investigationName, + DiscoveryEngineUpdate body) { + // Generated convenience method for updateDiscoveryEngineWithResponse + RequestOptions requestOptions = new RequestOptions(); + return updateDiscoveryEngineWithResponse(projectName, investigationName, BinaryData.fromObject(body), + requestOptions).getValue().toObject(DiscoveryEngine.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/TasksAsyncClient.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/TasksAsyncClient.java new file mode 100644 index 000000000000..329fc567dff7 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/TasksAsyncClient.java @@ -0,0 +1,1133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.ai.discovery.implementation.TasksImpl; +import com.azure.ai.discovery.models.ExecutionHistoryEntry; +import com.azure.ai.discovery.models.StartTaskRequest; +import com.azure.ai.discovery.models.Task; +import com.azure.ai.discovery.models.TaskComment; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +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.FluxUtil; +import java.util.stream.Collectors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous WorkspaceClient type. + */ +@ServiceClient(builder = WorkspaceClientBuilder.class, isAsync = true) +public final class TasksAsyncClient { + @Generated + private final TasksImpl serviceClient; + + /** + * Initializes an instance of TasksAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TasksAsyncClient(TasksImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get a task by ID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a task by ID along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponse(String projectName, String investigationName, String taskName, + RequestOptions requestOptions) { + return this.serviceClient.getWithResponseAsync(projectName, investigationName, taskName, requestOptions); + } + + /** + * List tasks with optional OData filters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOData filter expression. Supported fields: investigationId, + * status, createdByType, priority, createdAt, lastModifiedAt. Example: status eq 'new' or status eq + * 'executing'
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Task items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(String projectName, String investigationName, RequestOptions requestOptions) { + return this.serviceClient.listAsync(projectName, investigationName, requestOptions); + } + + /** + * Create a new task. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param body Task creation request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponse(String projectName, String investigationName, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.createWithResponseAsync(projectName, investigationName, body, requestOptions); + } + + /** + * Patch (partial update) a task (e.g. status, description, validation requirements, dependencies, result). + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stableUpdateWithResponse(String projectName, String investigationName, + String taskName, BinaryData resource, RequestOptions requestOptions) { + return this.serviceClient.stableUpdateWithResponseAsync(projectName, investigationName, taskName, resource, + requestOptions); + } + + /** + * Delete a task by ID. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponse(String projectName, String investigationName, String taskName, + RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponseAsync(projectName, investigationName, taskName, requestOptions); + } + + /** + * Start execution of a task. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     assignee (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> startWithResponse(String projectName, String investigationName, String taskName, + RequestOptions requestOptions) { + return this.serviceClient.startWithResponseAsync(projectName, investigationName, taskName, requestOptions); + } + + /** + * Add a comment to a task. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     timestamp: OffsetDateTime (Optional)
+     *     createdBy: String (Optional, Required on create)
+     *     createdByType: String(User/Application/System) (Optional, Required on create)
+     *     text: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Comment to add. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addCommentWithResponse(String projectName, String investigationName, + String taskName, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.addCommentWithResponseAsync(projectName, investigationName, taskName, body, + requestOptions); + } + + /** + * Add an execution history entry to a task. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     createdAt: OffsetDateTime (Optional, Required on create)
+     *     action: String (Optional, Required on create)
+     *     createdBy: String (Optional, Required on create)
+     *     createdByType: String(User/Application/System) (Optional, Required on create)
+     *     summary: String (Optional)
+     *     responseMessageText: String (Optional)
+     *     responseMessageId: String (Optional)
+     *     additionalDetails (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Execution history entry to add. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addExecutionHistoryWithResponse(String projectName, String investigationName, + String taskName, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.addExecutionHistoryWithResponseAsync(projectName, investigationName, taskName, body, + requestOptions); + } + + /** + * Get a task by ID. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a task by ID on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono get(String projectName, String investigationName, String taskName) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(projectName, investigationName, taskName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Task.class)); + } + + /** + * List tasks with optional OData filters. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param filter OData filter expression. Supported fields: investigationId, status, createdByType, priority, + * createdAt, lastModifiedAt. Example: status eq 'new' or status eq 'executing'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Task items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(String projectName, String investigationName, String filter) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + PagedFlux pagedFluxResponse = list(projectName, investigationName, requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Task.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * List tasks with optional OData filters. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Task items as paginated response with {@link PagedFlux}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux list(String projectName, String investigationName) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + PagedFlux pagedFluxResponse = list(projectName, investigationName, requestOptions); + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> flux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + return flux.map(pagedResponse -> new PagedResponseBase(pagedResponse.getRequest(), + pagedResponse.getStatusCode(), pagedResponse.getHeaders(), + pagedResponse.getValue() + .stream() + .map(protocolMethodData -> protocolMethodData.toObject(Task.class)) + .collect(Collectors.toList()), + pagedResponse.getContinuationToken(), null)); + }); + } + + /** + * Create a new task. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param body Task creation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return task resource on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono create(String projectName, String investigationName, Task body) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createWithResponse(projectName, investigationName, BinaryData.fromObject(body), requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Task.class)); + } + + /** + * Patch (partial update) a task (e.g. status, description, validation requirements, dependencies, result). + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return task resource on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono stableUpdate(String projectName, String investigationName, String taskName, Task resource) { + // Generated convenience method for stableUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTaskAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getTaskAccessor().prepareModelForJsonMergePatch(resource, false); + return stableUpdateWithResponse(projectName, investigationName, taskName, resourceInBinaryData, requestOptions) + .flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Task.class)); + } + + /** + * Delete a task by ID. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @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. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono delete(String projectName, String investigationName, String taskName) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + return deleteWithResponse(projectName, investigationName, taskName, requestOptions).flatMap(FluxUtil::toMono); + } + + /** + * Start execution of a task. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Start task request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return task resource on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono start(String projectName, String investigationName, String taskName, StartTaskRequest body) { + // Generated convenience method for startWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (body != null) { + requestOptions.setBody(BinaryData.fromObject(body)); + } + return startWithResponse(projectName, investigationName, taskName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Task.class)); + } + + /** + * Start execution of a task. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return task resource on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono start(String projectName, String investigationName, String taskName) { + // Generated convenience method for startWithResponse + RequestOptions requestOptions = new RequestOptions(); + return startWithResponse(projectName, investigationName, taskName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Task.class)); + } + + /** + * Add a comment to a task. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Comment to add. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return task resource on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono addComment(String projectName, String investigationName, String taskName, TaskComment body) { + // Generated convenience method for addCommentWithResponse + RequestOptions requestOptions = new RequestOptions(); + return addCommentWithResponse(projectName, investigationName, taskName, BinaryData.fromObject(body), + requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Task.class)); + } + + /** + * Add an execution history entry to a task. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Execution history entry to add. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return task resource on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono addExecutionHistory(String projectName, String investigationName, String taskName, + ExecutionHistoryEntry body) { + // Generated convenience method for addExecutionHistoryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return addExecutionHistoryWithResponse(projectName, investigationName, taskName, BinaryData.fromObject(body), + requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(Task.class)); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/TasksClient.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/TasksClient.java new file mode 100644 index 000000000000..4ccdc071232f --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/TasksClient.java @@ -0,0 +1,1102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.ai.discovery.implementation.TasksImpl; +import com.azure.ai.discovery.models.ExecutionHistoryEntry; +import com.azure.ai.discovery.models.StartTaskRequest; +import com.azure.ai.discovery.models.Task; +import com.azure.ai.discovery.models.TaskComment; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; + +/** + * Initializes a new instance of the synchronous WorkspaceClient type. + */ +@ServiceClient(builder = WorkspaceClientBuilder.class) +public final class TasksClient { + @Generated + private final TasksImpl serviceClient; + + /** + * Initializes an instance of TasksClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + TasksClient(TasksImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Get a task by ID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a task by ID along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String projectName, String investigationName, String taskName, + RequestOptions requestOptions) { + return this.serviceClient.getWithResponse(projectName, investigationName, taskName, requestOptions); + } + + /** + * List tasks with optional OData filters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOData filter expression. Supported fields: investigationId, + * status, createdByType, priority, createdAt, lastModifiedAt. Example: status eq 'new' or status eq + * 'executing'
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Task items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String projectName, String investigationName, RequestOptions requestOptions) { + return this.serviceClient.list(projectName, investigationName, requestOptions); + } + + /** + * Create a new task. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param body Task creation request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String projectName, String investigationName, BinaryData body, + RequestOptions requestOptions) { + return this.serviceClient.createWithResponse(projectName, investigationName, body, requestOptions); + } + + /** + * Patch (partial update) a task (e.g. status, description, validation requirements, dependencies, result). + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stableUpdateWithResponse(String projectName, String investigationName, String taskName, + BinaryData resource, RequestOptions requestOptions) { + return this.serviceClient.stableUpdateWithResponse(projectName, investigationName, taskName, resource, + requestOptions); + } + + /** + * Delete a task by ID. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String projectName, String investigationName, String taskName, + RequestOptions requestOptions) { + return this.serviceClient.deleteWithResponse(projectName, investigationName, taskName, requestOptions); + } + + /** + * Start execution of a task. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     assignee (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startWithResponse(String projectName, String investigationName, String taskName, + RequestOptions requestOptions) { + return this.serviceClient.startWithResponse(projectName, investigationName, taskName, requestOptions); + } + + /** + * Add a comment to a task. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     timestamp: OffsetDateTime (Optional)
+     *     createdBy: String (Optional, Required on create)
+     *     createdByType: String(User/Application/System) (Optional, Required on create)
+     *     text: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Comment to add. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addCommentWithResponse(String projectName, String investigationName, String taskName, + BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.addCommentWithResponse(projectName, investigationName, taskName, body, + requestOptions); + } + + /** + * Add an execution history entry to a task. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     createdAt: OffsetDateTime (Optional, Required on create)
+     *     action: String (Optional, Required on create)
+     *     createdBy: String (Optional, Required on create)
+     *     createdByType: String(User/Application/System) (Optional, Required on create)
+     *     summary: String (Optional)
+     *     responseMessageText: String (Optional)
+     *     responseMessageId: String (Optional)
+     *     additionalDetails (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Execution history entry to add. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addExecutionHistoryWithResponse(String projectName, String investigationName, + String taskName, BinaryData body, RequestOptions requestOptions) { + return this.serviceClient.addExecutionHistoryWithResponse(projectName, investigationName, taskName, body, + requestOptions); + } + + /** + * Get a task by ID. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a task by ID. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Task get(String projectName, String investigationName, String taskName) { + // Generated convenience method for getWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWithResponse(projectName, investigationName, taskName, requestOptions).getValue() + .toObject(Task.class); + } + + /** + * List tasks with optional OData filters. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param filter OData filter expression. Supported fields: investigationId, status, createdByType, priority, + * createdAt, lastModifiedAt. Example: status eq 'new' or status eq 'executing'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Task items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String projectName, String investigationName, String filter) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + if (filter != null) { + requestOptions.addQueryParam("filter", filter, false); + } + return serviceClient.list(projectName, investigationName, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(Task.class)); + } + + /** + * List tasks with optional OData filters. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Task items as paginated response with {@link PagedIterable}. + */ + @Generated + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String projectName, String investigationName) { + // Generated convenience method for list + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.list(projectName, investigationName, requestOptions) + .mapPage(bodyItemValue -> bodyItemValue.toObject(Task.class)); + } + + /** + * Create a new task. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param body Task creation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return task resource. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Task create(String projectName, String investigationName, Task body) { + // Generated convenience method for createWithResponse + RequestOptions requestOptions = new RequestOptions(); + return createWithResponse(projectName, investigationName, BinaryData.fromObject(body), requestOptions) + .getValue() + .toObject(Task.class); + } + + /** + * Patch (partial update) a task (e.g. status, description, validation requirements, dependencies, result). + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param resource The resource instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return task resource. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Task stableUpdate(String projectName, String investigationName, String taskName, Task resource) { + // Generated convenience method for stableUpdateWithResponse + RequestOptions requestOptions = new RequestOptions(); + JsonMergePatchHelper.getTaskAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData resourceInBinaryData = BinaryData.fromObject(resource); + // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization. + resourceInBinaryData.getLength(); + JsonMergePatchHelper.getTaskAccessor().prepareModelForJsonMergePatch(resource, false); + return stableUpdateWithResponse(projectName, investigationName, taskName, resourceInBinaryData, requestOptions) + .getValue() + .toObject(Task.class); + } + + /** + * Delete a task by ID. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String projectName, String investigationName, String taskName) { + // Generated convenience method for deleteWithResponse + RequestOptions requestOptions = new RequestOptions(); + deleteWithResponse(projectName, investigationName, taskName, requestOptions).getValue(); + } + + /** + * Start execution of a task. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Start task request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return task resource. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Task start(String projectName, String investigationName, String taskName, StartTaskRequest body) { + // Generated convenience method for startWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (body != null) { + requestOptions.setBody(BinaryData.fromObject(body)); + } + return startWithResponse(projectName, investigationName, taskName, requestOptions).getValue() + .toObject(Task.class); + } + + /** + * Start execution of a task. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return task resource. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Task start(String projectName, String investigationName, String taskName) { + // Generated convenience method for startWithResponse + RequestOptions requestOptions = new RequestOptions(); + return startWithResponse(projectName, investigationName, taskName, requestOptions).getValue() + .toObject(Task.class); + } + + /** + * Add a comment to a task. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Comment to add. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return task resource. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Task addComment(String projectName, String investigationName, String taskName, TaskComment body) { + // Generated convenience method for addCommentWithResponse + RequestOptions requestOptions = new RequestOptions(); + return addCommentWithResponse(projectName, investigationName, taskName, BinaryData.fromObject(body), + requestOptions).getValue().toObject(Task.class); + } + + /** + * Add an execution history entry to a task. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Execution history entry to add. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return task resource. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Task addExecutionHistory(String projectName, String investigationName, String taskName, + ExecutionHistoryEntry body) { + // Generated convenience method for addExecutionHistoryWithResponse + RequestOptions requestOptions = new RequestOptions(); + return addExecutionHistoryWithResponse(projectName, investigationName, taskName, BinaryData.fromObject(body), + requestOptions).getValue().toObject(Task.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/ToolsAsyncClient.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/ToolsAsyncClient.java new file mode 100644 index 000000000000..995999a11c49 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/ToolsAsyncClient.java @@ -0,0 +1,522 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.implementation.ToolsImpl; +import com.azure.ai.discovery.implementation.models.RunRequest; +import com.azure.ai.discovery.models.ComputeUsage; +import com.azure.ai.discovery.models.OperationStatusRunResultError; +import com.azure.ai.discovery.models.PagedOperation; +import com.azure.ai.discovery.models.RunOptions; +import com.azure.ai.discovery.models.RunResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +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.FluxUtil; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the asynchronous WorkspaceClient type. + */ +@ServiceClient(builder = WorkspaceClientBuilder.class, isAsync = true) +public final class ToolsAsyncClient { + @Generated + private final ToolsImpl serviceClient; + + /** + * Initializes an instance of ToolsAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ToolsAsyncClient(ToolsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Used for to poll status of a Tool run. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
logCountIntegerNoNumber of log lines to return (0-2500).
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param operationId The unique ID of the operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response} on successful completion + * of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRunStatusWithResponse(String projectName, String operationId, + RequestOptions requestOptions) { + return this.serviceClient.getRunStatusWithResponseAsync(projectName, operationId, requestOptions); + } + + /** + * Run the specified tool in the context of the specified project. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     toolId: String (Required)
+     *     command: String (Optional)
+     *     inlineFiles (Optional): [
+     *          (Optional){
+     *             mountPath: String (Required)
+     *             encodedFile: String (Required)
+     *         }
+     *     ]
+     *     inputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     outputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     nodePoolIds (Required): [
+     *         String (Required)
+     *     ]
+     *     infraOverrides (Optional): {
+     *         cpu: String (Optional)
+     *         ram: String (Optional)
+     *         gpu: String (Optional)
+     *         replicaCount: Integer (Optional)
+     *         imageUri: String (Optional)
+     *         maxCpu: String (Optional)
+     *         maxRam: String (Optional)
+     *         maxGpu: String (Optional)
+     *     }
+     *     environmentVariables (Optional): [
+     *          (Optional){
+     *             name: String (Required)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param runRequest The runRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginRun(String projectName, BinaryData runRequest, + RequestOptions requestOptions) { + return this.serviceClient.beginRunAsync(projectName, runRequest, requestOptions); + } + + /** + * Cancel an ongoing tool run. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param operationId ID of the operation to cancel. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of response model for the cancel run operation status. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCancelRunLro(String projectName, String operationId, + RequestOptions requestOptions) { + return this.serviceClient.beginCancelRunLroAsync(projectName, operationId, requestOptions); + } + + /** + * List tool runs. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             nodepoolId: String (Required)
+     *             status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Required)
+     *             runtimeDetails: String (Required)
+     *             createdAt: OffsetDateTime (Required)
+     *             completedAt: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Operation items along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationsWithResponse(String projectName, RequestOptions requestOptions) { + return this.serviceClient.getOperationsWithResponseAsync(projectName, requestOptions); + } + + /** + * Examine compute usage. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     supercomputers (Required): {
+     *         String (Required): {
+     *             activeJobs: long (Required)
+     *             pendingJobs: long (Required)
+     *             nodepools (Required): {
+     *                 String (Required): {
+     *                     reservedCPUs: String (Required)
+     *                     allocatableCPUs: String (Required)
+     *                     reservedMemory: String (Required)
+     *                     allocatableMemory: String (Required)
+     *                     reservedGPUs: String (Required)
+     *                     allocatableGPUs: String (Required)
+     *                 }
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return overview of compute usage for a project along with {@link Response} on successful completion of + * {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getComputeUsageWithResponse(String projectName, RequestOptions requestOptions) { + return this.serviceClient.getComputeUsageWithResponseAsync(projectName, requestOptions); + } + + /** + * Used for to poll status of a Tool run. + * + * @param projectName Name of the associated Project. + * @param operationId The unique ID of the operation. + * @param logCount Number of log lines to return (0-2500). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return provides status details for long running operations on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getRunStatus(String projectName, String operationId, Integer logCount) { + // Generated convenience method for getRunStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (logCount != null) { + requestOptions.addQueryParam("logCount", String.valueOf(logCount), false); + } + return getRunStatusWithResponse(projectName, operationId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OperationStatusRunResultError.class)); + } + + /** + * Used for to poll status of a Tool run. + * + * @param projectName Name of the associated Project. + * @param operationId The unique ID of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return provides status details for long running operations on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getRunStatus(String projectName, String operationId) { + // Generated convenience method for getRunStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRunStatusWithResponse(projectName, operationId, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(OperationStatusRunResultError.class)); + } + + /** + * Run the specified tool in the context of the specified project. + * + * @param options Options for run API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginRun(RunOptions options) { + // Generated convenience method for beginRunWithModel + RequestOptions requestOptions = new RequestOptions(); + String projectName = options.getProjectName(); + RunRequest runRequestObj + = new RunRequest(options.getToolId(), options.getNodePoolIds()).setCommand(options.getCommand()) + .setInlineFiles(options.getInlineFiles()) + .setInputData(options.getInputData()) + .setOutputData(options.getOutputData()) + .setInfraOverrides(options.getInfraOverrides()) + .setEnvironmentVariables(options.getEnvironmentVariables()); + BinaryData runRequest = BinaryData.fromObject(runRequestObj); + return serviceClient.beginRunWithModelAsync(projectName, runRequest, requestOptions); + } + + /** + * Cancel an ongoing tool run. + * + * @param projectName Name of the associated Project. + * @param operationId ID of the operation to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of response model for the cancel run operation status. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCancelRunLro(String projectName, String operationId) { + // Generated convenience method for beginCancelRunLroWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginCancelRunLroWithModelAsync(projectName, operationId, requestOptions); + } + + /** + * List tool runs. + * + * @param projectName Name of the associated Project. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Operation items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getOperations(String projectName, Integer top, Integer skip, Integer maxPageSize) { + // Generated convenience method for getOperationsWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + if (maxPageSize != null) { + requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false); + } + return getOperationsWithResponse(projectName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PagedOperation.class)); + } + + /** + * List tool runs. + * + * @param projectName Name of the associated Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Operation items on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getOperations(String projectName) { + // Generated convenience method for getOperationsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getOperationsWithResponse(projectName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(PagedOperation.class)); + } + + /** + * Examine compute usage. + * + * @param projectName Name of the associated Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return overview of compute usage for a project on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getComputeUsage(String projectName) { + // Generated convenience method for getComputeUsageWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getComputeUsageWithResponse(projectName, requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(ComputeUsage.class)); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/ToolsClient.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/ToolsClient.java new file mode 100644 index 000000000000..a51334757eb1 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/ToolsClient.java @@ -0,0 +1,515 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.implementation.ToolsImpl; +import com.azure.ai.discovery.implementation.models.RunRequest; +import com.azure.ai.discovery.models.ComputeUsage; +import com.azure.ai.discovery.models.OperationStatusRunResultError; +import com.azure.ai.discovery.models.PagedOperation; +import com.azure.ai.discovery.models.RunOptions; +import com.azure.ai.discovery.models.RunResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +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.polling.PollOperationDetails; +import com.azure.core.util.polling.SyncPoller; + +/** + * Initializes a new instance of the synchronous WorkspaceClient type. + */ +@ServiceClient(builder = WorkspaceClientBuilder.class) +public final class ToolsClient { + @Generated + private final ToolsImpl serviceClient; + + /** + * Initializes an instance of ToolsClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + ToolsClient(ToolsImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * Used for to poll status of a Tool run. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
logCountIntegerNoNumber of log lines to return (0-2500).
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param operationId The unique ID of the operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRunStatusWithResponse(String projectName, String operationId, + RequestOptions requestOptions) { + return this.serviceClient.getRunStatusWithResponse(projectName, operationId, requestOptions); + } + + /** + * Run the specified tool in the context of the specified project. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     toolId: String (Required)
+     *     command: String (Optional)
+     *     inlineFiles (Optional): [
+     *          (Optional){
+     *             mountPath: String (Required)
+     *             encodedFile: String (Required)
+     *         }
+     *     ]
+     *     inputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     outputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     nodePoolIds (Required): [
+     *         String (Required)
+     *     ]
+     *     infraOverrides (Optional): {
+     *         cpu: String (Optional)
+     *         ram: String (Optional)
+     *         gpu: String (Optional)
+     *         replicaCount: Integer (Optional)
+     *         imageUri: String (Optional)
+     *         maxCpu: String (Optional)
+     *         maxRam: String (Optional)
+     *         maxGpu: String (Optional)
+     *     }
+     *     environmentVariables (Optional): [
+     *          (Optional){
+     *             name: String (Required)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param runRequest The runRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginRun(String projectName, BinaryData runRequest, + RequestOptions requestOptions) { + return this.serviceClient.beginRun(projectName, runRequest, requestOptions); + } + + /** + * Cancel an ongoing tool run. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param operationId ID of the operation to cancel. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of response model for the cancel run operation status. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCancelRunLro(String projectName, String operationId, + RequestOptions requestOptions) { + return this.serviceClient.beginCancelRunLro(projectName, operationId, requestOptions); + } + + /** + * List tool runs. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             nodepoolId: String (Required)
+     *             status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Required)
+     *             runtimeDetails: String (Required)
+     *             createdAt: OffsetDateTime (Required)
+     *             completedAt: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Operation items along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationsWithResponse(String projectName, RequestOptions requestOptions) { + return this.serviceClient.getOperationsWithResponse(projectName, requestOptions); + } + + /** + * Examine compute usage. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     supercomputers (Required): {
+     *         String (Required): {
+     *             activeJobs: long (Required)
+     *             pendingJobs: long (Required)
+     *             nodepools (Required): {
+     *                 String (Required): {
+     *                     reservedCPUs: String (Required)
+     *                     allocatableCPUs: String (Required)
+     *                     reservedMemory: String (Required)
+     *                     allocatableMemory: String (Required)
+     *                     reservedGPUs: String (Required)
+     *                     allocatableGPUs: String (Required)
+     *                 }
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return overview of compute usage for a project along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getComputeUsageWithResponse(String projectName, RequestOptions requestOptions) { + return this.serviceClient.getComputeUsageWithResponse(projectName, requestOptions); + } + + /** + * Used for to poll status of a Tool run. + * + * @param projectName Name of the associated Project. + * @param operationId The unique ID of the operation. + * @param logCount Number of log lines to return (0-2500). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusRunResultError getRunStatus(String projectName, String operationId, Integer logCount) { + // Generated convenience method for getRunStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (logCount != null) { + requestOptions.addQueryParam("logCount", String.valueOf(logCount), false); + } + return getRunStatusWithResponse(projectName, operationId, requestOptions).getValue() + .toObject(OperationStatusRunResultError.class); + } + + /** + * Used for to poll status of a Tool run. + * + * @param projectName Name of the associated Project. + * @param operationId The unique ID of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusRunResultError getRunStatus(String projectName, String operationId) { + // Generated convenience method for getRunStatusWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getRunStatusWithResponse(projectName, operationId, requestOptions).getValue() + .toObject(OperationStatusRunResultError.class); + } + + /** + * Run the specified tool in the context of the specified project. + * + * @param options Options for run API. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginRun(RunOptions options) { + // Generated convenience method for beginRunWithModel + RequestOptions requestOptions = new RequestOptions(); + String projectName = options.getProjectName(); + RunRequest runRequestObj + = new RunRequest(options.getToolId(), options.getNodePoolIds()).setCommand(options.getCommand()) + .setInlineFiles(options.getInlineFiles()) + .setInputData(options.getInputData()) + .setOutputData(options.getOutputData()) + .setInfraOverrides(options.getInfraOverrides()) + .setEnvironmentVariables(options.getEnvironmentVariables()); + BinaryData runRequest = BinaryData.fromObject(runRequestObj); + return serviceClient.beginRunWithModel(projectName, runRequest, requestOptions); + } + + /** + * Cancel an ongoing tool run. + * + * @param projectName Name of the associated Project. + * @param operationId ID of the operation to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of response model for the cancel run operation status. + */ + @Generated + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCancelRunLro(String projectName, String operationId) { + // Generated convenience method for beginCancelRunLroWithModel + RequestOptions requestOptions = new RequestOptions(); + return serviceClient.beginCancelRunLroWithModel(projectName, operationId, requestOptions); + } + + /** + * List tool runs. + * + * @param projectName Name of the associated Project. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Operation items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedOperation getOperations(String projectName, Integer top, Integer skip, Integer maxPageSize) { + // Generated convenience method for getOperationsWithResponse + RequestOptions requestOptions = new RequestOptions(); + if (top != null) { + requestOptions.addQueryParam("top", String.valueOf(top), false); + } + if (skip != null) { + requestOptions.addQueryParam("skip", String.valueOf(skip), false); + } + if (maxPageSize != null) { + requestOptions.addQueryParam("maxpagesize", String.valueOf(maxPageSize), false); + } + return getOperationsWithResponse(projectName, requestOptions).getValue().toObject(PagedOperation.class); + } + + /** + * List tool runs. + * + * @param projectName Name of the associated Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged collection of Operation items. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedOperation getOperations(String projectName) { + // Generated convenience method for getOperationsWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getOperationsWithResponse(projectName, requestOptions).getValue().toObject(PagedOperation.class); + } + + /** + * Examine compute usage. + * + * @param projectName Name of the associated Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return overview of compute usage for a project. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public ComputeUsage getComputeUsage(String projectName) { + // Generated convenience method for getComputeUsageWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getComputeUsageWithResponse(projectName, requestOptions).getValue().toObject(ComputeUsage.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/WorkspaceClientBuilder.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/WorkspaceClientBuilder.java new file mode 100644 index 000000000000..a484434498a0 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/WorkspaceClientBuilder.java @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.implementation.WorkspaceClientImpl; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.client.traits.TokenCredentialTrait; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * A builder for creating a new instance of the WorkspaceClient type. + */ +@ServiceClientBuilder( + serviceClients = { + InvestigationsClient.class, + ConversationsClient.class, + ToolsClient.class, + TasksClient.class, + InvestigationsAsyncClient.class, + ConversationsAsyncClient.class, + ToolsAsyncClient.class, + TasksAsyncClient.class }) +public final class WorkspaceClientBuilder + implements HttpTrait, ConfigurationTrait, + TokenCredentialTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final String[] DEFAULT_SCOPES = new String[] { "https://discovery.azure.com/.default" }; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("azure-ai-discovery.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the WorkspaceClientBuilder. + */ + @Generated + public WorkspaceClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WorkspaceClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WorkspaceClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WorkspaceClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WorkspaceClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WorkspaceClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WorkspaceClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WorkspaceClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The TokenCredential used for authentication. + */ + @Generated + private TokenCredential tokenCredential; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WorkspaceClientBuilder credential(TokenCredential tokenCredential) { + this.tokenCredential = tokenCredential; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public WorkspaceClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * Service version + */ + @Generated + private DiscoveryServiceVersion serviceVersion; + + /** + * Sets Service version. + * + * @param serviceVersion the serviceVersion value. + * @return the WorkspaceClientBuilder. + */ + @Generated + public WorkspaceClientBuilder serviceVersion(DiscoveryServiceVersion serviceVersion) { + this.serviceVersion = serviceVersion; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the WorkspaceClientBuilder. + */ + @Generated + public WorkspaceClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of WorkspaceClientImpl with the provided parameters. + * + * @return an instance of WorkspaceClientImpl. + */ + @Generated + private WorkspaceClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + DiscoveryServiceVersion localServiceVersion + = (serviceVersion != null) ? serviceVersion : DiscoveryServiceVersion.getLatest(); + WorkspaceClientImpl client = new WorkspaceClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint, localServiceVersion); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of InvestigationsAsyncClient class. + * + * @return an instance of InvestigationsAsyncClient. + */ + @Generated + public InvestigationsAsyncClient buildInvestigationsAsyncClient() { + return new InvestigationsAsyncClient(buildInnerClient().getInvestigations()); + } + + /** + * Builds an instance of ConversationsAsyncClient class. + * + * @return an instance of ConversationsAsyncClient. + */ + @Generated + public ConversationsAsyncClient buildConversationsAsyncClient() { + return new ConversationsAsyncClient(buildInnerClient().getConversations()); + } + + /** + * Builds an instance of ToolsAsyncClient class. + * + * @return an instance of ToolsAsyncClient. + */ + @Generated + public ToolsAsyncClient buildToolsAsyncClient() { + return new ToolsAsyncClient(buildInnerClient().getTools()); + } + + /** + * Builds an instance of TasksAsyncClient class. + * + * @return an instance of TasksAsyncClient. + */ + @Generated + public TasksAsyncClient buildTasksAsyncClient() { + return new TasksAsyncClient(buildInnerClient().getTasks()); + } + + /** + * Builds an instance of InvestigationsClient class. + * + * @return an instance of InvestigationsClient. + */ + @Generated + public InvestigationsClient buildInvestigationsClient() { + return new InvestigationsClient(buildInnerClient().getInvestigations()); + } + + /** + * Builds an instance of ConversationsClient class. + * + * @return an instance of ConversationsClient. + */ + @Generated + public ConversationsClient buildConversationsClient() { + return new ConversationsClient(buildInnerClient().getConversations()); + } + + /** + * Builds an instance of ToolsClient class. + * + * @return an instance of ToolsClient. + */ + @Generated + public ToolsClient buildToolsClient() { + return new ToolsClient(buildInnerClient().getTools()); + } + + /** + * Builds an instance of TasksClient class. + * + * @return an instance of TasksClient. + */ + @Generated + public TasksClient buildTasksClient() { + return new TasksClient(buildInnerClient().getTasks()); + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceClientBuilder.class); +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/BookshelfClientImpl.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/BookshelfClientImpl.java new file mode 100644 index 000000000000..e9c00bf7f14e --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/BookshelfClientImpl.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation; + +import com.azure.ai.discovery.DiscoveryServiceVersion; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; + +/** + * Initializes a new instance of the BookshelfClient type. + */ +public final class BookshelfClientImpl { + /** + * Supported Microsoft Bookshelf Services endpoints (protocol and hostname, for example: + * https://{bookshelfName}.discovery.azure.com). + */ + private final String endpoint; + + /** + * Gets Supported Microsoft Bookshelf Services endpoints (protocol and hostname, for example: + * https://{bookshelfName}.discovery.azure.com). + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final DiscoveryServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public DiscoveryServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The KnowledgeBasesImpl object to access its operations. + */ + private final KnowledgeBasesImpl knowledgeBases; + + /** + * Gets the KnowledgeBasesImpl object to access its operations. + * + * @return the KnowledgeBasesImpl object. + */ + public KnowledgeBasesImpl getKnowledgeBases() { + return this.knowledgeBases; + } + + /** + * Initializes an instance of BookshelfClient client. + * + * @param endpoint Supported Microsoft Bookshelf Services endpoints (protocol and hostname, for example: + * https://{bookshelfName}.discovery.azure.com). + * @param serviceVersion Service version. + */ + public BookshelfClientImpl(String endpoint, DiscoveryServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of BookshelfClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Supported Microsoft Bookshelf Services endpoints (protocol and hostname, for example: + * https://{bookshelfName}.discovery.azure.com). + * @param serviceVersion Service version. + */ + public BookshelfClientImpl(HttpPipeline httpPipeline, String endpoint, DiscoveryServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of BookshelfClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Supported Microsoft Bookshelf Services endpoints (protocol and hostname, for example: + * https://{bookshelfName}.discovery.azure.com). + * @param serviceVersion Service version. + */ + public BookshelfClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + DiscoveryServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.knowledgeBases = new KnowledgeBasesImpl(this); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/ConversationsImpl.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/ConversationsImpl.java new file mode 100644 index 000000000000..30de997071d3 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/ConversationsImpl.java @@ -0,0 +1,607 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation; + +import com.azure.ai.discovery.DiscoveryServiceVersion; +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.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.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.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Conversations. + */ +public final class ConversationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ConversationsService service; + + /** + * The service client containing this operation class. + */ + private final WorkspaceClientImpl client; + + /** + * Initializes an instance of ConversationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ConversationsImpl(WorkspaceClientImpl client) { + this.service + = RestProxy.create(ConversationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public DiscoveryServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for WorkspaceClientConversations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "WorkspaceClientConversations") + public interface ConversationsService { + @Get("/conversations/{conversationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("conversationName") String conversationName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/conversations/{conversationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("conversationName") String conversationName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/conversations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData createRequest, + RequestOptions requestOptions, Context context); + + @Post("/conversations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData createRequest, + RequestOptions requestOptions, Context context); + + @Patch("/conversations/{conversationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> stableUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("conversationName") String conversationName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Patch("/conversations/{conversationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response stableUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("conversationName") String conversationName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Delete("/conversations/{conversationName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("conversationName") String conversationName, + RequestOptions requestOptions, Context context); + + @Delete("/conversations/{conversationName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("conversationName") String conversationName, RequestOptions requestOptions, Context context); + + @Get("/conversations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/conversations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + } + + /** + * Fetch a Conversation by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param conversationName The conversation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a conversation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String conversationName, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), conversationName, accept, requestOptions, context)); + } + + /** + * Fetch a Conversation by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param conversationName The conversation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a conversation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String conversationName, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + conversationName, accept, requestOptions, Context.NONE); + } + + /** + * Creates a Conversation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     projectName: String (Required)
+     *     investigationName: String (Optional)
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param createRequest The createRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a conversation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(BinaryData createRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.create(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), contentType, accept, createRequest, requestOptions, context)); + } + + /** + * Creates a Conversation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     projectName: String (Required)
+     *     investigationName: String (Optional)
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param createRequest The createRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a conversation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(BinaryData createRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), contentType, + accept, createRequest, requestOptions, Context.NONE); + } + + /** + * Updates a Conversation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param conversationName The conversation name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a conversation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stableUpdateWithResponseAsync(String conversationName, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.stableUpdate(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + conversationName, contentType, accept, resource, requestOptions, context)); + } + + /** + * Updates a Conversation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     displayName: String (Optional)
+     *     investigationName: String (Optional)
+     *     projectName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param conversationName The conversation name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a conversation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stableUpdateWithResponse(String conversationName, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.stableUpdateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + conversationName, contentType, accept, resource, requestOptions, Context.NONE); + } + + /** + * Deletes a Conversation. + * + * @param conversationName The conversation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String conversationName, RequestOptions requestOptions) { + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), conversationName, requestOptions, context)); + } + + /** + * Deletes a Conversation. + * + * @param conversationName The conversation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String conversationName, RequestOptions requestOptions) { + return service.deleteSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + conversationName, requestOptions, Context.NONE); + } + + /** + * List Conversation resources. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
investigationNameStringNoThe name of the associated Investigation
projectNameStringNoThe name of the associated Project
createdSinceOffsetDateTimeNoThe oldest creation timestamp to keep
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             name: String (Required)
+     *             createdAt: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             createdByType: String(User/Application/System) (Optional)
+     *             lastModifiedAt: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             lastModifiedByType: String(User/Application/System) (Optional)
+     *             displayName: String (Optional)
+     *             investigationName: String (Optional)
+     *             projectName: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Conversation items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)); + } + + /** + * List Conversation resources. + *

Query Parameters

+ * + * + * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
investigationNameStringNoThe name of the associated Investigation
projectNameStringNoThe name of the associated Project
createdSinceOffsetDateTimeNoThe oldest creation timestamp to keep
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             name: String (Required)
+     *             createdAt: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             createdByType: String(User/Application/System) (Optional)
+     *             lastModifiedAt: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             lastModifiedByType: String(User/Application/System) (Optional)
+     *             displayName: String (Optional)
+     *             investigationName: String (Optional)
+     *             projectName: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Conversation items along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/InvestigationsImpl.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/InvestigationsImpl.java new file mode 100644 index 000000000000..b16b53d09bae --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/InvestigationsImpl.java @@ -0,0 +1,1612 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation; + +import com.azure.ai.discovery.DiscoveryServiceVersion; +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.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Investigations. + */ +public final class InvestigationsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final InvestigationsService service; + + /** + * The service client containing this operation class. + */ + private final WorkspaceClientImpl client; + + /** + * Initializes an instance of InvestigationsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InvestigationsImpl(WorkspaceClientImpl client) { + this.service + = RestProxy.create(InvestigationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public DiscoveryServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for WorkspaceClientInvestigations to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "WorkspaceClientInvestigations") + public interface InvestigationsService { + @Get("/projects/{projectName}/investigations/{investigationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/projects/{projectName}/investigations/{investigationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/projects/{projectName}/investigations/{investigationName}/operations/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getOperationStatus(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/projects/{projectName}/investigations/{investigationName}/operations/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getOperationStatusSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Put("/projects/{projectName}/investigations/{investigationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData resource, + RequestOptions requestOptions, Context context); + + @Put("/projects/{projectName}/investigations/{investigationName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrReplaceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData resource, + RequestOptions requestOptions, Context context); + + @Patch("/projects/{projectName}/investigations/{investigationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData resource, + RequestOptions requestOptions, Context context); + + @Patch("/projects/{projectName}/investigations/{investigationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/merge-patch+json") BinaryData resource, + RequestOptions requestOptions, Context context); + + @Delete("/projects/{projectName}/investigations/{investigationName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Delete("/projects/{projectName}/investigations/{investigationName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/projects/{projectName}/investigations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/projects/{projectName}/investigations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/projects/{projectName}/investigations/{investigationName}/discoveryEngine") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDiscoveryEngine(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/projects/{projectName}/investigations/{investigationName}/discoveryEngine") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDiscoveryEngineSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/projects/{projectName}/investigations/{investigationName}/discoveryEngine/workingMemory") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDiscoveryEngineMemory(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/projects/{projectName}/investigations/{investigationName}/discoveryEngine/workingMemory") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDiscoveryEngineMemorySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/projects/{projectName}/investigations/{investigationName}/discoveryEngine:start") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> startDiscoveryEngine(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/projects/{projectName}/investigations/{investigationName}/discoveryEngine:start") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response startDiscoveryEngineSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/projects/{projectName}/investigations/{investigationName}/discoveryEngine:stop") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> stopDiscoveryEngine(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/projects/{projectName}/investigations/{investigationName}/discoveryEngine:stop") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response stopDiscoveryEngineSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Patch("/projects/{projectName}/investigations/{investigationName}/discoveryEngine") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateDiscoveryEngine(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/projects/{projectName}/investigations/{investigationName}/discoveryEngine") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateDiscoveryEngineSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + } + + /** + * Fetch a Investigation by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a investigation list item along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String projectName, String investigationName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, accept, requestOptions, context)); + } + + /** + * Fetch a Investigation by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a investigation list item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), projectName, + investigationName, accept, requestOptions, Context.NONE); + } + + /** + * Get the status of a long-running operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         projectName: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String(User/Application/System) (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *         lastModifiedBy: String (Optional)
+     *         lastModifiedByType: String(User/Application/System) (Optional)
+     *         status: String(Created/Validated/Failed) (Optional)
+     *         description: String (Optional)
+     *         tags (Optional): [
+     *              (Optional){
+     *                 key: String (Optional)
+     *                 value: String (Optional)
+     *             }
+     *         ]
+     *         displayName: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param operationId The unique ID of the operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the status of a long-running operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationStatusWithResponseAsync(String projectName, String investigationName, + String operationId, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getOperationStatus(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, investigationName, operationId, accept, + requestOptions, context)); + } + + /** + * Get the status of a long-running operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         name: String (Required)
+     *         projectName: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         createdByType: String(User/Application/System) (Optional)
+     *         lastModifiedAt: OffsetDateTime (Optional)
+     *         lastModifiedBy: String (Optional)
+     *         lastModifiedByType: String(User/Application/System) (Optional)
+     *         status: String(Created/Validated/Failed) (Optional)
+     *         description: String (Optional)
+     *         tags (Optional): [
+     *              (Optional){
+     *                 key: String (Optional)
+     *                 value: String (Optional)
+     *             }
+     *         ]
+     *         displayName: String (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param operationId The unique ID of the operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the status of a long-running operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationStatusWithResponse(String projectName, String investigationName, + String operationId, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getOperationStatusSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, operationId, accept, requestOptions, Context.NONE); + } + + /** + * Creates an Investigation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a investigation list item along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createOrReplaceWithResponseAsync(String projectName, String investigationName, + BinaryData resource, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.createOrReplace(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, contentType, accept, resource, requestOptions, context)); + } + + /** + * Creates an Investigation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a investigation list item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrReplaceWithResponse(String projectName, String investigationName, + BinaryData resource, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrReplaceSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, contentType, accept, resource, requestOptions, Context.NONE); + } + + /** + * Updates an Investigation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a investigation list item along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateWithResponseAsync(String projectName, String investigationName, + BinaryData resource, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.update(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, contentType, accept, resource, requestOptions, context)); + } + + /** + * Updates an Investigation. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     projectName: String (Required)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     status: String(Created/Validated/Failed) (Optional)
+     *     description: String (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     displayName: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a investigation list item along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String projectName, String investigationName, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), projectName, + investigationName, contentType, accept, resource, requestOptions, Context.NONE); + } + + /** + * Delete a Investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String projectName, String investigationName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.delete(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, accept, requestOptions, context)); + } + + /** + * Delete a Investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), projectName, + investigationName, accept, requestOptions, Context.NONE); + } + + /** + * Delete a Investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDeleteWithModelAsync(String projectName, + String investigationName, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.deleteWithResponseAsync(projectName, investigationName, requestOptions), + new com.azure.ai.discovery.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Void.class)); + } + + /** + * Delete a Investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDeleteWithModel(String projectName, String investigationName, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.deleteWithResponse(projectName, investigationName, requestOptions), + new com.azure.ai.discovery.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(Void.class)); + } + + /** + * Delete a Investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDeleteAsync(String projectName, String investigationName, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.deleteWithResponseAsync(projectName, investigationName, requestOptions), + new com.azure.ai.discovery.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(Void.class)); + } + + /** + * Delete a Investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDelete(String projectName, String investigationName, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.deleteWithResponse(projectName, investigationName, requestOptions), + new com.azure.ai.discovery.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(Void.class)); + } + + /** + * List Investigation resources. + *

Query Parameters

+ * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
createdSinceOffsetDateTimeNoThe oldest creation timestamp to keep
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             name: String (Required)
+     *             projectName: String (Required)
+     *             createdAt: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             createdByType: String(User/Application/System) (Optional)
+     *             lastModifiedAt: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             lastModifiedByType: String(User/Application/System) (Optional)
+     *             status: String(Created/Validated/Failed) (Optional)
+     *             description: String (Optional)
+     *             tags (Optional): [
+     *                  (Optional){
+     *                     key: String (Optional)
+     *                     value: String (Optional)
+     *                 }
+     *             ]
+     *             displayName: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Investigation items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> listWithResponseAsync(String projectName, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.list(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, accept, requestOptions, context)); + } + + /** + * List Investigation resources. + *

Query Parameters

+ * + * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
createdSinceOffsetDateTimeNoThe oldest creation timestamp to keep
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             name: String (Required)
+     *             projectName: String (Required)
+     *             createdAt: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *             createdByType: String(User/Application/System) (Optional)
+     *             lastModifiedAt: OffsetDateTime (Optional)
+     *             lastModifiedBy: String (Optional)
+     *             lastModifiedByType: String(User/Application/System) (Optional)
+     *             status: String(Created/Validated/Failed) (Optional)
+     *             description: String (Optional)
+     *             tags (Optional): [
+     *                  (Optional){
+     *                     key: String (Optional)
+     *                     value: String (Optional)
+     *                 }
+     *             ]
+     *             displayName: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Investigation items along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String projectName, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.listSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), projectName, + accept, requestOptions, Context.NONE); + } + + /** + * Get the discovery engine for an investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the discovery engine for an investigation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDiscoveryEngineWithResponseAsync(String projectName, String investigationName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getDiscoveryEngine(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, investigationName, accept, requestOptions, + context)); + } + + /** + * Get the discovery engine for an investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the discovery engine for an investigation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDiscoveryEngineWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDiscoveryEngineSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, accept, requestOptions, Context.NONE); + } + + /** + * List discovery engine working memory entries for an investigation. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             content: String (Required)
+     *             type: String(Thought) (Required)
+     *             createdAt: OffsetDateTime (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of WorkingMemoryEntry items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDiscoveryEngineMemoryWithResponseAsync(String projectName, + String investigationName, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getDiscoveryEngineMemory(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, investigationName, accept, requestOptions, + context)); + } + + /** + * List discovery engine working memory entries for an investigation. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             content: String (Required)
+     *             type: String(Thought) (Required)
+     *             createdAt: OffsetDateTime (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of WorkingMemoryEntry items along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDiscoveryEngineMemoryWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getDiscoveryEngineMemorySync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, investigationName, accept, requestOptions, + Context.NONE); + } + + /** + * Start the discovery engine for an investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return discovery engine instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> startDiscoveryEngineWithResponseAsync(String projectName, + String investigationName, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.startDiscoveryEngine(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, investigationName, accept, requestOptions, + context)); + } + + /** + * Start the discovery engine for an investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return discovery engine instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startDiscoveryEngineWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.startDiscoveryEngineSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, accept, requestOptions, Context.NONE); + } + + /** + * Stop the discovery engine for an investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return discovery engine instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stopDiscoveryEngineWithResponseAsync(String projectName, String investigationName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.stopDiscoveryEngine(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, investigationName, accept, requestOptions, + context)); + } + + /** + * Stop the discovery engine for an investigation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return discovery engine instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopDiscoveryEngineWithResponse(String projectName, String investigationName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.stopDiscoveryEngineSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, accept, requestOptions, Context.NONE); + } + + /** + * Update the discovery engine for an investigation. This will create the discovery engine if it does not already + * exist. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param body The discovery engine update request. This will create the discovery engine if it does not already + * exist. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return discovery engine instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateDiscoveryEngineWithResponseAsync(String projectName, + String investigationName, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.updateDiscoveryEngine(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, investigationName, contentType, accept, body, + requestOptions, context)); + } + + /** + * Update the discovery engine for an investigation. This will create the discovery engine if it does not already + * exist. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     discoveryEngineStatus: String(Inactive/Active) (Required)
+     *     systemPrompt: String (Optional)
+     *     configuration (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param body The discovery engine update request. This will create the discovery engine if it does not already + * exist. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return discovery engine instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateDiscoveryEngineWithResponse(String projectName, String investigationName, + BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateDiscoveryEngineSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, investigationName, contentType, accept, body, + requestOptions, Context.NONE); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/JsonMergePatchHelper.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/JsonMergePatchHelper.java new file mode 100644 index 000000000000..eb7a4759e124 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/JsonMergePatchHelper.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation; + +import com.azure.ai.discovery.models.Conversation; +import com.azure.ai.discovery.models.ExecutionHistoryEntry; +import com.azure.ai.discovery.models.Investigation; +import com.azure.ai.discovery.models.KnowledgeBase; +import com.azure.ai.discovery.models.StorageAssetReference; +import com.azure.ai.discovery.models.Tag; +import com.azure.ai.discovery.models.Task; +import com.azure.ai.discovery.models.TaskAssignee; +import com.azure.ai.discovery.models.TaskComment; +import com.azure.ai.discovery.models.TaskResult; + +/** + * This is the Helper class to enable json merge patch serialization for a model. + */ +public class JsonMergePatchHelper { + private static InvestigationAccessor investigationAccessor; + + public interface InvestigationAccessor { + Investigation prepareModelForJsonMergePatch(Investigation investigation, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(Investigation investigation); + } + + public static void setInvestigationAccessor(InvestigationAccessor accessor) { + investigationAccessor = accessor; + } + + public static InvestigationAccessor getInvestigationAccessor() { + return investigationAccessor; + } + + private static TagAccessor tagAccessor; + + public interface TagAccessor { + Tag prepareModelForJsonMergePatch(Tag tag, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(Tag tag); + } + + public static void setTagAccessor(TagAccessor accessor) { + tagAccessor = accessor; + } + + public static TagAccessor getTagAccessor() { + return tagAccessor; + } + + private static ConversationAccessor conversationAccessor; + + public interface ConversationAccessor { + Conversation prepareModelForJsonMergePatch(Conversation conversation, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(Conversation conversation); + } + + public static void setConversationAccessor(ConversationAccessor accessor) { + conversationAccessor = accessor; + } + + public static ConversationAccessor getConversationAccessor() { + return conversationAccessor; + } + + private static TaskAccessor taskAccessor; + + public interface TaskAccessor { + Task prepareModelForJsonMergePatch(Task task, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(Task task); + } + + public static void setTaskAccessor(TaskAccessor accessor) { + taskAccessor = accessor; + } + + public static TaskAccessor getTaskAccessor() { + return taskAccessor; + } + + private static TaskAssigneeAccessor taskAssigneeAccessor; + + public interface TaskAssigneeAccessor { + TaskAssignee prepareModelForJsonMergePatch(TaskAssignee taskAssignee, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TaskAssignee taskAssignee); + } + + public static void setTaskAssigneeAccessor(TaskAssigneeAccessor accessor) { + taskAssigneeAccessor = accessor; + } + + public static TaskAssigneeAccessor getTaskAssigneeAccessor() { + return taskAssigneeAccessor; + } + + private static TaskCommentAccessor taskCommentAccessor; + + public interface TaskCommentAccessor { + TaskComment prepareModelForJsonMergePatch(TaskComment taskComment, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TaskComment taskComment); + } + + public static void setTaskCommentAccessor(TaskCommentAccessor accessor) { + taskCommentAccessor = accessor; + } + + public static TaskCommentAccessor getTaskCommentAccessor() { + return taskCommentAccessor; + } + + private static ExecutionHistoryEntryAccessor executionHistoryEntryAccessor; + + public interface ExecutionHistoryEntryAccessor { + ExecutionHistoryEntry prepareModelForJsonMergePatch(ExecutionHistoryEntry executionHistoryEntry, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(ExecutionHistoryEntry executionHistoryEntry); + } + + public static void setExecutionHistoryEntryAccessor(ExecutionHistoryEntryAccessor accessor) { + executionHistoryEntryAccessor = accessor; + } + + public static ExecutionHistoryEntryAccessor getExecutionHistoryEntryAccessor() { + return executionHistoryEntryAccessor; + } + + private static TaskResultAccessor taskResultAccessor; + + public interface TaskResultAccessor { + TaskResult prepareModelForJsonMergePatch(TaskResult taskResult, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(TaskResult taskResult); + } + + public static void setTaskResultAccessor(TaskResultAccessor accessor) { + taskResultAccessor = accessor; + } + + public static TaskResultAccessor getTaskResultAccessor() { + return taskResultAccessor; + } + + private static KnowledgeBaseAccessor knowledgeBaseAccessor; + + public interface KnowledgeBaseAccessor { + KnowledgeBase prepareModelForJsonMergePatch(KnowledgeBase knowledgeBase, boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(KnowledgeBase knowledgeBase); + } + + public static void setKnowledgeBaseAccessor(KnowledgeBaseAccessor accessor) { + knowledgeBaseAccessor = accessor; + } + + public static KnowledgeBaseAccessor getKnowledgeBaseAccessor() { + return knowledgeBaseAccessor; + } + + private static StorageAssetReferenceAccessor storageAssetReferenceAccessor; + + public interface StorageAssetReferenceAccessor { + StorageAssetReference prepareModelForJsonMergePatch(StorageAssetReference storageAssetReference, + boolean jsonMergePatchEnabled); + + boolean isJsonMergePatch(StorageAssetReference storageAssetReference); + } + + public static void setStorageAssetReferenceAccessor(StorageAssetReferenceAccessor accessor) { + storageAssetReferenceAccessor = accessor; + } + + public static StorageAssetReferenceAccessor getStorageAssetReferenceAccessor() { + return storageAssetReferenceAccessor; + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/KnowledgeBasesImpl.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/KnowledgeBasesImpl.java new file mode 100644 index 000000000000..a8fde346bd65 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/KnowledgeBasesImpl.java @@ -0,0 +1,3045 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation; + +import com.azure.ai.discovery.DiscoveryServiceVersion; +import com.azure.ai.discovery.models.KnowledgeBase; +import com.azure.ai.discovery.models.KnowledgeBaseOperationResponse; +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.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.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.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +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.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.DefaultPollingStrategy; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncDefaultPollingStrategy; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in KnowledgeBases. + */ +public final class KnowledgeBasesImpl { + /** + * The proxy service used to perform REST calls. + */ + private final KnowledgeBasesService service; + + /** + * The service client containing this operation class. + */ + private final BookshelfClientImpl client; + + /** + * Initializes an instance of KnowledgeBasesImpl. + * + * @param client the instance of the service client containing this operation class. + */ + KnowledgeBasesImpl(BookshelfClientImpl client) { + this.service + = RestProxy.create(KnowledgeBasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public DiscoveryServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for BookshelfClientKnowledgeBases to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "BookshelfClientKnowledgeBases") + public interface KnowledgeBasesService { + @Patch("/knowledgeBases/{knowledgeBaseName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Patch("/knowledgeBases/{knowledgeBaseName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Get("/knowledgeBases/{knowledgeBaseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/knowledgeBases/{knowledgeBaseName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/knowledgeBases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/knowledgeBases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/knowledgeBases/{knowledgeBaseName}/operations/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getOperationStatus(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @PathParam("operationId") String operationId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/knowledgeBases/{knowledgeBaseName}/operations/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getOperationStatusSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @PathParam("operationId") String operationId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/knowledgeBases/{knowledgeBaseName}:startIndexing") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> startIndexing(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData startIndexingRequest, RequestOptions requestOptions, + Context context); + + @Post("/knowledgeBases/{knowledgeBaseName}:startIndexing") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response startIndexingSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData startIndexingRequest, RequestOptions requestOptions, + Context context); + + @Post("/knowledgeBases/{knowledgeBaseName}:cancelIndexing") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> cancelIndexing(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/knowledgeBases/{knowledgeBaseName}:cancelIndexing") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response cancelIndexingSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/knowledgeBases/{knowledgeBaseName}:search") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> search(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/knowledgeBases/{knowledgeBaseName}:search") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response searchSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Delete("/knowledgeBases/{knowledgeBaseName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Delete("/knowledgeBases/{knowledgeBaseName}") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("knowledgeBaseName") String knowledgeBaseName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Creates or updates a KnowledgeBase. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a knowledgeBase along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String knowledgeBaseName, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + knowledgeBaseName, contentType, accept, resource, requestOptions, context)); + } + + /** + * Creates or updates a KnowledgeBase. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a knowledgeBase along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String knowledgeBaseName, BinaryData resource, + RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + knowledgeBaseName, contentType, accept, resource, requestOptions, Context.NONE); + } + + /** + * Creates or updates a KnowledgeBase. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of a knowledgeBase. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateOrUpdateWithModelAsync( + String knowledgeBaseName, BinaryData resource, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.createOrUpdateWithResponseAsync(knowledgeBaseName, resource, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(KnowledgeBaseOperationResponse.class), + TypeReference.createInstance(KnowledgeBase.class)); + } + + /** + * Creates or updates a KnowledgeBase. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of a knowledgeBase. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller + beginCreateOrUpdateWithModel(String knowledgeBaseName, BinaryData resource, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.createOrUpdateWithResponse(knowledgeBaseName, resource, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(KnowledgeBaseOperationResponse.class), + TypeReference.createInstance(KnowledgeBase.class)); + } + + /** + * Creates or updates a KnowledgeBase. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of a knowledgeBase. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCreateOrUpdateAsync(String knowledgeBaseName, BinaryData resource, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.createOrUpdateWithResponseAsync(knowledgeBaseName, resource, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Creates or updates a KnowledgeBase. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of a knowledgeBase. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCreateOrUpdate(String knowledgeBaseName, BinaryData resource, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.createOrUpdateWithResponse(knowledgeBaseName, resource, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Fetch a KnowledgeBase by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a knowledgeBase along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String knowledgeBaseName, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), knowledgeBaseName, accept, requestOptions, context)); + } + + /** + * Fetch a KnowledgeBase by name. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a knowledgeBase along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String knowledgeBaseName, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + knowledgeBaseName, accept, requestOptions, Context.NONE); + } + + /** + * List KnowledgeBase resources. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of KnowledgeBase items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List KnowledgeBase resources. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of KnowledgeBase items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listSinglePageAsync(requestOptions), + nextLink -> listNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List KnowledgeBase resources. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of KnowledgeBase items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List KnowledgeBase resources. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of KnowledgeBase items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listSinglePage(requestOptions), + nextLink -> listNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Get the status of a long-running operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationType: String(Indexing/CancelIndexing/Search/Delete) (Required)
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param operationId The unique ID of the operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the status of a long-running operation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationStatusWithResponseAsync(String knowledgeBaseName, String operationId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getOperationStatus(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), knowledgeBaseName, operationId, accept, requestOptions, + context)); + } + + /** + * Get the status of a long-running operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     operationType: String(Indexing/CancelIndexing/Search/Delete) (Required)
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param operationId The unique ID of the operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the status of a long-running operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationStatusWithResponse(String knowledgeBaseName, String operationId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getOperationStatusSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + knowledgeBaseName, operationId, accept, requestOptions, Context.NONE); + } + + /** + * Start indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     nodePoolId: String (Optional)
+     *     projectId: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param startIndexingRequest The startIndexingRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> startIndexingWithResponseAsync(String knowledgeBaseName, + BinaryData startIndexingRequest, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return FluxUtil.withContext( + context -> service.startIndexing(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + knowledgeBaseName, contentType, accept, startIndexingRequest, requestOptionsLocal, context)); + } + + /** + * Start indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     nodePoolId: String (Optional)
+     *     projectId: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param startIndexingRequest The startIndexingRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response startIndexingWithResponse(String knowledgeBaseName, BinaryData startIndexingRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return service.startIndexingSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + knowledgeBaseName, contentType, accept, startIndexingRequest, requestOptionsLocal, Context.NONE); + } + + /** + * Start indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     nodePoolId: String (Optional)
+     *     projectId: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param startIndexingRequest The startIndexingRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginStartIndexingWithModelAsync(String knowledgeBaseName, + BinaryData startIndexingRequest, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.startIndexingWithResponseAsync(knowledgeBaseName, startIndexingRequest, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(KnowledgeBaseOperationResponse.class), + TypeReference.createInstance(Void.class)); + } + + /** + * Start indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     nodePoolId: String (Optional)
+     *     projectId: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param startIndexingRequest The startIndexingRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginStartIndexingWithModel(String knowledgeBaseName, + BinaryData startIndexingRequest, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.startIndexingWithResponse(knowledgeBaseName, startIndexingRequest, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(KnowledgeBaseOperationResponse.class), + TypeReference.createInstance(Void.class)); + } + + /** + * Start indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     nodePoolId: String (Optional)
+     *     projectId: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param startIndexingRequest The startIndexingRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginStartIndexingAsync(String knowledgeBaseName, + BinaryData startIndexingRequest, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.startIndexingWithResponseAsync(knowledgeBaseName, startIndexingRequest, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Start indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     nodePoolId: String (Optional)
+     *     projectId: String (Optional)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param startIndexingRequest The startIndexingRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginStartIndexing(String knowledgeBaseName, + BinaryData startIndexingRequest, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.startIndexingWithResponse(knowledgeBaseName, startIndexingRequest, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Cancel indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelIndexingWithResponseAsync(String knowledgeBaseName, + RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return FluxUtil.withContext(context -> service.cancelIndexing(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), knowledgeBaseName, accept, requestOptionsLocal, context)); + } + + /** + * Cancel indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response cancelIndexingWithResponse(String knowledgeBaseName, RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return service.cancelIndexingSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + knowledgeBaseName, accept, requestOptionsLocal, Context.NONE); + } + + /** + * Cancel indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCancelIndexingWithModelAsync(String knowledgeBaseName, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.cancelIndexingWithResponseAsync(knowledgeBaseName, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(KnowledgeBaseOperationResponse.class), + TypeReference.createInstance(Void.class)); + } + + /** + * Cancel indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCancelIndexingWithModel(String knowledgeBaseName, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.cancelIndexingWithResponse(knowledgeBaseName, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(KnowledgeBaseOperationResponse.class), + TypeReference.createInstance(Void.class)); + } + + /** + * Cancel indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCancelIndexingAsync(String knowledgeBaseName, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.cancelIndexingWithResponseAsync(knowledgeBaseName, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Cancel indexing. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         runId: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCancelIndexing(String knowledgeBaseName, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.cancelIndexingWithResponse(knowledgeBaseName, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Search the knowledge base. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     query: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param body The search request body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> searchWithResponseAsync(String knowledgeBaseName, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return FluxUtil.withContext( + context -> service.search(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + knowledgeBaseName, contentType, accept, body, requestOptionsLocal, context)); + } + + /** + * Search the knowledge base. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     query: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param body The search request body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response searchWithResponse(String knowledgeBaseName, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-request-id")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-request-id"), CoreUtils.randomUuid().toString()); + } + }); + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getHeaders().get(HttpHeaderName.fromString("repeatability-first-sent")) == null) { + requestLocal.getHeaders() + .set(HttpHeaderName.fromString("repeatability-first-sent"), + DateTimeRfc1123.toRfc1123String(OffsetDateTime.now())); + } + }); + return service.searchSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + knowledgeBaseName, contentType, accept, body, requestOptionsLocal, Context.NONE); + } + + /** + * Search the knowledge base. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     query: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param body The search request body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginSearchWithModelAsync(String knowledgeBaseName, + BinaryData body, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.searchWithResponseAsync(knowledgeBaseName, body, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(KnowledgeBaseOperationResponse.class), + TypeReference.createInstance(Void.class)); + } + + /** + * Search the knowledge base. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     query: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param body The search request body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginSearchWithModel(String knowledgeBaseName, + BinaryData body, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.searchWithResponse(knowledgeBaseName, body, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(KnowledgeBaseOperationResponse.class), + TypeReference.createInstance(Void.class)); + } + + /** + * Search the knowledge base. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     query: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param body The search request body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginSearchAsync(String knowledgeBaseName, BinaryData body, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.searchWithResponseAsync(knowledgeBaseName, body, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Search the knowledge base. + *

Header Parameters

+ * + * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
repeatability-request-idStringNoRepeatability request ID header
repeatability-first-sentStringNoRepeatability first sent header as + * HTTP-date
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     query: String (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param body The search request body. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginSearch(String knowledgeBaseName, BinaryData body, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.searchWithResponse(knowledgeBaseName, body, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Delete a KnowledgeBase. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String knowledgeBaseName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), knowledgeBaseName, accept, requestOptions, context)); + } + + /** + * Delete a KnowledgeBase. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String knowledgeBaseName, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + knowledgeBaseName, accept, requestOptions, Context.NONE); + } + + /** + * Delete a KnowledgeBase. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDeleteWithModelAsync(String knowledgeBaseName, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.deleteWithResponseAsync(knowledgeBaseName, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(KnowledgeBaseOperationResponse.class), + TypeReference.createInstance(Void.class)); + } + + /** + * Delete a KnowledgeBase. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDeleteWithModel(String knowledgeBaseName, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.deleteWithResponse(knowledgeBaseName, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(KnowledgeBaseOperationResponse.class), + TypeReference.createInstance(Void.class)); + } + + /** + * Delete a KnowledgeBase. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginDeleteAsync(String knowledgeBaseName, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.deleteWithResponseAsync(knowledgeBaseName, requestOptions), + new DefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(Void.class)); + } + + /** + * Delete a KnowledgeBase. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param knowledgeBaseName The knowledgeBase name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginDelete(String knowledgeBaseName, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.deleteWithResponse(knowledgeBaseName, requestOptions), + new SyncDefaultPollingStrategy<>(new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(Void.class)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of KnowledgeBase items along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     id: String (Optional)
+     *     bookshelfName: String (Required)
+     *     storageAssetReferences (Optional): [
+     *          (Optional){
+     *             id: String (Optional, Required on create)
+     *             userAssignedIdentity: String (Optional)
+     *         }
+     *     ]
+     *     knowledgeBaseUrl: String (Optional)
+     *     provisioningState: String(Succeeded/Failed/Canceled/Accepted/Provisioning/Updating/Deleting) (Optional)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *     createdByApiVersion: String (Optional)
+     *     lastIndexingRun (Optional): {
+     *         runId: String (Optional)
+     *         status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Optional)
+     *         error (Optional): (recursive schema, see error above)
+     *         indexingMetrics (Optional): {
+     *             documentsProcessed: int (Required)
+     *             documentsFailed: int (Required)
+     *             documentsTotal: int (Required)
+     *             indexingPercentageComplete: int (Required)
+     *             enrichmentStartTimeUtc: OffsetDateTime (Optional)
+     *             enrichmentEndTimeUtc: OffsetDateTime (Optional)
+     *             indexingStartTimeUtc: OffsetDateTime (Optional)
+     *             indexingEndTimeUtc: OffsetDateTime (Optional)
+     *         }
+     *     }
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     tags (Optional): [
+     *          (Optional){
+     *             key: String (Optional)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     *     description: String (Optional, Required on create)
+     *     copilotInstruction: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of KnowledgeBase items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/OperationLocationPollingStrategy.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/OperationLocationPollingStrategy.java new file mode 100644 index 000000000000..502fbd1d9bb7 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/OperationLocationPollingStrategy.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.OperationResourcePollingStrategy; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +/** + * Implements an operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class OperationLocationPollingStrategy extends OperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(OperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public OperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public Mono> onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + final Mono> pollResponseMono + = PollingUtils.deserializeResponse((BinaryData) response.getValue(), serializer, pollResponseType) + .onErrorResume(exception -> { + LOGGER.info("Failed to parse initial response."); + return Mono.empty(); + }) + .map(value -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, value, retryAfter)); + return pollResponseMono.switchIfEmpty( + Mono.fromSupplier(() -> new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null, retryAfter))); + } else { + return Mono + .error( + new AzureException(String.format( + "Operation failed or cancelled with status code %d," + + ", '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + } + + /** + * {@inheritDoc} + */ + @Override + public Mono getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + return Mono.error(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + return Mono.error(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + return PollingUtils + .deserializeResponse(latestResponseBody, serializer, PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE) + .flatMap(value -> { + if (value.get(propertyName) != null) { + return BinaryData.fromObjectAsync(value.get(propertyName)) + .flatMap(result -> PollingUtils.deserializeResponse(result, serializer, resultType)); + } else { + return Mono.error(new AzureException("Cannot get final result")); + } + }) + .switchIfEmpty(Mono.error(new AzureException("Cannot get final result"))); + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/PollingUtils.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/PollingUtils.java new file mode 100644 index 000000000000..0c9c2c8a8976 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/PollingUtils.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.DateTimeRfc1123; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.net.URI; +import java.net.URISyntaxException; +import java.time.DateTimeException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; +import reactor.core.publisher.Mono; + +// DO NOT modify this helper class + +final class PollingUtils { + + public static final TypeReference> POST_POLL_RESULT_TYPE_REFERENCE + = new TypeReference>() { + }; + + public static final HttpHeaderName OPERATION_LOCATION_HEADER = HttpHeaderName.fromString("Operation-Location"); + + public static final String HTTP_METHOD = "httpMethod"; + public static final String REQUEST_URL = "requestURL"; + public static final String POLL_RESPONSE_BODY = "pollResponseBody"; + + private static final String FORWARD_SLASH = "/"; + + public static String getAbsolutePath(String path, String endpoint, ClientLogger logger) { + try { + URI uri = new URI(path); + if (!uri.isAbsolute()) { + if (CoreUtils.isNullOrEmpty(endpoint)) { + throw logger.logExceptionAsError(new IllegalArgumentException( + "Relative path requires endpoint to be non-null and non-empty to create an absolute path.")); + } + + if (endpoint.endsWith(FORWARD_SLASH) && path.startsWith(FORWARD_SLASH)) { + return endpoint + path.substring(1); + } else if (!endpoint.endsWith(FORWARD_SLASH) && !path.startsWith(FORWARD_SLASH)) { + return endpoint + FORWARD_SLASH + path; + } else { + return endpoint + path; + } + } + } catch (URISyntaxException ex) { + throw logger.logExceptionAsWarning(new IllegalArgumentException("'path' must be a valid URI.", ex)); + } + return path; + } + + public static T deserializeResponseSync(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + T value; + if (binaryData == null) { + value = null; + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = typeReference.getJavaClass().cast(binaryData.toReplayableBinaryData()); + } else { + value = binaryData.toObject(typeReference, serializer); + } + return value; + } + + @SuppressWarnings("unchecked") + public static Mono deserializeResponse(BinaryData binaryData, ObjectSerializer serializer, + TypeReference typeReference) { + Mono value; + if (binaryData == null) { + value = Mono.empty(); + } else if (typeReference.getJavaClass().isAssignableFrom(BinaryData.class)) { + // T is BinaryData + value = (Mono) binaryData.toReplayableBinaryDataAsync(); + } else { + value = binaryData.toObjectAsync(typeReference, serializer); + } + return value; + } + + private static final HttpHeaderName RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("retry-after-ms"); + private static final HttpHeaderName X_MS_RETRY_AFTER_MS_HEADER = HttpHeaderName.fromString("x-ms-retry-after-ms"); + + public static Duration getRetryAfterFromHeaders(HttpHeaders headers, Supplier nowSupplier) { + // Found 'x-ms-retry-after-ms' header, use a Duration of milliseconds based on the value. + Duration retryDelay = tryGetRetryDelay(headers, X_MS_RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'retry-after-ms' header, use a Duration of milliseconds based on the value. + retryDelay = tryGetRetryDelay(headers, RETRY_AFTER_MS_HEADER, s -> tryGetDelayMillis(s)); + if (retryDelay != null) { + return retryDelay; + } + + // Found 'Retry-After' header. First, attempt to resolve it as a Duration of seconds. If that fails, then + // attempt to resolve it as an HTTP date (RFC1123). + retryDelay = tryGetRetryDelay(headers, HttpHeaderName.RETRY_AFTER, + headerValue -> tryParseLongOrDateTime(headerValue, nowSupplier)); + + // Either the retry delay will have been found or it'll be null, null indicates no retry after. + return retryDelay; + } + + private static Duration tryGetRetryDelay(HttpHeaders headers, HttpHeaderName headerName, + Function delayParser) { + String headerValue = headers.getValue(headerName); + + return CoreUtils.isNullOrEmpty(headerValue) ? null : delayParser.apply(headerValue); + } + + private static Duration tryParseLongOrDateTime(String value, Supplier nowSupplier) { + long delaySeconds; + try { + OffsetDateTime retryAfter = new DateTimeRfc1123(value).getDateTime(); + + delaySeconds = nowSupplier.get().until(retryAfter, ChronoUnit.SECONDS); + } catch (DateTimeException ex) { + delaySeconds = tryParseLong(value); + } + + return (delaySeconds >= 0) ? Duration.ofSeconds(delaySeconds) : null; + } + + private static long tryParseLong(String value) { + try { + return Long.parseLong(value); + } catch (NumberFormatException ex) { + return -1; + } + } + + private static Duration tryGetDelayMillis(String value) { + long delayMillis = tryParseLong(value); + return (delayMillis >= 0) ? Duration.ofMillis(delayMillis) : null; + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/SyncOperationLocationPollingStrategy.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/SyncOperationLocationPollingStrategy.java new file mode 100644 index 000000000000..48316b528800 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/SyncOperationLocationPollingStrategy.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation; + +import com.azure.core.exception.AzureException; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +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.PollingContext; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncOperationResourcePollingStrategy; +import com.azure.core.util.serializer.JsonSerializerProviders; +import com.azure.core.util.serializer.ObjectSerializer; +import com.azure.core.util.serializer.TypeReference; +import java.io.UncheckedIOException; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Map; + +// DO NOT modify this helper class + +/** + * Implements a synchronous operation location polling strategy, from Operation-Location. + * + * @param the type of the response type from a polling call, or BinaryData if raw response body should be kept + * @param the type of the final result object to deserialize into, or BinaryData if raw response body should be + * kept + */ +public final class SyncOperationLocationPollingStrategy extends SyncOperationResourcePollingStrategy { + + private static final ClientLogger LOGGER = new ClientLogger(SyncOperationLocationPollingStrategy.class); + + private final ObjectSerializer serializer; + private final String endpoint; + private final String propertyName; + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions) { + this(pollingStrategyOptions, null); + } + + /** + * Creates an instance of the operation resource polling strategy. + * + * @param pollingStrategyOptions options to configure this polling strategy. + * @param propertyName the name of the property to extract final result. + * @throws NullPointerException if {@code pollingStrategyOptions} is null. + */ + public SyncOperationLocationPollingStrategy(PollingStrategyOptions pollingStrategyOptions, String propertyName) { + super(PollingUtils.OPERATION_LOCATION_HEADER, pollingStrategyOptions); + this.propertyName = propertyName; + this.endpoint = pollingStrategyOptions.getEndpoint(); + this.serializer = pollingStrategyOptions.getSerializer() != null + ? pollingStrategyOptions.getSerializer() + : JsonSerializerProviders.createInstance(true); + } + + /** + * {@inheritDoc} + */ + @Override + public PollResponse onInitialResponse(Response response, PollingContext pollingContext, + TypeReference pollResponseType) { + // Response is Response + + HttpHeader operationLocationHeader = response.getHeaders().get(PollingUtils.OPERATION_LOCATION_HEADER); + if (operationLocationHeader != null) { + pollingContext.setData(PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName(), + PollingUtils.getAbsolutePath(operationLocationHeader.getValue(), endpoint, LOGGER)); + } + final String httpMethod = response.getRequest().getHttpMethod().name(); + pollingContext.setData(PollingUtils.HTTP_METHOD, httpMethod); + pollingContext.setData(PollingUtils.REQUEST_URL, response.getRequest().getUrl().toString()); + + if (response.getStatusCode() == 200 + || response.getStatusCode() == 201 + || response.getStatusCode() == 202 + || response.getStatusCode() == 204) { + final Duration retryAfter + = PollingUtils.getRetryAfterFromHeaders(response.getHeaders(), OffsetDateTime::now); + T initialResponseType = null; + try { + initialResponseType = PollingUtils.deserializeResponseSync((BinaryData) response.getValue(), serializer, + pollResponseType); + } catch (UncheckedIOException e) { + LOGGER.info("Failed to parse initial response."); + } + return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, initialResponseType, retryAfter); + } + + throw LOGGER.logExceptionAsError(new AzureException( + String.format("Operation failed or cancelled with status code %d, '%s' header: %s, and response body: %s", + response.getStatusCode(), PollingUtils.OPERATION_LOCATION_HEADER, operationLocationHeader, + response.getValue()))); + } + + /** + * {@inheritDoc} + */ + public U getResult(PollingContext pollingContext, TypeReference resultType) { + if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.FAILED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation failed.")); + } else if (pollingContext.getLatestResponse().getStatus() == LongRunningOperationStatus.USER_CANCELLED) { + throw LOGGER.logExceptionAsError(new AzureException("Long running operation cancelled.")); + } + if (propertyName != null) { + // take the last poll response body from PollingContext, + // and de-serialize the property as final result + BinaryData latestResponseBody + = BinaryData.fromString(pollingContext.getData(PollingUtils.POLL_RESPONSE_BODY)); + Map pollResult = PollingUtils.deserializeResponseSync(latestResponseBody, serializer, + PollingUtils.POST_POLL_RESULT_TYPE_REFERENCE); + if (pollResult != null && pollResult.get(propertyName) != null) { + return PollingUtils.deserializeResponseSync(BinaryData.fromObject(pollResult.get(propertyName)), + serializer, resultType); + } else { + throw LOGGER.logExceptionAsError(new AzureException("Cannot get final result")); + } + } else { + return super.getResult(pollingContext, resultType); + } + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/TasksImpl.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/TasksImpl.java new file mode 100644 index 000000000000..239f6f4375ac --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/TasksImpl.java @@ -0,0 +1,2339 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation; + +import com.azure.ai.discovery.DiscoveryServiceVersion; +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.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.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.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaderName; +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.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Tasks. + */ +public final class TasksImpl { + /** + * The proxy service used to perform REST calls. + */ + private final TasksService service; + + /** + * The service client containing this operation class. + */ + private final WorkspaceClientImpl client; + + /** + * Initializes an instance of TasksImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TasksImpl(WorkspaceClientImpl client) { + this.service = RestProxy.create(TasksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public DiscoveryServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for WorkspaceClientTasks to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "WorkspaceClientTasks") + public interface TasksService { + @Get("/projects/{projectName}/investigations/{investigationName}/tasks/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("taskName") String taskName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/projects/{projectName}/investigations/{investigationName}/tasks/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("taskName") String taskName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/projects/{projectName}/investigations/{investigationName}/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/projects/{projectName}/investigations/{investigationName}/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/projects/{projectName}/investigations/{investigationName}/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Post("/projects/{projectName}/investigations/{investigationName}/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body, + RequestOptions requestOptions, Context context); + + @Patch("/projects/{projectName}/investigations/{investigationName}/tasks/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> stableUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("taskName") String taskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Patch("/projects/{projectName}/investigations/{investigationName}/tasks/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response stableUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("taskName") String taskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/merge-patch+json") BinaryData resource, RequestOptions requestOptions, + Context context); + + @Delete("/projects/{projectName}/investigations/{investigationName}/tasks/{taskName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("taskName") String taskName, + RequestOptions requestOptions, Context context); + + @Delete("/projects/{projectName}/investigations/{investigationName}/tasks/{taskName}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("projectName") String projectName, @PathParam("investigationName") String investigationName, + @PathParam("taskName") String taskName, RequestOptions requestOptions, Context context); + + @Post("/projects/{projectName}/investigations/{investigationName}/tasks/{taskName}:start") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> start(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("taskName") String taskName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/projects/{projectName}/investigations/{investigationName}/tasks/{taskName}:start") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response startSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("taskName") String taskName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Post("/projects/{projectName}/investigations/{investigationName}/tasks/{taskName}:addComment") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addComment(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("taskName") String taskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/projects/{projectName}/investigations/{investigationName}/tasks/{taskName}:addComment") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response addCommentSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("taskName") String taskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/projects/{projectName}/investigations/{investigationName}/tasks/{taskName}:addExecutionHistory") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> addExecutionHistory(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("taskName") String taskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Post("/projects/{projectName}/investigations/{investigationName}/tasks/{taskName}:addExecutionHistory") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response addExecutionHistorySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("investigationName") String investigationName, @PathParam("taskName") String taskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, RequestOptions requestOptions, + Context context); + } + + /** + * Get a task by ID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a task by ID along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWithResponseAsync(String projectName, String investigationName, + String taskName, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, taskName, accept, requestOptions, context)); + } + + /** + * Get a task by ID. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a task by ID along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String projectName, String investigationName, String taskName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), projectName, + investigationName, taskName, accept, requestOptions, Context.NONE); + } + + /** + * List tasks with optional OData filters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOData filter expression. Supported fields: investigationId, + * status, createdByType, priority, createdAt, lastModifiedAt. Example: status eq 'new' or status eq + * 'executing'
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Task items along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String projectName, String investigationName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * List tasks with optional OData filters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOData filter expression. Supported fields: investigationId, + * status, createdByType, priority, createdAt, lastModifiedAt. Example: status eq 'new' or status eq + * 'executing'
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Task items as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAsync(String projectName, String investigationName, + RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> listSinglePageAsync(projectName, investigationName, requestOptions), + nextLink -> listNextSinglePageAsync(nextLink, requestOptionsForNextPage)); + } + + /** + * List tasks with optional OData filters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOData filter expression. Supported fields: investigationId, + * status, createdByType, priority, createdAt, lastModifiedAt. Example: status eq 'new' or status eq + * 'executing'
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Task items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String projectName, String investigationName, + RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), projectName, + investigationName, accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + /** + * List tasks with optional OData filters. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
filterStringNoOData filter expression. Supported fields: investigationId, + * status, createdByType, priority, createdAt, lastModifiedAt. Example: status eq 'new' or status eq + * 'executing'
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Task items as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String projectName, String investigationName, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> listSinglePage(projectName, investigationName, requestOptions), + nextLink -> listNextSinglePage(nextLink, requestOptionsForNextPage)); + } + + /** + * Create a new task. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param body Task creation request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(String projectName, String investigationName, + BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.create(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, contentType, accept, body, requestOptions, context)); + } + + /** + * Create a new task. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param body Task creation request. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String projectName, String investigationName, BinaryData body, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), projectName, + investigationName, contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * Patch (partial update) a task (e.g. status, description, validation requirements, dependencies, result). + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> stableUpdateWithResponseAsync(String projectName, String investigationName, + String taskName, BinaryData resource, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.stableUpdate(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, taskName, contentType, accept, resource, requestOptions, context)); + } + + /** + * Patch (partial update) a task (e.g. status, description, validation requirements, dependencies, result). + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param resource The resource instance. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stableUpdateWithResponse(String projectName, String investigationName, String taskName, + BinaryData resource, RequestOptions requestOptions) { + final String contentType = "application/merge-patch+json"; + final String accept = "application/json"; + return service.stableUpdateSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, taskName, contentType, accept, resource, requestOptions, Context.NONE); + } + + /** + * Delete a task by ID. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteWithResponseAsync(String projectName, String investigationName, String taskName, + RequestOptions requestOptions) { + return FluxUtil.withContext( + context -> service.delete(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, taskName, requestOptions, context)); + } + + /** + * Delete a task by ID. + * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The unique identifier of the task. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String projectName, String investigationName, String taskName, + RequestOptions requestOptions) { + return service.deleteSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), projectName, + investigationName, taskName, requestOptions, Context.NONE); + } + + /** + * Start execution of a task. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     assignee (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> startWithResponseAsync(String projectName, String investigationName, + String taskName, RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); + } + }); + return FluxUtil.withContext( + context -> service.start(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, taskName, accept, requestOptionsLocal, context)); + } + + /** + * Start execution of a task. + *

Header Parameters

+ * + * + * + * + *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: + * "application/json".
+ * You can add these to a request with {@link RequestOptions#addHeader} + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     assignee (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response startWithResponse(String projectName, String investigationName, String taskName, + RequestOptions requestOptions) { + final String accept = "application/json"; + RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions; + requestOptionsLocal.addRequestCallback(requestLocal -> { + if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) { + requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/json"); + } + }); + return service.startSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), projectName, + investigationName, taskName, accept, requestOptionsLocal, Context.NONE); + } + + /** + * Add a comment to a task. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     timestamp: OffsetDateTime (Optional)
+     *     createdBy: String (Optional, Required on create)
+     *     createdByType: String(User/Application/System) (Optional, Required on create)
+     *     text: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Comment to add. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addCommentWithResponseAsync(String projectName, String investigationName, + String taskName, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.addComment(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, taskName, contentType, accept, body, requestOptions, context)); + } + + /** + * Add a comment to a task. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     timestamp: OffsetDateTime (Optional)
+     *     createdBy: String (Optional, Required on create)
+     *     createdByType: String(User/Application/System) (Optional, Required on create)
+     *     text: String (Optional, Required on create)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Comment to add. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addCommentWithResponse(String projectName, String investigationName, String taskName, + BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.addCommentSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, taskName, contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * Add an execution history entry to a task. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     createdAt: OffsetDateTime (Optional, Required on create)
+     *     action: String (Optional, Required on create)
+     *     createdBy: String (Optional, Required on create)
+     *     createdByType: String(User/Application/System) (Optional, Required on create)
+     *     summary: String (Optional)
+     *     responseMessageText: String (Optional)
+     *     responseMessageId: String (Optional)
+     *     additionalDetails (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Execution history entry to add. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> addExecutionHistoryWithResponseAsync(String projectName, String investigationName, + String taskName, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.addExecutionHistory(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, investigationName, taskName, contentType, accept, + body, requestOptions, context)); + } + + /** + * Add an execution history entry to a task. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     createdAt: OffsetDateTime (Optional, Required on create)
+     *     action: String (Optional, Required on create)
+     *     createdBy: String (Optional, Required on create)
+     *     createdByType: String(User/Application/System) (Optional, Required on create)
+     *     summary: String (Optional)
+     *     responseMessageText: String (Optional)
+     *     responseMessageId: String (Optional)
+     *     additionalDetails (Optional): {
+     *         String: BinaryData (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param projectName The project name. + * @param investigationName The investigation name. + * @param taskName The task name. + * @param body Execution history entry to add. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return task resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addExecutionHistoryWithResponse(String projectName, String investigationName, + String taskName, BinaryData body, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.addExecutionHistorySync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, investigationName, taskName, contentType, accept, body, requestOptions, Context.NONE); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Task items along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listNext(nextLink, this.client.getEndpoint(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); + } + + /** + * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     name: String (Required)
+     *     title: String (Optional)
+     *     priority: String(Low/Medium/High) (Optional)
+     *     description: String (Optional)
+     *     validationRequirements (Optional): [
+     *         String (Optional)
+     *     ]
+     *     parentId: String (Optional)
+     *     dependsOn (Optional): [
+     *         String (Optional)
+     *     ]
+     *     relatedTo (Optional): [
+     *         String (Optional)
+     *     ]
+     *     assignedTo (Optional): {
+     *         id: String (Optional, Required on create)
+     *         type: String(User/Application/System) (Optional, Required on create)
+     *     }
+     *     comments (Optional): [
+     *          (Optional){
+     *             timestamp: OffsetDateTime (Optional)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             text: String (Optional, Required on create)
+     *         }
+     *     ]
+     *     status: String(New/OnHold/Complete/Removed/FlaggedHuman/FlaggedAi/Executing/ExecutionDone/Stale/Failed/Incomplete) (Optional)
+     *     createdAt: OffsetDateTime (Optional)
+     *     createdBy: String (Optional)
+     *     createdByType: String(User/Application/System) (Optional)
+     *     lastModifiedAt: OffsetDateTime (Optional)
+     *     lastModifiedBy: String (Optional)
+     *     lastModifiedByType: String(User/Application/System) (Optional)
+     *     executionHistory (Optional): [
+     *          (Optional){
+     *             createdAt: OffsetDateTime (Optional, Required on create)
+     *             action: String (Optional, Required on create)
+     *             createdBy: String (Optional, Required on create)
+     *             createdByType: String(User/Application/System) (Optional, Required on create)
+     *             summary: String (Optional)
+     *             responseMessageText: String (Optional)
+     *             responseMessageId: String (Optional)
+     *             additionalDetails (Optional): {
+     *                 String: BinaryData (Required)
+     *             }
+     *         }
+     *     ]
+     *     investigationId: String (Optional)
+     *     taskResult (Optional): {
+     *         text: String (Optional)
+     *         storageAssetIds (Optional): [
+     *             String (Optional)
+     *         ]
+     *     }
+     *     storageAssetIds (Optional): [
+     *         String (Optional)
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param nextLink The URL to get the next list of items. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Task items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, RequestOptions requestOptions) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/ToolsImpl.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/ToolsImpl.java new file mode 100644 index 000000000000..77c1dcd1526e --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/ToolsImpl.java @@ -0,0 +1,1493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation; + +import com.azure.ai.discovery.DiscoveryServiceVersion; +import com.azure.ai.discovery.models.RunResult; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.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.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.PollingStrategyOptions; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.TypeReference; +import java.time.Duration; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in Tools. + */ +public final class ToolsImpl { + /** + * The proxy service used to perform REST calls. + */ + private final ToolsService service; + + /** + * The service client containing this operation class. + */ + private final WorkspaceClientImpl client; + + /** + * Initializes an instance of ToolsImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ToolsImpl(WorkspaceClientImpl client) { + this.service = RestProxy.create(ToolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public DiscoveryServiceVersion getServiceVersion() { + return client.getServiceVersion(); + } + + /** + * The interface defining all the services for WorkspaceClientTools to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "WorkspaceClientTools") + public interface ToolsService { + @Get("/tools/projects/{projectName}/operations/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getRunStatus(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("operationId") String operationId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/tools/projects/{projectName}/operations/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getRunStatusSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("operationId") String operationId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/tools/projects/{projectName}:run") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> run(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData runRequest, RequestOptions requestOptions, Context context); + + @Post("/tools/projects/{projectName}:run") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response runSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData runRequest, RequestOptions requestOptions, Context context); + + @Post("/tools/projects/{projectName}/operations/{operationId}:cancel") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> cancelRunLro(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("operationId") String operationId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Post("/tools/projects/{projectName}/operations/{operationId}:cancel") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response cancelRunLroSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @PathParam("operationId") String operationId, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); + + @Get("/tools/projects/{projectName}/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getOperations(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/tools/projects/{projectName}/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getOperationsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/tools/projects/{projectName}/computeUsage") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getComputeUsage(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/tools/projects/{projectName}/computeUsage") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getComputeUsageSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("projectName") String projectName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * Used for to poll status of a Tool run. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
logCountIntegerNoNumber of log lines to return (0-2500).
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param operationId The unique ID of the operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getRunStatusWithResponseAsync(String projectName, String operationId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getRunStatus(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, operationId, accept, requestOptions, context)); + } + + /** + * Used for to poll status of a Tool run. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
logCountIntegerNoNumber of log lines to return (0-2500).
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param operationId The unique ID of the operation. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRunStatusWithResponse(String projectName, String operationId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getRunStatusSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, operationId, accept, requestOptions, Context.NONE); + } + + /** + * Run the specified tool in the context of the specified project. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     toolId: String (Required)
+     *     command: String (Optional)
+     *     inlineFiles (Optional): [
+     *          (Optional){
+     *             mountPath: String (Required)
+     *             encodedFile: String (Required)
+     *         }
+     *     ]
+     *     inputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     outputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     nodePoolIds (Required): [
+     *         String (Required)
+     *     ]
+     *     infraOverrides (Optional): {
+     *         cpu: String (Optional)
+     *         ram: String (Optional)
+     *         gpu: String (Optional)
+     *         replicaCount: Integer (Optional)
+     *         imageUri: String (Optional)
+     *         maxCpu: String (Optional)
+     *         maxRam: String (Optional)
+     *         maxGpu: String (Optional)
+     *     }
+     *     environmentVariables (Optional): [
+     *          (Optional){
+     *             name: String (Required)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param runRequest The runRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> runWithResponseAsync(String projectName, BinaryData runRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.run(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, contentType, accept, runRequest, requestOptions, context)); + } + + /** + * Run the specified tool in the context of the specified project. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     toolId: String (Required)
+     *     command: String (Optional)
+     *     inlineFiles (Optional): [
+     *          (Optional){
+     *             mountPath: String (Required)
+     *             encodedFile: String (Required)
+     *         }
+     *     ]
+     *     inputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     outputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     nodePoolIds (Required): [
+     *         String (Required)
+     *     ]
+     *     infraOverrides (Optional): {
+     *         cpu: String (Optional)
+     *         ram: String (Optional)
+     *         gpu: String (Optional)
+     *         replicaCount: Integer (Optional)
+     *         imageUri: String (Optional)
+     *         maxCpu: String (Optional)
+     *         maxRam: String (Optional)
+     *         maxGpu: String (Optional)
+     *     }
+     *     environmentVariables (Optional): [
+     *          (Optional){
+     *             name: String (Required)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param runRequest The runRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return provides status details for long running operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response runWithResponse(String projectName, BinaryData runRequest, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.runSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), projectName, + contentType, accept, runRequest, requestOptions, Context.NONE); + } + + /** + * Run the specified tool in the context of the specified project. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     toolId: String (Required)
+     *     command: String (Optional)
+     *     inlineFiles (Optional): [
+     *          (Optional){
+     *             mountPath: String (Required)
+     *             encodedFile: String (Required)
+     *         }
+     *     ]
+     *     inputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     outputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     nodePoolIds (Required): [
+     *         String (Required)
+     *     ]
+     *     infraOverrides (Optional): {
+     *         cpu: String (Optional)
+     *         ram: String (Optional)
+     *         gpu: String (Optional)
+     *         replicaCount: Integer (Optional)
+     *         imageUri: String (Optional)
+     *         maxCpu: String (Optional)
+     *         maxRam: String (Optional)
+     *         maxGpu: String (Optional)
+     *     }
+     *     environmentVariables (Optional): [
+     *          (Optional){
+     *             name: String (Required)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param runRequest The runRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginRunWithModelAsync(String projectName, BinaryData runRequest, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.runWithResponseAsync(projectName, runRequest, requestOptions), + new com.azure.ai.discovery.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(RunResult.class)); + } + + /** + * Run the specified tool in the context of the specified project. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     toolId: String (Required)
+     *     command: String (Optional)
+     *     inlineFiles (Optional): [
+     *          (Optional){
+     *             mountPath: String (Required)
+     *             encodedFile: String (Required)
+     *         }
+     *     ]
+     *     inputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     outputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     nodePoolIds (Required): [
+     *         String (Required)
+     *     ]
+     *     infraOverrides (Optional): {
+     *         cpu: String (Optional)
+     *         ram: String (Optional)
+     *         gpu: String (Optional)
+     *         replicaCount: Integer (Optional)
+     *         imageUri: String (Optional)
+     *         maxCpu: String (Optional)
+     *         maxRam: String (Optional)
+     *         maxGpu: String (Optional)
+     *     }
+     *     environmentVariables (Optional): [
+     *          (Optional){
+     *             name: String (Required)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param runRequest The runRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginRunWithModel(String projectName, BinaryData runRequest, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.runWithResponse(projectName, runRequest, requestOptions), + new com.azure.ai.discovery.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(RunResult.class)); + } + + /** + * Run the specified tool in the context of the specified project. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     toolId: String (Required)
+     *     command: String (Optional)
+     *     inlineFiles (Optional): [
+     *          (Optional){
+     *             mountPath: String (Required)
+     *             encodedFile: String (Required)
+     *         }
+     *     ]
+     *     inputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     outputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     nodePoolIds (Required): [
+     *         String (Required)
+     *     ]
+     *     infraOverrides (Optional): {
+     *         cpu: String (Optional)
+     *         ram: String (Optional)
+     *         gpu: String (Optional)
+     *         replicaCount: Integer (Optional)
+     *         imageUri: String (Optional)
+     *         maxCpu: String (Optional)
+     *         maxRam: String (Optional)
+     *         maxGpu: String (Optional)
+     *     }
+     *     environmentVariables (Optional): [
+     *          (Optional){
+     *             name: String (Required)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param runRequest The runRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginRunAsync(String projectName, BinaryData runRequest, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.runWithResponseAsync(projectName, runRequest, requestOptions), + new com.azure.ai.discovery.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Run the specified tool in the context of the specified project. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     toolId: String (Required)
+     *     command: String (Optional)
+     *     inlineFiles (Optional): [
+     *          (Optional){
+     *             mountPath: String (Required)
+     *             encodedFile: String (Required)
+     *         }
+     *     ]
+     *     inputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     outputData (Optional): [
+     *          (Optional){
+     *             storageUri: String (Required)
+     *             mountPath: String (Required)
+     *             mountProtocol: String(NFS/BlobfuseCaching) (Optional)
+     *         }
+     *     ]
+     *     nodePoolIds (Required): [
+     *         String (Required)
+     *     ]
+     *     infraOverrides (Optional): {
+     *         cpu: String (Optional)
+     *         ram: String (Optional)
+     *         gpu: String (Optional)
+     *         replicaCount: Integer (Optional)
+     *         imageUri: String (Optional)
+     *         maxCpu: String (Optional)
+     *         maxRam: String (Optional)
+     *         maxGpu: String (Optional)
+     *     }
+     *     environmentVariables (Optional): [
+     *          (Optional){
+     *             name: String (Required)
+     *             value: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param runRequest The runRequest parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of provides status details for long running operations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginRun(String projectName, BinaryData runRequest, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.runWithResponse(projectName, runRequest, requestOptions), + new com.azure.ai.discovery.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Cancel an ongoing tool run. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param operationId ID of the operation to cancel. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response model for the cancel run operation status along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelRunLroWithResponseAsync(String projectName, String operationId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.cancelRunLro(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, operationId, accept, requestOptions, context)); + } + + /** + * Cancel an ongoing tool run. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param operationId ID of the operation to cancel. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return response model for the cancel run operation status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response cancelRunLroWithResponse(String projectName, String operationId, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.cancelRunLroSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, operationId, accept, requestOptions, Context.NONE); + } + + /** + * Cancel an ongoing tool run. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param operationId ID of the operation to cancel. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of response model for the cancel run operation status. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCancelRunLroWithModelAsync(String projectName, + String operationId, RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.cancelRunLroWithResponseAsync(projectName, operationId, requestOptions), + new com.azure.ai.discovery.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(RunResult.class)); + } + + /** + * Cancel an ongoing tool run. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param operationId ID of the operation to cancel. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of response model for the cancel run operation status. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCancelRunLroWithModel(String projectName, + String operationId, RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.cancelRunLroWithResponse(projectName, operationId, requestOptions), + new com.azure.ai.discovery.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(PollOperationDetails.class), TypeReference.createInstance(RunResult.class)); + } + + /** + * Cancel an ongoing tool run. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param operationId ID of the operation to cancel. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link PollerFlux} for polling of response model for the cancel run operation status. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginCancelRunLroAsync(String projectName, String operationId, + RequestOptions requestOptions) { + return PollerFlux.create(Duration.ofSeconds(1), + () -> this.cancelRunLroWithResponseAsync(projectName, operationId, requestOptions), + new com.azure.ai.discovery.implementation.OperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * Cancel an ongoing tool run. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Required)
+     *     status: String(NotStarted/Running/Succeeded/Failed/Canceled) (Required)
+     *     error (Optional): {
+     *         error (Required): (recursive schema, see error above)
+     *     }
+     *     result (Optional): {
+     *         status: String (Optional)
+     *         runtimeDetails: String (Required)
+     *         createdAt: OffsetDateTime (Optional)
+     *         completedAt: OffsetDateTime (Optional)
+     *         createdBy: String (Optional)
+     *         toolReport (Optional): {
+     *             percentageComplete: int (Required)
+     *             statusInformation (Optional): {
+     *             }
+     *             logs: String (Optional)
+     *         }
+     *         outputData (Required): [
+     *              (Required){
+     *                 storageUri: String (Required)
+     *                 mountPath: String (Required)
+     *             }
+     *         ]
+     *         debugInfo: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param operationId ID of the operation to cancel. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link SyncPoller} for polling of response model for the cancel run operation status. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginCancelRunLro(String projectName, String operationId, + RequestOptions requestOptions) { + return SyncPoller.createPoller(Duration.ofSeconds(1), + () -> this.cancelRunLroWithResponse(projectName, operationId, requestOptions), + new com.azure.ai.discovery.implementation.SyncOperationLocationPollingStrategy<>( + new PollingStrategyOptions(this.client.getHttpPipeline()) + .setEndpoint("{endpoint}".replace("{endpoint}", this.client.getEndpoint())) + .setContext(requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.client.getServiceVersion().getVersion()), + "result"), + TypeReference.createInstance(BinaryData.class), TypeReference.createInstance(BinaryData.class)); + } + + /** + * List tool runs. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             nodepoolId: String (Required)
+     *             status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Required)
+     *             runtimeDetails: String (Required)
+     *             createdAt: OffsetDateTime (Required)
+     *             completedAt: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Operation items along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getOperationsWithResponseAsync(String projectName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getOperations(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, accept, requestOptions, context)); + } + + /** + * List tool runs. + *

Query Parameters

+ * + * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
topIntegerNoThe number of result items to return.
skipIntegerNoThe number of result items to skip.
maxpagesizeIntegerNoThe maximum number of result items per page.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value (Required): [
+     *          (Required){
+     *             id: String (Required)
+     *             nodepoolId: String (Required)
+     *             status: String(NotStarted/Running/Succeeded/Canceled/Failed) (Required)
+     *             runtimeDetails: String (Required)
+     *             createdAt: OffsetDateTime (Required)
+     *             completedAt: OffsetDateTime (Optional)
+     *             createdBy: String (Optional)
+     *         }
+     *     ]
+     *     nextLink: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return paged collection of Operation items along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOperationsWithResponse(String projectName, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getOperationsSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, accept, requestOptions, Context.NONE); + } + + /** + * Examine compute usage. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     supercomputers (Required): {
+     *         String (Required): {
+     *             activeJobs: long (Required)
+     *             pendingJobs: long (Required)
+     *             nodepools (Required): {
+     *                 String (Required): {
+     *                     reservedCPUs: String (Required)
+     *                     allocatableCPUs: String (Required)
+     *                     reservedMemory: String (Required)
+     *                     allocatableMemory: String (Required)
+     *                     reservedGPUs: String (Required)
+     *                     allocatableGPUs: String (Required)
+     *                 }
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return overview of compute usage for a project along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getComputeUsageWithResponseAsync(String projectName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getComputeUsage(this.client.getEndpoint(), + this.client.getServiceVersion().getVersion(), projectName, accept, requestOptions, context)); + } + + /** + * Examine compute usage. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     supercomputers (Required): {
+     *         String (Required): {
+     *             activeJobs: long (Required)
+     *             pendingJobs: long (Required)
+     *             nodepools (Required): {
+     *                 String (Required): {
+     *                     reservedCPUs: String (Required)
+     *                     allocatableCPUs: String (Required)
+     *                     reservedMemory: String (Required)
+     *                     allocatableMemory: String (Required)
+     *                     reservedGPUs: String (Required)
+     *                     allocatableGPUs: String (Required)
+     *                 }
+     *             }
+     *         }
+     *     }
+     * }
+     * }
+     * 
+ * + * @param projectName Name of the associated Project. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return overview of compute usage for a project along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getComputeUsageWithResponse(String projectName, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getComputeUsageSync(this.client.getEndpoint(), this.client.getServiceVersion().getVersion(), + projectName, accept, requestOptions, Context.NONE); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/WorkspaceClientImpl.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/WorkspaceClientImpl.java new file mode 100644 index 000000000000..52d17372035e --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/WorkspaceClientImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation; + +import com.azure.ai.discovery.DiscoveryServiceVersion; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; + +/** + * Initializes a new instance of the WorkspaceClient type. + */ +public final class WorkspaceClientImpl { + /** + * Supported Discovery Workspace Services endpoints (protocol and hostname, for example: + * https://{workspaceName}.discovery.azure.com). + */ + private final String endpoint; + + /** + * Gets Supported Discovery Workspace Services endpoints (protocol and hostname, for example: + * https://{workspaceName}.discovery.azure.com). + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Service version. + */ + private final DiscoveryServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public DiscoveryServiceVersion getServiceVersion() { + return this.serviceVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The InvestigationsImpl object to access its operations. + */ + private final InvestigationsImpl investigations; + + /** + * Gets the InvestigationsImpl object to access its operations. + * + * @return the InvestigationsImpl object. + */ + public InvestigationsImpl getInvestigations() { + return this.investigations; + } + + /** + * The ConversationsImpl object to access its operations. + */ + private final ConversationsImpl conversations; + + /** + * Gets the ConversationsImpl object to access its operations. + * + * @return the ConversationsImpl object. + */ + public ConversationsImpl getConversations() { + return this.conversations; + } + + /** + * The ToolsImpl object to access its operations. + */ + private final ToolsImpl tools; + + /** + * Gets the ToolsImpl object to access its operations. + * + * @return the ToolsImpl object. + */ + public ToolsImpl getTools() { + return this.tools; + } + + /** + * The TasksImpl object to access its operations. + */ + private final TasksImpl tasks; + + /** + * Gets the TasksImpl object to access its operations. + * + * @return the TasksImpl object. + */ + public TasksImpl getTasks() { + return this.tasks; + } + + /** + * Initializes an instance of WorkspaceClient client. + * + * @param endpoint Supported Discovery Workspace Services endpoints (protocol and hostname, for example: + * https://{workspaceName}.discovery.azure.com). + * @param serviceVersion Service version. + */ + public WorkspaceClientImpl(String endpoint, DiscoveryServiceVersion serviceVersion) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of WorkspaceClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Supported Discovery Workspace Services endpoints (protocol and hostname, for example: + * https://{workspaceName}.discovery.azure.com). + * @param serviceVersion Service version. + */ + public WorkspaceClientImpl(HttpPipeline httpPipeline, String endpoint, DiscoveryServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion); + } + + /** + * Initializes an instance of WorkspaceClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Supported Discovery Workspace Services endpoints (protocol and hostname, for example: + * https://{workspaceName}.discovery.azure.com). + * @param serviceVersion Service version. + */ + public WorkspaceClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, + DiscoveryServiceVersion serviceVersion) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.serviceVersion = serviceVersion; + this.investigations = new InvestigationsImpl(this); + this.conversations = new ConversationsImpl(this); + this.tools = new ToolsImpl(this); + this.tasks = new TasksImpl(this); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/models/CreateRequest.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/models/CreateRequest.java new file mode 100644 index 000000000000..f62915dc2b5a --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/models/CreateRequest.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The CreateRequest model. + */ +@Fluent +public final class CreateRequest implements JsonSerializable { + /* + * The name of the associated Project + */ + @Generated + private final String projectName; + + /* + * The Name of the associated Investigation + */ + @Generated + private String investigationName; + + /* + * The title + */ + @Generated + private String displayName; + + /** + * Creates an instance of CreateRequest class. + * + * @param projectName the projectName value to set. + */ + @Generated + public CreateRequest(String projectName) { + this.projectName = projectName; + } + + /** + * Get the projectName property: The name of the associated Project. + * + * @return the projectName value. + */ + @Generated + public String getProjectName() { + return this.projectName; + } + + /** + * Get the investigationName property: The Name of the associated Investigation. + * + * @return the investigationName value. + */ + @Generated + public String getInvestigationName() { + return this.investigationName; + } + + /** + * Set the investigationName property: The Name of the associated Investigation. + * + * @param investigationName the investigationName value to set. + * @return the CreateRequest object itself. + */ + @Generated + public CreateRequest setInvestigationName(String investigationName) { + this.investigationName = investigationName; + return this; + } + + /** + * Get the displayName property: The title. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: The title. + * + * @param displayName the displayName value to set. + * @return the CreateRequest object itself. + */ + @Generated + public CreateRequest setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("projectName", this.projectName); + jsonWriter.writeStringField("investigationName", this.investigationName); + jsonWriter.writeStringField("displayName", this.displayName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CreateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CreateRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CreateRequest. + */ + @Generated + public static CreateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String projectName = null; + String investigationName = null; + String displayName = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("projectName".equals(fieldName)) { + projectName = reader.getString(); + } else if ("investigationName".equals(fieldName)) { + investigationName = reader.getString(); + } else if ("displayName".equals(fieldName)) { + displayName = reader.getString(); + } else { + reader.skipChildren(); + } + } + CreateRequest deserializedCreateRequest = new CreateRequest(projectName); + deserializedCreateRequest.investigationName = investigationName; + deserializedCreateRequest.displayName = displayName; + + return deserializedCreateRequest; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/models/RunRequest.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/models/RunRequest.java new file mode 100644 index 000000000000..7da62d15ed24 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/models/RunRequest.java @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation.models; + +import com.azure.ai.discovery.models.InfraOverrides; +import com.azure.ai.discovery.models.InlineFile; +import com.azure.ai.discovery.models.InputDataMount; +import com.azure.ai.discovery.models.OutputDataMount; +import com.azure.ai.discovery.models.RunRequestEnvironmentVariable; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The RunRequest model. + */ +@Fluent +public final class RunRequest implements JsonSerializable { + /* + * ID of the tool to execute + */ + @Generated + private final String toolId; + + /* + * Command to pass to tool container entrypoint. + * + * If the tool has multiple containers defined, this command is executed on all of them. + * + * If omitted, all containers execute their raw entrypoints. + * + * This command is parsed into an argument list which is passed to the underlying container runtime. + * For example, if the command is + * "python /code/wrapper.py --input /inputs/abcdef-input-1/input.txt --output /outputs/abcdef-output-1", + * then the container runtime will receive the following argument list: + * ["python", "/code/wrapper.py", "--input", "/inputs/abcdef-input-1/input.txt", "--output", + * "/outputs/abcdef-output-1"] + * + * The container's entrypoint is not overridden. In Docker terminology, the above argument list becomes + * the CMD, not the ENTRYPOINT of the launched container. + * + * Our parsing includes the following limited interpretation of special characters: + * - The only special characters are " ' and \. + * - Backslashes `\` escape the next character if that character is a special character, preserving its literal + * value. + * - Double quotes `"` preserve everything inside them literally, with the exception of the characters " and \, + * which must be escaped with a backslash `\`. Unmatched quotes will throw an error. + * - Single quotes `'` preserve everything inside them literally. A single-quote cannot occur within single-quotes. + * Unmatched quotes will throw an error. + * + * If you wish to run a command that relies on shell features such as globbing or output redirection, you either + * need to: + * - use a container with an entrypoint that is a shell (e.g. `/bin/sh` or `/bin/bash`) and pass a command which is + * valid for that shell e.g. + * `-c 'python /code/wrapper.py --input /inputs/abcdef-input-1/* --output /outputs/abcdef-output-1'` + * - use a container which has a shell installed, and include the shell in the command, e.g. + * `sh -c "python /code/wrapper.py --input /inputs/abcdef-input-1/* --output /outputs/abcdef-output-1"` + */ + @Generated + private String command; + + /* + * Encoded inline files to be mounted into the container, e.g. for generated code. + */ + @Generated + private List inlineFiles; + + /* + * Input data references and mount paths. + */ + @Generated + private List inputData; + + /* + * Output data references and mount paths. + */ + @Generated + private List outputData; + + /* + * IDs of NodePools to use for this run. + */ + @Generated + private final List nodePoolIds; + + /* + * Override the infrastructure requirements in the tool definitions. + */ + @Generated + private InfraOverrides infraOverrides; + + /* + * Optional environment variables to set in the tool container. This must not contain any secrets. + */ + @Generated + private List environmentVariables; + + /** + * Creates an instance of RunRequest class. + * + * @param toolId the toolId value to set. + * @param nodePoolIds the nodePoolIds value to set. + */ + @Generated + public RunRequest(String toolId, List nodePoolIds) { + this.toolId = toolId; + this.nodePoolIds = nodePoolIds; + } + + /** + * Get the toolId property: ID of the tool to execute. + * + * @return the toolId value. + */ + @Generated + public String getToolId() { + return this.toolId; + } + + /** + * Get the command property: Command to pass to tool container entrypoint. + * + * If the tool has multiple containers defined, this command is executed on all of them. + * + * If omitted, all containers execute their raw entrypoints. + * + * This command is parsed into an argument list which is passed to the underlying container runtime. + * For example, if the command is "python /code/wrapper.py --input /inputs/abcdef-input-1/input.txt --output + * /outputs/abcdef-output-1", + * then the container runtime will receive the following argument list: + * ["python", "/code/wrapper.py", "--input", "/inputs/abcdef-input-1/input.txt", "--output", + * "/outputs/abcdef-output-1"] + * + * The container's entrypoint is not overridden. In Docker terminology, the above argument list becomes + * the CMD, not the ENTRYPOINT of the launched container. + * + * Our parsing includes the following limited interpretation of special characters: + * - The only special characters are " ' and \. + * - Backslashes `\` escape the next character if that character is a special character, preserving its literal + * value. + * - Double quotes `"` preserve everything inside them literally, with the exception of the characters " and \, + * which must be escaped with a backslash `\`. Unmatched quotes will throw an error. + * - Single quotes `'` preserve everything inside them literally. A single-quote cannot occur within single-quotes. + * Unmatched quotes will throw an error. + * + * If you wish to run a command that relies on shell features such as globbing or output redirection, you either + * need to: + * - use a container with an entrypoint that is a shell (e.g. `/bin/sh` or `/bin/bash`) and pass a command which is + * valid for that shell e.g. + * `-c 'python /code/wrapper.py --input /inputs/abcdef-input-1/* --output /outputs/abcdef-output-1'` + * - use a container which has a shell installed, and include the shell in the command, e.g. + * `sh -c "python /code/wrapper.py --input /inputs/abcdef-input-1/* --output /outputs/abcdef-output-1"`. + * + * @return the command value. + */ + @Generated + public String getCommand() { + return this.command; + } + + /** + * Set the command property: Command to pass to tool container entrypoint. + * + * If the tool has multiple containers defined, this command is executed on all of them. + * + * If omitted, all containers execute their raw entrypoints. + * + * This command is parsed into an argument list which is passed to the underlying container runtime. + * For example, if the command is "python /code/wrapper.py --input /inputs/abcdef-input-1/input.txt --output + * /outputs/abcdef-output-1", + * then the container runtime will receive the following argument list: + * ["python", "/code/wrapper.py", "--input", "/inputs/abcdef-input-1/input.txt", "--output", + * "/outputs/abcdef-output-1"] + * + * The container's entrypoint is not overridden. In Docker terminology, the above argument list becomes + * the CMD, not the ENTRYPOINT of the launched container. + * + * Our parsing includes the following limited interpretation of special characters: + * - The only special characters are " ' and \. + * - Backslashes `\` escape the next character if that character is a special character, preserving its literal + * value. + * - Double quotes `"` preserve everything inside them literally, with the exception of the characters " and \, + * which must be escaped with a backslash `\`. Unmatched quotes will throw an error. + * - Single quotes `'` preserve everything inside them literally. A single-quote cannot occur within single-quotes. + * Unmatched quotes will throw an error. + * + * If you wish to run a command that relies on shell features such as globbing or output redirection, you either + * need to: + * - use a container with an entrypoint that is a shell (e.g. `/bin/sh` or `/bin/bash`) and pass a command which is + * valid for that shell e.g. + * `-c 'python /code/wrapper.py --input /inputs/abcdef-input-1/* --output /outputs/abcdef-output-1'` + * - use a container which has a shell installed, and include the shell in the command, e.g. + * `sh -c "python /code/wrapper.py --input /inputs/abcdef-input-1/* --output /outputs/abcdef-output-1"`. + * + * @param command the command value to set. + * @return the RunRequest object itself. + */ + @Generated + public RunRequest setCommand(String command) { + this.command = command; + return this; + } + + /** + * Get the inlineFiles property: Encoded inline files to be mounted into the container, e.g. for generated code. + * + * @return the inlineFiles value. + */ + @Generated + public List getInlineFiles() { + return this.inlineFiles; + } + + /** + * Set the inlineFiles property: Encoded inline files to be mounted into the container, e.g. for generated code. + * + * @param inlineFiles the inlineFiles value to set. + * @return the RunRequest object itself. + */ + @Generated + public RunRequest setInlineFiles(List inlineFiles) { + this.inlineFiles = inlineFiles; + return this; + } + + /** + * Get the inputData property: Input data references and mount paths. + * + * @return the inputData value. + */ + @Generated + public List getInputData() { + return this.inputData; + } + + /** + * Set the inputData property: Input data references and mount paths. + * + * @param inputData the inputData value to set. + * @return the RunRequest object itself. + */ + @Generated + public RunRequest setInputData(List inputData) { + this.inputData = inputData; + return this; + } + + /** + * Get the outputData property: Output data references and mount paths. + * + * @return the outputData value. + */ + @Generated + public List getOutputData() { + return this.outputData; + } + + /** + * Set the outputData property: Output data references and mount paths. + * + * @param outputData the outputData value to set. + * @return the RunRequest object itself. + */ + @Generated + public RunRequest setOutputData(List outputData) { + this.outputData = outputData; + return this; + } + + /** + * Get the nodePoolIds property: IDs of NodePools to use for this run. + * + * @return the nodePoolIds value. + */ + @Generated + public List getNodePoolIds() { + return this.nodePoolIds; + } + + /** + * Get the infraOverrides property: Override the infrastructure requirements in the tool definitions. + * + * @return the infraOverrides value. + */ + @Generated + public InfraOverrides getInfraOverrides() { + return this.infraOverrides; + } + + /** + * Set the infraOverrides property: Override the infrastructure requirements in the tool definitions. + * + * @param infraOverrides the infraOverrides value to set. + * @return the RunRequest object itself. + */ + @Generated + public RunRequest setInfraOverrides(InfraOverrides infraOverrides) { + this.infraOverrides = infraOverrides; + return this; + } + + /** + * Get the environmentVariables property: Optional environment variables to set in the tool container. This must not + * contain any secrets. + * + * @return the environmentVariables value. + */ + @Generated + public List getEnvironmentVariables() { + return this.environmentVariables; + } + + /** + * Set the environmentVariables property: Optional environment variables to set in the tool container. This must not + * contain any secrets. + * + * @param environmentVariables the environmentVariables value to set. + * @return the RunRequest object itself. + */ + @Generated + public RunRequest setEnvironmentVariables(List environmentVariables) { + this.environmentVariables = environmentVariables; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("toolId", this.toolId); + jsonWriter.writeArrayField("nodePoolIds", this.nodePoolIds, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("command", this.command); + jsonWriter.writeArrayField("inlineFiles", this.inlineFiles, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("inputData", this.inputData, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("outputData", this.outputData, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("infraOverrides", this.infraOverrides); + jsonWriter.writeArrayField("environmentVariables", this.environmentVariables, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunRequest if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunRequest. + */ + @Generated + public static RunRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String toolId = null; + List nodePoolIds = null; + String command = null; + List inlineFiles = null; + List inputData = null; + List outputData = null; + InfraOverrides infraOverrides = null; + List environmentVariables = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("toolId".equals(fieldName)) { + toolId = reader.getString(); + } else if ("nodePoolIds".equals(fieldName)) { + nodePoolIds = reader.readArray(reader1 -> reader1.getString()); + } else if ("command".equals(fieldName)) { + command = reader.getString(); + } else if ("inlineFiles".equals(fieldName)) { + inlineFiles = reader.readArray(reader1 -> InlineFile.fromJson(reader1)); + } else if ("inputData".equals(fieldName)) { + inputData = reader.readArray(reader1 -> InputDataMount.fromJson(reader1)); + } else if ("outputData".equals(fieldName)) { + outputData = reader.readArray(reader1 -> OutputDataMount.fromJson(reader1)); + } else if ("infraOverrides".equals(fieldName)) { + infraOverrides = InfraOverrides.fromJson(reader); + } else if ("environmentVariables".equals(fieldName)) { + environmentVariables = reader.readArray(reader1 -> RunRequestEnvironmentVariable.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + RunRequest deserializedRunRequest = new RunRequest(toolId, nodePoolIds); + deserializedRunRequest.command = command; + deserializedRunRequest.inlineFiles = inlineFiles; + deserializedRunRequest.inputData = inputData; + deserializedRunRequest.outputData = outputData; + deserializedRunRequest.infraOverrides = infraOverrides; + deserializedRunRequest.environmentVariables = environmentVariables; + + return deserializedRunRequest; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/models/StartIndexingRequest.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/models/StartIndexingRequest.java new file mode 100644 index 000000000000..61449cd4d092 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/models/StartIndexingRequest.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The StartIndexingRequest model. + */ +@Fluent +public final class StartIndexingRequest implements JsonSerializable { + /* + * Node pool ID + */ + @Generated + private String nodePoolId; + + /* + * Project ID + */ + @Generated + private String projectId; + + /** + * Creates an instance of StartIndexingRequest class. + */ + @Generated + public StartIndexingRequest() { + } + + /** + * Get the nodePoolId property: Node pool ID. + * + * @return the nodePoolId value. + */ + @Generated + public String getNodePoolId() { + return this.nodePoolId; + } + + /** + * Set the nodePoolId property: Node pool ID. + * + * @param nodePoolId the nodePoolId value to set. + * @return the StartIndexingRequest object itself. + */ + @Generated + public StartIndexingRequest setNodePoolId(String nodePoolId) { + this.nodePoolId = nodePoolId; + return this; + } + + /** + * Get the projectId property: Project ID. + * + * @return the projectId value. + */ + @Generated + public String getProjectId() { + return this.projectId; + } + + /** + * Set the projectId property: Project ID. + * + * @param projectId the projectId value to set. + * @return the StartIndexingRequest object itself. + */ + @Generated + public StartIndexingRequest setProjectId(String projectId) { + this.projectId = projectId; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("nodePoolId", this.nodePoolId); + jsonWriter.writeStringField("projectId", this.projectId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StartIndexingRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StartIndexingRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the StartIndexingRequest. + */ + @Generated + public static StartIndexingRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StartIndexingRequest deserializedStartIndexingRequest = new StartIndexingRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nodePoolId".equals(fieldName)) { + deserializedStartIndexingRequest.nodePoolId = reader.getString(); + } else if ("projectId".equals(fieldName)) { + deserializedStartIndexingRequest.projectId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStartIndexingRequest; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/models/package-info.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/models/package-info.java new file mode 100644 index 000000000000..cb1790067b7c --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for Discovery. + */ +package com.azure.ai.discovery.implementation.models; diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/package-info.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/package-info.java new file mode 100644 index 000000000000..0071602bb6d4 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/implementation/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for Discovery. + */ +package com.azure.ai.discovery.implementation; diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/ByType.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/ByType.java new file mode 100644 index 000000000000..4793ad3b7ed9 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/ByType.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum for entity type. + */ +public final class ByType extends ExpandableStringEnum { + /** + * A human user. + */ + @Generated + public static final ByType USER = fromString("User"); + + /** + * Application. + */ + @Generated + public static final ByType APPLICATION = fromString("Application"); + + /** + * The backend system. + */ + @Generated + public static final ByType SYSTEM = fromString("System"); + + /** + * Creates a new instance of ByType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ByType() { + } + + /** + * Creates or finds a ByType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ByType. + */ + @Generated + public static ByType fromString(String name) { + return fromString(name, ByType.class); + } + + /** + * Gets known ByType values. + * + * @return known ByType values. + */ + @Generated + public static Collection values() { + return values(ByType.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Citation.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Citation.java new file mode 100644 index 000000000000..a7cfdd3f7120 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Citation.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A citation for a generated result. + */ +@Immutable +public final class Citation implements JsonSerializable { + /* + * The type of citation. + */ + @Generated + private final CitationType type; + + /* + * Zero-based index of the citation in the result. + */ + @Generated + private Integer index; + + /* + * The source file name. + */ + @Generated + private final String fileName; + + /* + * Character offset where the cited passage begins. + */ + @Generated + private Integer startOffset; + + /* + * Character offset where the cited passage ends. + */ + @Generated + private Integer endOffset; + + /** + * Creates an instance of Citation class. + * + * @param type the type value to set. + * @param fileName the fileName value to set. + */ + @Generated + private Citation(CitationType type, String fileName) { + this.type = type; + this.fileName = fileName; + } + + /** + * Get the type property: The type of citation. + * + * @return the type value. + */ + @Generated + public CitationType getType() { + return this.type; + } + + /** + * Get the index property: Zero-based index of the citation in the result. + * + * @return the index value. + */ + @Generated + public Integer getIndex() { + return this.index; + } + + /** + * Get the fileName property: The source file name. + * + * @return the fileName value. + */ + @Generated + public String getFileName() { + return this.fileName; + } + + /** + * Get the startOffset property: Character offset where the cited passage begins. + * + * @return the startOffset value. + */ + @Generated + public Integer getStartOffset() { + return this.startOffset; + } + + /** + * Get the endOffset property: Character offset where the cited passage ends. + * + * @return the endOffset value. + */ + @Generated + public Integer getEndOffset() { + return this.endOffset; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("fileName", this.fileName); + jsonWriter.writeNumberField("index", this.index); + jsonWriter.writeNumberField("startOffset", this.startOffset); + jsonWriter.writeNumberField("endOffset", this.endOffset); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Citation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Citation if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Citation. + */ + @Generated + public static Citation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CitationType type = null; + String fileName = null; + Integer index = null; + Integer startOffset = null; + Integer endOffset = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + type = CitationType.fromString(reader.getString()); + } else if ("fileName".equals(fieldName)) { + fileName = reader.getString(); + } else if ("index".equals(fieldName)) { + index = reader.getNullable(JsonReader::getInt); + } else if ("startOffset".equals(fieldName)) { + startOffset = reader.getNullable(JsonReader::getInt); + } else if ("endOffset".equals(fieldName)) { + endOffset = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + Citation deserializedCitation = new Citation(type, fileName); + deserializedCitation.index = index; + deserializedCitation.startOffset = startOffset; + deserializedCitation.endOffset = endOffset; + + return deserializedCitation; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/CitationType.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/CitationType.java new file mode 100644 index 000000000000..ebc69606cd69 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/CitationType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of citation. + */ +public final class CitationType extends ExpandableStringEnum { + /** + * A file citation. + */ + @Generated + public static final CitationType FILE_CITATION = fromString("file_citation"); + + /** + * Creates a new instance of CitationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public CitationType() { + } + + /** + * Creates or finds a CitationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CitationType. + */ + @Generated + public static CitationType fromString(String name) { + return fromString(name, CitationType.class); + } + + /** + * Gets known CitationType values. + * + * @return known CitationType values. + */ + @Generated + public static Collection values() { + return values(CitationType.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/ComputeUsage.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/ComputeUsage.java new file mode 100644 index 000000000000..8510e13180a3 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/ComputeUsage.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Overview of compute usage for a project. + */ +@Immutable +public final class ComputeUsage implements JsonSerializable { + /* + * Index of information for each supercomputer in the workspace of a project. + * Indexed by the (short) name of the supercomputer. + */ + @Generated + private final Map supercomputers; + + /** + * Creates an instance of ComputeUsage class. + * + * @param supercomputers the supercomputers value to set. + */ + @Generated + private ComputeUsage(Map supercomputers) { + this.supercomputers = supercomputers; + } + + /** + * Get the supercomputers property: Index of information for each supercomputer in the workspace of a project. + * Indexed by the (short) name of the supercomputer. + * + * @return the supercomputers value. + */ + @Generated + public Map getSupercomputers() { + return this.supercomputers; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("supercomputers", this.supercomputers, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ComputeUsage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ComputeUsage if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ComputeUsage. + */ + @Generated + public static ComputeUsage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Map supercomputers = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("supercomputers".equals(fieldName)) { + supercomputers = reader.readMap(reader1 -> SupercomputerUsage.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new ComputeUsage(supercomputers); + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Conversation.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Conversation.java new file mode 100644 index 000000000000..c3fd4159b891 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Conversation.java @@ -0,0 +1,488 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.HashSet; +import java.util.Set; + +/** + * A conversation. + */ +@Fluent +public final class Conversation implements JsonSerializable { + /* + * The conversation name. + */ + @Generated + private String name; + + /* + * The timestamp when the resource was created. + */ + @Generated + private OffsetDateTime createdAt; + + /* + * The ID of the user who created this resource. + */ + @Generated + private String createdBy; + + /* + * The type of user who created this resource. + */ + @Generated + private ByType createdByType; + + /* + * The timestamp when the resource was last updated + */ + @Generated + private OffsetDateTime lastModifiedAt; + + /* + * The ID of the user who updated this resource. + */ + @Generated + private String lastModifiedBy; + + /* + * The type of user who updated this resource. + */ + @Generated + private ByType lastModifiedByType; + + /* + * The title + */ + @Generated + private String displayName; + + /* + * The Name of the associated Investigation + */ + @Generated + private String investigationName; + + /* + * The name of the associated Project + */ + @Generated + private String projectName; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setConversationAccessor(new JsonMergePatchHelper.ConversationAccessor() { + @Override + public Conversation prepareModelForJsonMergePatch(Conversation model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(Conversation model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of Conversation class. + */ + @Generated + public Conversation() { + } + + /** + * Get the name property: The conversation name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the createdAt property: The timestamp when the resource was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: The timestamp when the resource was created. + * + * @param createdAt the createdAt value to set. + * @return the Conversation object itself. + */ + @Generated + public Conversation setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + this.updatedProperties.add("createdAt"); + return this; + } + + /** + * Get the createdBy property: The ID of the user who created this resource. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Set the createdBy property: The ID of the user who created this resource. + * + * @param createdBy the createdBy value to set. + * @return the Conversation object itself. + */ + @Generated + public Conversation setCreatedBy(String createdBy) { + this.createdBy = createdBy; + this.updatedProperties.add("createdBy"); + return this; + } + + /** + * Get the createdByType property: The type of user who created this resource. + * + * @return the createdByType value. + */ + @Generated + public ByType getCreatedByType() { + return this.createdByType; + } + + /** + * Set the createdByType property: The type of user who created this resource. + * + * @param createdByType the createdByType value to set. + * @return the Conversation object itself. + */ + @Generated + public Conversation setCreatedByType(ByType createdByType) { + this.createdByType = createdByType; + this.updatedProperties.add("createdByType"); + return this; + } + + /** + * Get the lastModifiedAt property: The timestamp when the resource was last updated. + * + * @return the lastModifiedAt value. + */ + @Generated + public OffsetDateTime getLastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Set the lastModifiedAt property: The timestamp when the resource was last updated. + * + * @param lastModifiedAt the lastModifiedAt value to set. + * @return the Conversation object itself. + */ + @Generated + public Conversation setLastModifiedAt(OffsetDateTime lastModifiedAt) { + this.lastModifiedAt = lastModifiedAt; + this.updatedProperties.add("lastModifiedAt"); + return this; + } + + /** + * Get the lastModifiedBy property: The ID of the user who updated this resource. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Set the lastModifiedBy property: The ID of the user who updated this resource. + * + * @param lastModifiedBy the lastModifiedBy value to set. + * @return the Conversation object itself. + */ + @Generated + public Conversation setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + this.updatedProperties.add("lastModifiedBy"); + return this; + } + + /** + * Get the lastModifiedByType property: The type of user who updated this resource. + * + * @return the lastModifiedByType value. + */ + @Generated + public ByType getLastModifiedByType() { + return this.lastModifiedByType; + } + + /** + * Set the lastModifiedByType property: The type of user who updated this resource. + * + * @param lastModifiedByType the lastModifiedByType value to set. + * @return the Conversation object itself. + */ + @Generated + public Conversation setLastModifiedByType(ByType lastModifiedByType) { + this.lastModifiedByType = lastModifiedByType; + this.updatedProperties.add("lastModifiedByType"); + return this; + } + + /** + * Get the displayName property: The title. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: The title. + * + * @param displayName the displayName value to set. + * @return the Conversation object itself. + */ + @Generated + public Conversation setDisplayName(String displayName) { + this.displayName = displayName; + this.updatedProperties.add("displayName"); + return this; + } + + /** + * Get the investigationName property: The Name of the associated Investigation. + * + * @return the investigationName value. + */ + @Generated + public String getInvestigationName() { + return this.investigationName; + } + + /** + * Set the investigationName property: The Name of the associated Investigation. + * + * @param investigationName the investigationName value to set. + * @return the Conversation object itself. + */ + @Generated + public Conversation setInvestigationName(String investigationName) { + this.investigationName = investigationName; + this.updatedProperties.add("investigationName"); + return this; + } + + /** + * Get the projectName property: The name of the associated Project. + * + * @return the projectName value. + */ + @Generated + public String getProjectName() { + return this.projectName; + } + + /** + * Set the projectName property: The name of the associated Project. + * + * @param projectName the projectName value to set. + * @return the Conversation object itself. + */ + @Generated + public Conversation setProjectName(String projectName) { + this.projectName = projectName; + this.updatedProperties.add("projectName"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("createdAt", + this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); + jsonWriter.writeStringField("createdBy", this.createdBy); + jsonWriter.writeStringField("createdByType", + this.createdByType == null ? null : this.createdByType.toString()); + jsonWriter.writeStringField("lastModifiedAt", + this.lastModifiedAt == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastModifiedAt)); + jsonWriter.writeStringField("lastModifiedBy", this.lastModifiedBy); + jsonWriter.writeStringField("lastModifiedByType", + this.lastModifiedByType == null ? null : this.lastModifiedByType.toString()); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("investigationName", this.investigationName); + jsonWriter.writeStringField("projectName", this.projectName); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("createdAt")) { + if (this.createdAt == null) { + jsonWriter.writeNullField("createdAt"); + } else { + jsonWriter.writeStringField("createdAt", + this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); + } + } + if (updatedProperties.contains("createdBy")) { + if (this.createdBy == null) { + jsonWriter.writeNullField("createdBy"); + } else { + jsonWriter.writeStringField("createdBy", this.createdBy); + } + } + if (updatedProperties.contains("createdByType")) { + if (this.createdByType == null) { + jsonWriter.writeNullField("createdByType"); + } else { + jsonWriter.writeStringField("createdByType", this.createdByType.toString()); + } + } + if (updatedProperties.contains("lastModifiedAt")) { + if (this.lastModifiedAt == null) { + jsonWriter.writeNullField("lastModifiedAt"); + } else { + jsonWriter.writeStringField("lastModifiedAt", + this.lastModifiedAt == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastModifiedAt)); + } + } + if (updatedProperties.contains("lastModifiedBy")) { + if (this.lastModifiedBy == null) { + jsonWriter.writeNullField("lastModifiedBy"); + } else { + jsonWriter.writeStringField("lastModifiedBy", this.lastModifiedBy); + } + } + if (updatedProperties.contains("lastModifiedByType")) { + if (this.lastModifiedByType == null) { + jsonWriter.writeNullField("lastModifiedByType"); + } else { + jsonWriter.writeStringField("lastModifiedByType", this.lastModifiedByType.toString()); + } + } + if (updatedProperties.contains("displayName")) { + if (this.displayName == null) { + jsonWriter.writeNullField("displayName"); + } else { + jsonWriter.writeStringField("displayName", this.displayName); + } + } + if (updatedProperties.contains("investigationName")) { + if (this.investigationName == null) { + jsonWriter.writeNullField("investigationName"); + } else { + jsonWriter.writeStringField("investigationName", this.investigationName); + } + } + if (updatedProperties.contains("projectName")) { + if (this.projectName == null) { + jsonWriter.writeNullField("projectName"); + } else { + jsonWriter.writeStringField("projectName", this.projectName); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Conversation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Conversation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Conversation. + */ + @Generated + public static Conversation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Conversation deserializedConversation = new Conversation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedConversation.name = reader.getString(); + } else if ("createdAt".equals(fieldName)) { + deserializedConversation.createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedConversation.createdBy = reader.getString(); + } else if ("createdByType".equals(fieldName)) { + deserializedConversation.createdByType = ByType.fromString(reader.getString()); + } else if ("lastModifiedAt".equals(fieldName)) { + deserializedConversation.lastModifiedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedConversation.lastModifiedBy = reader.getString(); + } else if ("lastModifiedByType".equals(fieldName)) { + deserializedConversation.lastModifiedByType = ByType.fromString(reader.getString()); + } else if ("displayName".equals(fieldName)) { + deserializedConversation.displayName = reader.getString(); + } else if ("investigationName".equals(fieldName)) { + deserializedConversation.investigationName = reader.getString(); + } else if ("projectName".equals(fieldName)) { + deserializedConversation.projectName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConversation; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/DiscoveryEngine.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/DiscoveryEngine.java new file mode 100644 index 000000000000..f98181a363a5 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/DiscoveryEngine.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Map; + +/** + * Discovery engine instance. + */ +@Immutable +public final class DiscoveryEngine implements JsonSerializable { + /* + * The Discovery Engine status. + */ + @Generated + private final DiscoveryEngineStatus discoveryEngineStatus; + + /* + * The system prompt. + */ + @Generated + private String systemPrompt; + + /* + * The Discovery Engine configuration. + */ + @Generated + private Map configuration; + + /* + * The timestamp when the resource was created. + */ + @Generated + private OffsetDateTime createdAt; + + /* + * The ID of the user who created this resource. + */ + @Generated + private String createdBy; + + /* + * The type of user who created this resource. + */ + @Generated + private ByType createdByType; + + /* + * The timestamp when the resource was last updated + */ + @Generated + private OffsetDateTime lastModifiedAt; + + /* + * The ID of the user who updated this resource. + */ + @Generated + private String lastModifiedBy; + + /* + * The type of user who updated this resource. + */ + @Generated + private ByType lastModifiedByType; + + /** + * Creates an instance of DiscoveryEngine class. + * + * @param discoveryEngineStatus the discoveryEngineStatus value to set. + */ + @Generated + private DiscoveryEngine(DiscoveryEngineStatus discoveryEngineStatus) { + this.discoveryEngineStatus = discoveryEngineStatus; + } + + /** + * Get the discoveryEngineStatus property: The Discovery Engine status. + * + * @return the discoveryEngineStatus value. + */ + @Generated + public DiscoveryEngineStatus getDiscoveryEngineStatus() { + return this.discoveryEngineStatus; + } + + /** + * Get the systemPrompt property: The system prompt. + * + * @return the systemPrompt value. + */ + @Generated + public String getSystemPrompt() { + return this.systemPrompt; + } + + /** + * Get the configuration property: The Discovery Engine configuration. + * + * @return the configuration value. + */ + @Generated + public Map getConfiguration() { + return this.configuration; + } + + /** + * Get the createdAt property: The timestamp when the resource was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Get the createdBy property: The ID of the user who created this resource. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the createdByType property: The type of user who created this resource. + * + * @return the createdByType value. + */ + @Generated + public ByType getCreatedByType() { + return this.createdByType; + } + + /** + * Get the lastModifiedAt property: The timestamp when the resource was last updated. + * + * @return the lastModifiedAt value. + */ + @Generated + public OffsetDateTime getLastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Get the lastModifiedBy property: The ID of the user who updated this resource. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Get the lastModifiedByType property: The type of user who updated this resource. + * + * @return the lastModifiedByType value. + */ + @Generated + public ByType getLastModifiedByType() { + return this.lastModifiedByType; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("discoveryEngineStatus", + this.discoveryEngineStatus == null ? null : this.discoveryEngineStatus.toString()); + jsonWriter.writeStringField("systemPrompt", this.systemPrompt); + jsonWriter.writeMapField("configuration", this.configuration, (writer, element) -> { + if (element == null) { + writer.writeNull(); + } else { + element.writeTo(writer); + } + }); + jsonWriter.writeStringField("createdAt", + this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); + jsonWriter.writeStringField("createdBy", this.createdBy); + jsonWriter.writeStringField("createdByType", this.createdByType == null ? null : this.createdByType.toString()); + jsonWriter.writeStringField("lastModifiedAt", + this.lastModifiedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastModifiedAt)); + jsonWriter.writeStringField("lastModifiedBy", this.lastModifiedBy); + jsonWriter.writeStringField("lastModifiedByType", + this.lastModifiedByType == null ? null : this.lastModifiedByType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveryEngine from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveryEngine if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiscoveryEngine. + */ + @Generated + public static DiscoveryEngine fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveryEngineStatus discoveryEngineStatus = null; + String systemPrompt = null; + Map configuration = null; + OffsetDateTime createdAt = null; + String createdBy = null; + ByType createdByType = null; + OffsetDateTime lastModifiedAt = null; + String lastModifiedBy = null; + ByType lastModifiedByType = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("discoveryEngineStatus".equals(fieldName)) { + discoveryEngineStatus = DiscoveryEngineStatus.fromString(reader.getString()); + } else if ("systemPrompt".equals(fieldName)) { + systemPrompt = reader.getString(); + } else if ("configuration".equals(fieldName)) { + configuration = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + } else if ("createdAt".equals(fieldName)) { + createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + createdBy = reader.getString(); + } else if ("createdByType".equals(fieldName)) { + createdByType = ByType.fromString(reader.getString()); + } else if ("lastModifiedAt".equals(fieldName)) { + lastModifiedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + lastModifiedBy = reader.getString(); + } else if ("lastModifiedByType".equals(fieldName)) { + lastModifiedByType = ByType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + DiscoveryEngine deserializedDiscoveryEngine = new DiscoveryEngine(discoveryEngineStatus); + deserializedDiscoveryEngine.systemPrompt = systemPrompt; + deserializedDiscoveryEngine.configuration = configuration; + deserializedDiscoveryEngine.createdAt = createdAt; + deserializedDiscoveryEngine.createdBy = createdBy; + deserializedDiscoveryEngine.createdByType = createdByType; + deserializedDiscoveryEngine.lastModifiedAt = lastModifiedAt; + deserializedDiscoveryEngine.lastModifiedBy = lastModifiedBy; + deserializedDiscoveryEngine.lastModifiedByType = lastModifiedByType; + + return deserializedDiscoveryEngine; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/DiscoveryEngineStatus.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/DiscoveryEngineStatus.java new file mode 100644 index 000000000000..369bb9d60db7 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/DiscoveryEngineStatus.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Discovery Engine Status. + */ +public final class DiscoveryEngineStatus extends ExpandableStringEnum { + /** + * Discovery Engine Inactive. + */ + @Generated + public static final DiscoveryEngineStatus INACTIVE = fromString("Inactive"); + + /** + * Discovery Engine Active. + */ + @Generated + public static final DiscoveryEngineStatus ACTIVE = fromString("Active"); + + /** + * Creates a new instance of DiscoveryEngineStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public DiscoveryEngineStatus() { + } + + /** + * Creates or finds a DiscoveryEngineStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiscoveryEngineStatus. + */ + @Generated + public static DiscoveryEngineStatus fromString(String name) { + return fromString(name, DiscoveryEngineStatus.class); + } + + /** + * Gets known DiscoveryEngineStatus values. + * + * @return known DiscoveryEngineStatus values. + */ + @Generated + public static Collection values() { + return values(DiscoveryEngineStatus.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/DiscoveryEngineUpdate.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/DiscoveryEngineUpdate.java new file mode 100644 index 000000000000..22b7ea6d8868 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/DiscoveryEngineUpdate.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Discovery Engine Update Request. This will create the discovery engine if it does not already exist. + */ +@Fluent +public final class DiscoveryEngineUpdate implements JsonSerializable { + /* + * The system prompt. + */ + @Generated + private String systemPrompt; + + /* + * The Discovery Engine configuration. + */ + @Generated + private Map configuration; + + /** + * Creates an instance of DiscoveryEngineUpdate class. + */ + @Generated + public DiscoveryEngineUpdate() { + } + + /** + * Get the systemPrompt property: The system prompt. + * + * @return the systemPrompt value. + */ + @Generated + public String getSystemPrompt() { + return this.systemPrompt; + } + + /** + * Set the systemPrompt property: The system prompt. + * + * @param systemPrompt the systemPrompt value to set. + * @return the DiscoveryEngineUpdate object itself. + */ + @Generated + public DiscoveryEngineUpdate setSystemPrompt(String systemPrompt) { + this.systemPrompt = systemPrompt; + return this; + } + + /** + * Get the configuration property: The Discovery Engine configuration. + * + * @return the configuration value. + */ + @Generated + public Map getConfiguration() { + return this.configuration; + } + + /** + * Set the configuration property: The Discovery Engine configuration. + * + * @param configuration the configuration value to set. + * @return the DiscoveryEngineUpdate object itself. + */ + @Generated + public DiscoveryEngineUpdate setConfiguration(Map configuration) { + this.configuration = configuration; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("systemPrompt", this.systemPrompt); + jsonWriter.writeMapField("configuration", this.configuration, (writer, element) -> { + if (element == null) { + writer.writeNull(); + } else { + element.writeTo(writer); + } + }); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoveryEngineUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoveryEngineUpdate if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the DiscoveryEngineUpdate. + */ + @Generated + public static DiscoveryEngineUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoveryEngineUpdate deserializedDiscoveryEngineUpdate = new DiscoveryEngineUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("systemPrompt".equals(fieldName)) { + deserializedDiscoveryEngineUpdate.systemPrompt = reader.getString(); + } else if ("configuration".equals(fieldName)) { + Map configuration = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + deserializedDiscoveryEngineUpdate.configuration = configuration; + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoveryEngineUpdate; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/ExecutionHistoryEntry.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/ExecutionHistoryEntry.java new file mode 100644 index 000000000000..2de3bad7682d --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/ExecutionHistoryEntry.java @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Execution history entry for a task. + */ +@Fluent +public final class ExecutionHistoryEntry implements JsonSerializable { + /* + * Timestamp when the entry was created (ISO 8601 UTC format). + */ + @Generated + private OffsetDateTime createdAt; + + /* + * The action that was performed (controlled vocabulary; semi-open). + */ + @Generated + private String action; + + /* + * Identifier of who created this entry (GUID for user | resourceId for application | arbitrary string for other + * types). + */ + @Generated + private String createdBy; + + /* + * Type of entity that created this entry (User, Application, System, or custom type). + */ + @Generated + private ByType createdByType; + + /* + * Brief summary of the execution event. + */ + @Generated + private String summary; + + /* + * Detailed completion message. + */ + @Generated + private String responseMessageText; + + /* + * Run or message ID for full details. + */ + @Generated + private String responseMessageId; + + /* + * Freeform key-value pairs for additional details. + */ + @Generated + private Map additionalDetails; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setExecutionHistoryEntryAccessor(new JsonMergePatchHelper.ExecutionHistoryEntryAccessor() { + @Override + public ExecutionHistoryEntry prepareModelForJsonMergePatch(ExecutionHistoryEntry model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(ExecutionHistoryEntry model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of ExecutionHistoryEntry class. + */ + @Generated + public ExecutionHistoryEntry() { + } + + /** + * Get the createdAt property: Timestamp when the entry was created (ISO 8601 UTC format). + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: Timestamp when the entry was created (ISO 8601 UTC format). + *

Required when create the resource.

+ * + * @param createdAt the createdAt value to set. + * @return the ExecutionHistoryEntry object itself. + */ + @Generated + public ExecutionHistoryEntry setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + this.updatedProperties.add("createdAt"); + return this; + } + + /** + * Get the action property: The action that was performed (controlled vocabulary; semi-open). + * + * @return the action value. + */ + @Generated + public String getAction() { + return this.action; + } + + /** + * Set the action property: The action that was performed (controlled vocabulary; semi-open). + *

Required when create the resource.

+ * + * @param action the action value to set. + * @return the ExecutionHistoryEntry object itself. + */ + @Generated + public ExecutionHistoryEntry setAction(String action) { + this.action = action; + this.updatedProperties.add("action"); + return this; + } + + /** + * Get the createdBy property: Identifier of who created this entry (GUID for user | resourceId for application | + * arbitrary string for other types). + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Set the createdBy property: Identifier of who created this entry (GUID for user | resourceId for application | + * arbitrary string for other types). + *

Required when create the resource.

+ * + * @param createdBy the createdBy value to set. + * @return the ExecutionHistoryEntry object itself. + */ + @Generated + public ExecutionHistoryEntry setCreatedBy(String createdBy) { + this.createdBy = createdBy; + this.updatedProperties.add("createdBy"); + return this; + } + + /** + * Get the createdByType property: Type of entity that created this entry (User, Application, System, or custom + * type). + * + * @return the createdByType value. + */ + @Generated + public ByType getCreatedByType() { + return this.createdByType; + } + + /** + * Set the createdByType property: Type of entity that created this entry (User, Application, System, or custom + * type). + *

Required when create the resource.

+ * + * @param createdByType the createdByType value to set. + * @return the ExecutionHistoryEntry object itself. + */ + @Generated + public ExecutionHistoryEntry setCreatedByType(ByType createdByType) { + this.createdByType = createdByType; + this.updatedProperties.add("createdByType"); + return this; + } + + /** + * Get the summary property: Brief summary of the execution event. + * + * @return the summary value. + */ + @Generated + public String getSummary() { + return this.summary; + } + + /** + * Set the summary property: Brief summary of the execution event. + * + * @param summary the summary value to set. + * @return the ExecutionHistoryEntry object itself. + */ + @Generated + public ExecutionHistoryEntry setSummary(String summary) { + this.summary = summary; + this.updatedProperties.add("summary"); + return this; + } + + /** + * Get the responseMessageText property: Detailed completion message. + * + * @return the responseMessageText value. + */ + @Generated + public String getResponseMessageText() { + return this.responseMessageText; + } + + /** + * Set the responseMessageText property: Detailed completion message. + * + * @param responseMessageText the responseMessageText value to set. + * @return the ExecutionHistoryEntry object itself. + */ + @Generated + public ExecutionHistoryEntry setResponseMessageText(String responseMessageText) { + this.responseMessageText = responseMessageText; + this.updatedProperties.add("responseMessageText"); + return this; + } + + /** + * Get the responseMessageId property: Run or message ID for full details. + * + * @return the responseMessageId value. + */ + @Generated + public String getResponseMessageId() { + return this.responseMessageId; + } + + /** + * Set the responseMessageId property: Run or message ID for full details. + * + * @param responseMessageId the responseMessageId value to set. + * @return the ExecutionHistoryEntry object itself. + */ + @Generated + public ExecutionHistoryEntry setResponseMessageId(String responseMessageId) { + this.responseMessageId = responseMessageId; + this.updatedProperties.add("responseMessageId"); + return this; + } + + /** + * Get the additionalDetails property: Freeform key-value pairs for additional details. + * + * @return the additionalDetails value. + */ + @Generated + public Map getAdditionalDetails() { + return this.additionalDetails; + } + + /** + * Set the additionalDetails property: Freeform key-value pairs for additional details. + * + * @param additionalDetails the additionalDetails value to set. + * @return the ExecutionHistoryEntry object itself. + */ + @Generated + public ExecutionHistoryEntry setAdditionalDetails(Map additionalDetails) { + this.additionalDetails = additionalDetails; + this.updatedProperties.add("additionalDetails"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("createdAt", + this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); + jsonWriter.writeStringField("action", this.action); + jsonWriter.writeStringField("createdBy", this.createdBy); + jsonWriter.writeStringField("createdByType", + this.createdByType == null ? null : this.createdByType.toString()); + jsonWriter.writeStringField("summary", this.summary); + jsonWriter.writeStringField("responseMessageText", this.responseMessageText); + jsonWriter.writeStringField("responseMessageId", this.responseMessageId); + jsonWriter.writeMapField("additionalDetails", this.additionalDetails, (writer, element) -> { + if (element == null) { + writer.writeNull(); + } else { + element.writeTo(writer); + } + }); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("createdAt")) { + if (this.createdAt == null) { + jsonWriter.writeNullField("createdAt"); + } else { + jsonWriter.writeStringField("createdAt", + this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); + } + } + if (updatedProperties.contains("action")) { + if (this.action == null) { + jsonWriter.writeNullField("action"); + } else { + jsonWriter.writeStringField("action", this.action); + } + } + if (updatedProperties.contains("createdBy")) { + if (this.createdBy == null) { + jsonWriter.writeNullField("createdBy"); + } else { + jsonWriter.writeStringField("createdBy", this.createdBy); + } + } + if (updatedProperties.contains("createdByType")) { + if (this.createdByType == null) { + jsonWriter.writeNullField("createdByType"); + } else { + jsonWriter.writeStringField("createdByType", this.createdByType.toString()); + } + } + if (updatedProperties.contains("summary")) { + if (this.summary == null) { + jsonWriter.writeNullField("summary"); + } else { + jsonWriter.writeStringField("summary", this.summary); + } + } + if (updatedProperties.contains("responseMessageText")) { + if (this.responseMessageText == null) { + jsonWriter.writeNullField("responseMessageText"); + } else { + jsonWriter.writeStringField("responseMessageText", this.responseMessageText); + } + } + if (updatedProperties.contains("responseMessageId")) { + if (this.responseMessageId == null) { + jsonWriter.writeNullField("responseMessageId"); + } else { + jsonWriter.writeStringField("responseMessageId", this.responseMessageId); + } + } + if (updatedProperties.contains("additionalDetails")) { + if (this.additionalDetails == null) { + jsonWriter.writeNullField("additionalDetails"); + } else { + jsonWriter.writeMapField("additionalDetails", this.additionalDetails, (writer, element) -> { + if (element == null) { + writer.writeNull(); + } else { + element.writeTo(writer); + } + }); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExecutionHistoryEntry from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExecutionHistoryEntry if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExecutionHistoryEntry. + */ + @Generated + public static ExecutionHistoryEntry fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExecutionHistoryEntry deserializedExecutionHistoryEntry = new ExecutionHistoryEntry(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("createdAt".equals(fieldName)) { + deserializedExecutionHistoryEntry.createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("action".equals(fieldName)) { + deserializedExecutionHistoryEntry.action = reader.getString(); + } else if ("createdBy".equals(fieldName)) { + deserializedExecutionHistoryEntry.createdBy = reader.getString(); + } else if ("createdByType".equals(fieldName)) { + deserializedExecutionHistoryEntry.createdByType = ByType.fromString(reader.getString()); + } else if ("summary".equals(fieldName)) { + deserializedExecutionHistoryEntry.summary = reader.getString(); + } else if ("responseMessageText".equals(fieldName)) { + deserializedExecutionHistoryEntry.responseMessageText = reader.getString(); + } else if ("responseMessageId".equals(fieldName)) { + deserializedExecutionHistoryEntry.responseMessageId = reader.getString(); + } else if ("additionalDetails".equals(fieldName)) { + Map additionalDetails = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + deserializedExecutionHistoryEntry.additionalDetails = additionalDetails; + } else { + reader.skipChildren(); + } + } + + return deserializedExecutionHistoryEntry; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/IndexingMetrics.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/IndexingMetrics.java new file mode 100644 index 000000000000..4c19188c664b --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/IndexingMetrics.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Indexing metrics for a run. + */ +@Immutable +public final class IndexingMetrics implements JsonSerializable { + /* + * The number of documents that were successfully processed. + */ + @Generated + private final int documentsProcessed; + + /* + * The number of documents that failed during indexing. + */ + @Generated + private final int documentsFailed; + + /* + * The total number of documents considered for indexing. + */ + @Generated + private final int documentsTotal; + + /* + * The indexing completion percentage from 0 to 100. + */ + @Generated + private final int indexingPercentageComplete; + + /* + * The UTC timestamp when enrichment started. + */ + @Generated + private OffsetDateTime enrichmentStartTimeUtc; + + /* + * The UTC timestamp when enrichment ended. + */ + @Generated + private OffsetDateTime enrichmentEndTimeUtc; + + /* + * The UTC timestamp when indexing started. + */ + @Generated + private OffsetDateTime indexingStartTimeUtc; + + /* + * The UTC timestamp when indexing ended. + */ + @Generated + private OffsetDateTime indexingEndTimeUtc; + + /** + * Creates an instance of IndexingMetrics class. + * + * @param documentsProcessed the documentsProcessed value to set. + * @param documentsFailed the documentsFailed value to set. + * @param documentsTotal the documentsTotal value to set. + * @param indexingPercentageComplete the indexingPercentageComplete value to set. + */ + @Generated + private IndexingMetrics(int documentsProcessed, int documentsFailed, int documentsTotal, + int indexingPercentageComplete) { + this.documentsProcessed = documentsProcessed; + this.documentsFailed = documentsFailed; + this.documentsTotal = documentsTotal; + this.indexingPercentageComplete = indexingPercentageComplete; + } + + /** + * Get the documentsProcessed property: The number of documents that were successfully processed. + * + * @return the documentsProcessed value. + */ + @Generated + public int getDocumentsProcessed() { + return this.documentsProcessed; + } + + /** + * Get the documentsFailed property: The number of documents that failed during indexing. + * + * @return the documentsFailed value. + */ + @Generated + public int getDocumentsFailed() { + return this.documentsFailed; + } + + /** + * Get the documentsTotal property: The total number of documents considered for indexing. + * + * @return the documentsTotal value. + */ + @Generated + public int getDocumentsTotal() { + return this.documentsTotal; + } + + /** + * Get the indexingPercentageComplete property: The indexing completion percentage from 0 to 100. + * + * @return the indexingPercentageComplete value. + */ + @Generated + public int getIndexingPercentageComplete() { + return this.indexingPercentageComplete; + } + + /** + * Get the enrichmentStartTimeUtc property: The UTC timestamp when enrichment started. + * + * @return the enrichmentStartTimeUtc value. + */ + @Generated + public OffsetDateTime getEnrichmentStartTimeUtc() { + return this.enrichmentStartTimeUtc; + } + + /** + * Get the enrichmentEndTimeUtc property: The UTC timestamp when enrichment ended. + * + * @return the enrichmentEndTimeUtc value. + */ + @Generated + public OffsetDateTime getEnrichmentEndTimeUtc() { + return this.enrichmentEndTimeUtc; + } + + /** + * Get the indexingStartTimeUtc property: The UTC timestamp when indexing started. + * + * @return the indexingStartTimeUtc value. + */ + @Generated + public OffsetDateTime getIndexingStartTimeUtc() { + return this.indexingStartTimeUtc; + } + + /** + * Get the indexingEndTimeUtc property: The UTC timestamp when indexing ended. + * + * @return the indexingEndTimeUtc value. + */ + @Generated + public OffsetDateTime getIndexingEndTimeUtc() { + return this.indexingEndTimeUtc; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("documentsProcessed", this.documentsProcessed); + jsonWriter.writeIntField("documentsFailed", this.documentsFailed); + jsonWriter.writeIntField("documentsTotal", this.documentsTotal); + jsonWriter.writeIntField("indexingPercentageComplete", this.indexingPercentageComplete); + jsonWriter.writeStringField("enrichmentStartTimeUtc", + this.enrichmentStartTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.enrichmentStartTimeUtc)); + jsonWriter.writeStringField("enrichmentEndTimeUtc", + this.enrichmentEndTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.enrichmentEndTimeUtc)); + jsonWriter.writeStringField("indexingStartTimeUtc", + this.indexingStartTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.indexingStartTimeUtc)); + jsonWriter.writeStringField("indexingEndTimeUtc", + this.indexingEndTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.indexingEndTimeUtc)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexingMetrics from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexingMetrics if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IndexingMetrics. + */ + @Generated + public static IndexingMetrics fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int documentsProcessed = 0; + int documentsFailed = 0; + int documentsTotal = 0; + int indexingPercentageComplete = 0; + OffsetDateTime enrichmentStartTimeUtc = null; + OffsetDateTime enrichmentEndTimeUtc = null; + OffsetDateTime indexingStartTimeUtc = null; + OffsetDateTime indexingEndTimeUtc = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("documentsProcessed".equals(fieldName)) { + documentsProcessed = reader.getInt(); + } else if ("documentsFailed".equals(fieldName)) { + documentsFailed = reader.getInt(); + } else if ("documentsTotal".equals(fieldName)) { + documentsTotal = reader.getInt(); + } else if ("indexingPercentageComplete".equals(fieldName)) { + indexingPercentageComplete = reader.getInt(); + } else if ("enrichmentStartTimeUtc".equals(fieldName)) { + enrichmentStartTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("enrichmentEndTimeUtc".equals(fieldName)) { + enrichmentEndTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("indexingStartTimeUtc".equals(fieldName)) { + indexingStartTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("indexingEndTimeUtc".equals(fieldName)) { + indexingEndTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + IndexingMetrics deserializedIndexingMetrics + = new IndexingMetrics(documentsProcessed, documentsFailed, documentsTotal, indexingPercentageComplete); + deserializedIndexingMetrics.enrichmentStartTimeUtc = enrichmentStartTimeUtc; + deserializedIndexingMetrics.enrichmentEndTimeUtc = enrichmentEndTimeUtc; + deserializedIndexingMetrics.indexingStartTimeUtc = indexingStartTimeUtc; + deserializedIndexingMetrics.indexingEndTimeUtc = indexingEndTimeUtc; + + return deserializedIndexingMetrics; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/IndexingOperationResult.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/IndexingOperationResult.java new file mode 100644 index 000000000000..326a8fb6775e --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/IndexingOperationResult.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Result details for an indexing operation. + */ +@Immutable +public final class IndexingOperationResult implements JsonSerializable { + /* + * The operation run identifier. + */ + @Generated + private final String runId; + + /* + * Indexing run metrics. + */ + @Generated + private IndexingMetrics metrics; + + /** + * Creates an instance of IndexingOperationResult class. + * + * @param runId the runId value to set. + */ + @Generated + private IndexingOperationResult(String runId) { + this.runId = runId; + } + + /** + * Get the runId property: The operation run identifier. + * + * @return the runId value. + */ + @Generated + public String getRunId() { + return this.runId; + } + + /** + * Get the metrics property: Indexing run metrics. + * + * @return the metrics value. + */ + @Generated + public IndexingMetrics getMetrics() { + return this.metrics; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("runId", this.runId); + jsonWriter.writeJsonField("metrics", this.metrics); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IndexingOperationResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IndexingOperationResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the IndexingOperationResult. + */ + @Generated + public static IndexingOperationResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String runId = null; + IndexingMetrics metrics = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("runId".equals(fieldName)) { + runId = reader.getString(); + } else if ("metrics".equals(fieldName)) { + metrics = IndexingMetrics.fromJson(reader); + } else { + reader.skipChildren(); + } + } + IndexingOperationResult deserializedIndexingOperationResult = new IndexingOperationResult(runId); + deserializedIndexingOperationResult.metrics = metrics; + + return deserializedIndexingOperationResult; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/IndexingStatus.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/IndexingStatus.java new file mode 100644 index 000000000000..599f979f2ad3 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/IndexingStatus.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum for IndexingStatus. + */ +public final class IndexingStatus extends ExpandableStringEnum { + /** + * Indexing Not started. + */ + @Generated + public static final IndexingStatus NOT_STARTED = fromString("NotStarted"); + + /** + * Running. + */ + @Generated + public static final IndexingStatus RUNNING = fromString("Running"); + + /** + * Succeeded. + */ + @Generated + public static final IndexingStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Canceled. + */ + @Generated + public static final IndexingStatus CANCELED = fromString("Canceled"); + + /** + * Failed. + */ + @Generated + public static final IndexingStatus FAILED = fromString("Failed"); + + /** + * Creates a new instance of IndexingStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public IndexingStatus() { + } + + /** + * Creates or finds a IndexingStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding IndexingStatus. + */ + @Generated + public static IndexingStatus fromString(String name) { + return fromString(name, IndexingStatus.class); + } + + /** + * Gets known IndexingStatus values. + * + * @return known IndexingStatus values. + */ + @Generated + public static Collection values() { + return values(IndexingStatus.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InfraOverrides.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InfraOverrides.java new file mode 100644 index 000000000000..6d5b05f14661 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InfraOverrides.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Explicitly set tool run requirements - overrides the tool definition. + */ +@Fluent +public final class InfraOverrides implements JsonSerializable { + /* + * Override CPU requirements (e.g. 1, or 500m for 500 milli-CPUs) + */ + @Generated + private String cpu; + + /* + * Override RAM requirements (e.g. 500Mi or 1Gi). + */ + @Generated + private String ram; + + /* + * Override GPU count requirements. + */ + @Generated + private String gpu; + + /* + * Override the number of replicas of the tool image to run. + */ + @Generated + private Integer replicaCount; + + /* + * Override the image to use for this tool run. + */ + @Generated + private String imageUri; + + /* + * Override the maximum CPU allowed for the tool run (e.g. 1, or 500m for 500 milli-CPUs) + */ + @Generated + private String maxCpu; + + /* + * Override the maximum RAM allowed for the tool run (e.g. 500Mi or 1Gi) + */ + @Generated + private String maxRam; + + /* + * Override the maximum GPU count allowed for the tool run + */ + @Generated + private String maxGpu; + + /** + * Creates an instance of InfraOverrides class. + */ + @Generated + public InfraOverrides() { + } + + /** + * Get the cpu property: Override CPU requirements (e.g. 1, or 500m for 500 milli-CPUs). + * + * @return the cpu value. + */ + @Generated + public String getCpu() { + return this.cpu; + } + + /** + * Set the cpu property: Override CPU requirements (e.g. 1, or 500m for 500 milli-CPUs). + * + * @param cpu the cpu value to set. + * @return the InfraOverrides object itself. + */ + @Generated + public InfraOverrides setCpu(String cpu) { + this.cpu = cpu; + return this; + } + + /** + * Get the ram property: Override RAM requirements (e.g. 500Mi or 1Gi). + * + * @return the ram value. + */ + @Generated + public String getRam() { + return this.ram; + } + + /** + * Set the ram property: Override RAM requirements (e.g. 500Mi or 1Gi). + * + * @param ram the ram value to set. + * @return the InfraOverrides object itself. + */ + @Generated + public InfraOverrides setRam(String ram) { + this.ram = ram; + return this; + } + + /** + * Get the gpu property: Override GPU count requirements. + * + * @return the gpu value. + */ + @Generated + public String getGpu() { + return this.gpu; + } + + /** + * Set the gpu property: Override GPU count requirements. + * + * @param gpu the gpu value to set. + * @return the InfraOverrides object itself. + */ + @Generated + public InfraOverrides setGpu(String gpu) { + this.gpu = gpu; + return this; + } + + /** + * Get the replicaCount property: Override the number of replicas of the tool image to run. + * + * @return the replicaCount value. + */ + @Generated + public Integer getReplicaCount() { + return this.replicaCount; + } + + /** + * Set the replicaCount property: Override the number of replicas of the tool image to run. + * + * @param replicaCount the replicaCount value to set. + * @return the InfraOverrides object itself. + */ + @Generated + public InfraOverrides setReplicaCount(Integer replicaCount) { + this.replicaCount = replicaCount; + return this; + } + + /** + * Get the imageUri property: Override the image to use for this tool run. + * + * @return the imageUri value. + */ + @Generated + public String getImageUri() { + return this.imageUri; + } + + /** + * Set the imageUri property: Override the image to use for this tool run. + * + * @param imageUri the imageUri value to set. + * @return the InfraOverrides object itself. + */ + @Generated + public InfraOverrides setImageUri(String imageUri) { + this.imageUri = imageUri; + return this; + } + + /** + * Get the maxCpu property: Override the maximum CPU allowed for the tool run (e.g. 1, or 500m for 500 milli-CPUs). + * + * @return the maxCpu value. + */ + @Generated + public String getMaxCpu() { + return this.maxCpu; + } + + /** + * Set the maxCpu property: Override the maximum CPU allowed for the tool run (e.g. 1, or 500m for 500 milli-CPUs). + * + * @param maxCpu the maxCpu value to set. + * @return the InfraOverrides object itself. + */ + @Generated + public InfraOverrides setMaxCpu(String maxCpu) { + this.maxCpu = maxCpu; + return this; + } + + /** + * Get the maxRam property: Override the maximum RAM allowed for the tool run (e.g. 500Mi or 1Gi). + * + * @return the maxRam value. + */ + @Generated + public String getMaxRam() { + return this.maxRam; + } + + /** + * Set the maxRam property: Override the maximum RAM allowed for the tool run (e.g. 500Mi or 1Gi). + * + * @param maxRam the maxRam value to set. + * @return the InfraOverrides object itself. + */ + @Generated + public InfraOverrides setMaxRam(String maxRam) { + this.maxRam = maxRam; + return this; + } + + /** + * Get the maxGpu property: Override the maximum GPU count allowed for the tool run. + * + * @return the maxGpu value. + */ + @Generated + public String getMaxGpu() { + return this.maxGpu; + } + + /** + * Set the maxGpu property: Override the maximum GPU count allowed for the tool run. + * + * @param maxGpu the maxGpu value to set. + * @return the InfraOverrides object itself. + */ + @Generated + public InfraOverrides setMaxGpu(String maxGpu) { + this.maxGpu = maxGpu; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("cpu", this.cpu); + jsonWriter.writeStringField("ram", this.ram); + jsonWriter.writeStringField("gpu", this.gpu); + jsonWriter.writeNumberField("replicaCount", this.replicaCount); + jsonWriter.writeStringField("imageUri", this.imageUri); + jsonWriter.writeStringField("maxCpu", this.maxCpu); + jsonWriter.writeStringField("maxRam", this.maxRam); + jsonWriter.writeStringField("maxGpu", this.maxGpu); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InfraOverrides from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InfraOverrides if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the InfraOverrides. + */ + @Generated + public static InfraOverrides fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InfraOverrides deserializedInfraOverrides = new InfraOverrides(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cpu".equals(fieldName)) { + deserializedInfraOverrides.cpu = reader.getString(); + } else if ("ram".equals(fieldName)) { + deserializedInfraOverrides.ram = reader.getString(); + } else if ("gpu".equals(fieldName)) { + deserializedInfraOverrides.gpu = reader.getString(); + } else if ("replicaCount".equals(fieldName)) { + deserializedInfraOverrides.replicaCount = reader.getNullable(JsonReader::getInt); + } else if ("imageUri".equals(fieldName)) { + deserializedInfraOverrides.imageUri = reader.getString(); + } else if ("maxCpu".equals(fieldName)) { + deserializedInfraOverrides.maxCpu = reader.getString(); + } else if ("maxRam".equals(fieldName)) { + deserializedInfraOverrides.maxRam = reader.getString(); + } else if ("maxGpu".equals(fieldName)) { + deserializedInfraOverrides.maxGpu = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInfraOverrides; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InlineFile.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InlineFile.java new file mode 100644 index 000000000000..55987f16e6c5 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InlineFile.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A file to be included in the input data for a tool run and the path where it will be mounted, relative to the working + * directory. + */ +@Immutable +public final class InlineFile implements JsonSerializable { + /* + * Absolute path within the container at which to mount this file. + */ + @Generated + private final String mountPath; + + /* + * File contents: Compressed using .gz then base64-encoded. + */ + @Generated + private final String encodedFile; + + /** + * Creates an instance of InlineFile class. + * + * @param mountPath the mountPath value to set. + * @param encodedFile the encodedFile value to set. + */ + @Generated + public InlineFile(String mountPath, String encodedFile) { + this.mountPath = mountPath; + this.encodedFile = encodedFile; + } + + /** + * Get the mountPath property: Absolute path within the container at which to mount this file. + * + * @return the mountPath value. + */ + @Generated + public String getMountPath() { + return this.mountPath; + } + + /** + * Get the encodedFile property: File contents: Compressed using .gz then base64-encoded. + * + * @return the encodedFile value. + */ + @Generated + public String getEncodedFile() { + return this.encodedFile; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("mountPath", this.mountPath); + jsonWriter.writeStringField("encodedFile", this.encodedFile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InlineFile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InlineFile if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InlineFile. + */ + @Generated + public static InlineFile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String mountPath = null; + String encodedFile = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mountPath".equals(fieldName)) { + mountPath = reader.getString(); + } else if ("encodedFile".equals(fieldName)) { + encodedFile = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new InlineFile(mountPath, encodedFile); + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InputDataMount.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InputDataMount.java new file mode 100644 index 000000000000..83336a487b6c --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InputDataMount.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Data URI and path where it will be mounted in the tool container. + */ +@Fluent +public final class InputDataMount implements JsonSerializable { + /* + * URI of input data to mount. + */ + @Generated + private final String storageUri; + + /* + * Absolute path within the container at which to mount this input. + */ + @Generated + private final String mountPath; + + /* + * The protocol to use for mounting this storage. Overrides any value specified on the storage container. + */ + @Generated + private StorageMountProtocol mountProtocol; + + /** + * Creates an instance of InputDataMount class. + * + * @param storageUri the storageUri value to set. + * @param mountPath the mountPath value to set. + */ + @Generated + public InputDataMount(String storageUri, String mountPath) { + this.storageUri = storageUri; + this.mountPath = mountPath; + } + + /** + * Get the storageUri property: URI of input data to mount. + * + * @return the storageUri value. + */ + @Generated + public String getStorageUri() { + return this.storageUri; + } + + /** + * Get the mountPath property: Absolute path within the container at which to mount this input. + * + * @return the mountPath value. + */ + @Generated + public String getMountPath() { + return this.mountPath; + } + + /** + * Get the mountProtocol property: The protocol to use for mounting this storage. Overrides any value specified on + * the storage container. + * + * @return the mountProtocol value. + */ + @Generated + public StorageMountProtocol getMountProtocol() { + return this.mountProtocol; + } + + /** + * Set the mountProtocol property: The protocol to use for mounting this storage. Overrides any value specified on + * the storage container. + * + * @param mountProtocol the mountProtocol value to set. + * @return the InputDataMount object itself. + */ + @Generated + public InputDataMount setMountProtocol(StorageMountProtocol mountProtocol) { + this.mountProtocol = mountProtocol; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("storageUri", this.storageUri); + jsonWriter.writeStringField("mountPath", this.mountPath); + jsonWriter.writeStringField("mountProtocol", this.mountProtocol == null ? null : this.mountProtocol.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InputDataMount from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InputDataMount if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InputDataMount. + */ + @Generated + public static InputDataMount fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String storageUri = null; + String mountPath = null; + StorageMountProtocol mountProtocol = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageUri".equals(fieldName)) { + storageUri = reader.getString(); + } else if ("mountPath".equals(fieldName)) { + mountPath = reader.getString(); + } else if ("mountProtocol".equals(fieldName)) { + mountProtocol = StorageMountProtocol.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + InputDataMount deserializedInputDataMount = new InputDataMount(storageUri, mountPath); + deserializedInputDataMount.mountProtocol = mountProtocol; + + return deserializedInputDataMount; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Investigation.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Investigation.java new file mode 100644 index 000000000000..880c97ba2a04 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Investigation.java @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * A investigation list item. + */ +@Fluent +public final class Investigation implements JsonSerializable { + /* + * The investigation name. + */ + @Generated + private String name; + + /* + * The parent project name. + */ + @Generated + private String projectName; + + /* + * The timestamp when the resource was created + */ + @Generated + private OffsetDateTime createdAt; + + /* + * The ID of the user who created this resource. + */ + @Generated + private String createdBy; + + /* + * The type of user who created this resource. + */ + @Generated + private ByType createdByType; + + /* + * The timestamp when the resource was last updated + */ + @Generated + private OffsetDateTime lastModifiedAt; + + /* + * The ID of the user who updated this resource. + */ + @Generated + private String lastModifiedBy; + + /* + * The type of user who updated this resource. + */ + @Generated + private ByType lastModifiedByType; + + /* + * The status + */ + @Generated + private InvestigationStatus status; + + /* + * The description + */ + @Generated + private String description; + + /* + * The tags + */ + @Generated + private List tags; + + /* + * The title + */ + @Generated + private String displayName; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setInvestigationAccessor(new JsonMergePatchHelper.InvestigationAccessor() { + @Override + public Investigation prepareModelForJsonMergePatch(Investigation model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(Investigation model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of Investigation class. + */ + @Generated + public Investigation() { + } + + /** + * Get the name property: The investigation name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the projectName property: The parent project name. + * + * @return the projectName value. + */ + @Generated + public String getProjectName() { + return this.projectName; + } + + /** + * Get the createdAt property: The timestamp when the resource was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Get the createdBy property: The ID of the user who created this resource. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the createdByType property: The type of user who created this resource. + * + * @return the createdByType value. + */ + @Generated + public ByType getCreatedByType() { + return this.createdByType; + } + + /** + * Get the lastModifiedAt property: The timestamp when the resource was last updated. + * + * @return the lastModifiedAt value. + */ + @Generated + public OffsetDateTime getLastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Get the lastModifiedBy property: The ID of the user who updated this resource. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Get the lastModifiedByType property: The type of user who updated this resource. + * + * @return the lastModifiedByType value. + */ + @Generated + public ByType getLastModifiedByType() { + return this.lastModifiedByType; + } + + /** + * Get the status property: The status. + * + * @return the status value. + */ + @Generated + public InvestigationStatus getStatus() { + return this.status; + } + + /** + * Get the description property: The description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description. + * + * @param description the description value to set. + * @return the Investigation object itself. + */ + @Generated + public Investigation setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * Get the tags property: The tags. + * + * @return the tags value. + */ + @Generated + public List getTags() { + return this.tags; + } + + /** + * Set the tags property: The tags. + * + * @param tags the tags value to set. + * @return the Investigation object itself. + */ + @Generated + public Investigation setTags(List tags) { + this.tags = tags; + this.updatedProperties.add("tags"); + return this; + } + + /** + * Get the displayName property: The title. + * + * @return the displayName value. + */ + @Generated + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: The title. + * + * @param displayName the displayName value to set. + * @return the Investigation object itself. + */ + @Generated + public Investigation setDisplayName(String displayName) { + this.displayName = displayName; + this.updatedProperties.add("displayName"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeArrayField("tags", this.tags, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("displayName", this.displayName); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + if (updatedProperties.contains("tags")) { + if (this.tags == null) { + jsonWriter.writeNullField("tags"); + } else { + jsonWriter.writeArrayField("tags", this.tags, (writer, element) -> writer.writeJson(element)); + } + } + if (updatedProperties.contains("displayName")) { + if (this.displayName == null) { + jsonWriter.writeNullField("displayName"); + } else { + jsonWriter.writeStringField("displayName", this.displayName); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Investigation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Investigation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Investigation. + */ + @Generated + public static Investigation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Investigation deserializedInvestigation = new Investigation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedInvestigation.name = reader.getString(); + } else if ("projectName".equals(fieldName)) { + deserializedInvestigation.projectName = reader.getString(); + } else if ("createdAt".equals(fieldName)) { + deserializedInvestigation.createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedInvestigation.createdBy = reader.getString(); + } else if ("createdByType".equals(fieldName)) { + deserializedInvestigation.createdByType = ByType.fromString(reader.getString()); + } else if ("lastModifiedAt".equals(fieldName)) { + deserializedInvestigation.lastModifiedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedInvestigation.lastModifiedBy = reader.getString(); + } else if ("lastModifiedByType".equals(fieldName)) { + deserializedInvestigation.lastModifiedByType = ByType.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedInvestigation.status = InvestigationStatus.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedInvestigation.description = reader.getString(); + } else if ("tags".equals(fieldName)) { + List tags = reader.readArray(reader1 -> Tag.fromJson(reader1)); + deserializedInvestigation.tags = tags; + } else if ("displayName".equals(fieldName)) { + deserializedInvestigation.displayName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInvestigation; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InvestigationOperationStatus.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InvestigationOperationStatus.java new file mode 100644 index 000000000000..2ea7b03fe015 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InvestigationOperationStatus.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The status of a long-running Investigation operation. + */ +@Immutable +public final class InvestigationOperationStatus implements JsonSerializable { + /* + * The unique ID of the operation. + */ + @Generated + private String id; + + /* + * The status of the operation + */ + @Generated + private final OperationState status; + + /* + * Error object that describes the error when status is "Failed". + */ + @Generated + private ResponseError error; + + /* + * The result of the operation. + */ + @Generated + private Investigation result; + + /** + * Creates an instance of InvestigationOperationStatus class. + * + * @param status the status value to set. + */ + @Generated + private InvestigationOperationStatus(OperationState status) { + this.status = status; + } + + /** + * Get the id property: The unique ID of the operation. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the status property: The status of the operation. + * + * @return the status value. + */ + @Generated + public OperationState getStatus() { + return this.status; + } + + /** + * Get the error property: Error object that describes the error when status is "Failed". + * + * @return the error value. + */ + @Generated + public ResponseError getError() { + return this.error; + } + + /** + * Get the result property: The result of the operation. + * + * @return the result value. + */ + @Generated + public Investigation getResult() { + return this.result; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("error", this.error); + jsonWriter.writeJsonField("result", this.result); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InvestigationOperationStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InvestigationOperationStatus if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the InvestigationOperationStatus. + */ + @Generated + public static InvestigationOperationStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + OperationState status = null; + ResponseError error = null; + Investigation result = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("status".equals(fieldName)) { + status = OperationState.fromString(reader.getString()); + } else if ("error".equals(fieldName)) { + error = ResponseError.fromJson(reader); + } else if ("result".equals(fieldName)) { + result = Investigation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + InvestigationOperationStatus deserializedInvestigationOperationStatus + = new InvestigationOperationStatus(status); + deserializedInvestigationOperationStatus.id = id; + deserializedInvestigationOperationStatus.error = error; + deserializedInvestigationOperationStatus.result = result; + + return deserializedInvestigationOperationStatus; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InvestigationStatus.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InvestigationStatus.java new file mode 100644 index 000000000000..3c81a382b3e5 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/InvestigationStatus.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status. + */ +public final class InvestigationStatus extends ExpandableStringEnum { + /** + * Investigation Created. + */ + @Generated + public static final InvestigationStatus CREATED = fromString("Created"); + + /** + * Investigation Validated. + */ + @Generated + public static final InvestigationStatus VALIDATED = fromString("Validated"); + + /** + * Investigation Failed. + */ + @Generated + public static final InvestigationStatus FAILED = fromString("Failed"); + + /** + * Creates a new instance of InvestigationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public InvestigationStatus() { + } + + /** + * Creates or finds a InvestigationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding InvestigationStatus. + */ + @Generated + public static InvestigationStatus fromString(String name) { + return fromString(name, InvestigationStatus.class); + } + + /** + * Gets known InvestigationStatus values. + * + * @return known InvestigationStatus values. + */ + @Generated + public static Collection values() { + return values(InvestigationStatus.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBase.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBase.java new file mode 100644 index 000000000000..94abb429a3eb --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBase.java @@ -0,0 +1,543 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.models.ResponseError; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * A knowledgeBase. + */ +@Fluent +public final class KnowledgeBase implements JsonSerializable { + /* + * The knowledgeBase name. + */ + @Generated + private String name; + + /* + * The ID for the resource. + */ + @Generated + private String id; + + /* + * The name of the associated Bookshelf tracked resource. + */ + @Generated + private String bookshelfName; + + /* + * Storage asset references to index. + */ + @Generated + private List storageAssetReferences; + + /* + * URL to access the knowledge base. + */ + @Generated + private String knowledgeBaseUrl; + + /* + * Provisioning state. + */ + @Generated + private ProvisioningState provisioningState; + + /* + * Error details if provisioning failed. + */ + @Generated + private ResponseError error; + + /* + * The status + */ + @Generated + private IndexingStatus status; + + /* + * The API version used to create this knowledge base. + */ + @Generated + private String createdByApiVersion; + + /* + * The details of the most recent indexing run. + */ + @Generated + private LastIndexingRun lastIndexingRun; + + /* + * The timestamp when the resource was created + */ + @Generated + private OffsetDateTime createdAt; + + /* + * The ID of the user who created this resource. + */ + @Generated + private String createdBy; + + /* + * The type of user who created this resource. + */ + @Generated + private ByType createdByType; + + /* + * The timestamp when the resource was last updated + */ + @Generated + private OffsetDateTime lastModifiedAt; + + /* + * The ID of the user who updated this resource. + */ + @Generated + private String lastModifiedBy; + + /* + * The type of user who updated this resource. + */ + @Generated + private ByType lastModifiedByType; + + /* + * The tags + */ + @Generated + private List tags; + + /* + * The description + */ + @Generated + private String description; + + /* + * The copilot instruction + */ + @Generated + private String copilotInstruction; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setKnowledgeBaseAccessor(new JsonMergePatchHelper.KnowledgeBaseAccessor() { + @Override + public KnowledgeBase prepareModelForJsonMergePatch(KnowledgeBase model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(KnowledgeBase model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of KnowledgeBase class. + */ + @Generated + public KnowledgeBase() { + } + + /** + * Get the name property: The knowledgeBase name. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the id property: The ID for the resource. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the bookshelfName property: The name of the associated Bookshelf tracked resource. + * + * @return the bookshelfName value. + */ + @Generated + public String getBookshelfName() { + return this.bookshelfName; + } + + /** + * Get the storageAssetReferences property: Storage asset references to index. + * + * @return the storageAssetReferences value. + */ + @Generated + public List getStorageAssetReferences() { + return this.storageAssetReferences; + } + + /** + * Set the storageAssetReferences property: Storage asset references to index. + * + * @param storageAssetReferences the storageAssetReferences value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setStorageAssetReferences(List storageAssetReferences) { + this.storageAssetReferences = storageAssetReferences; + this.updatedProperties.add("storageAssetReferences"); + return this; + } + + /** + * Get the knowledgeBaseUrl property: URL to access the knowledge base. + * + * @return the knowledgeBaseUrl value. + */ + @Generated + public String getKnowledgeBaseUrl() { + return this.knowledgeBaseUrl; + } + + /** + * Get the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + @Generated + public ProvisioningState getProvisioningState() { + return this.provisioningState; + } + + /** + * Get the error property: Error details if provisioning failed. + * + * @return the error value. + */ + @Generated + public ResponseError getError() { + return this.error; + } + + /** + * Get the status property: The status. + * + * @return the status value. + */ + @Generated + public IndexingStatus getStatus() { + return this.status; + } + + /** + * Get the createdByApiVersion property: The API version used to create this knowledge base. + * + * @return the createdByApiVersion value. + */ + @Generated + public String getCreatedByApiVersion() { + return this.createdByApiVersion; + } + + /** + * Get the lastIndexingRun property: The details of the most recent indexing run. + * + * @return the lastIndexingRun value. + */ + @Generated + public LastIndexingRun getLastIndexingRun() { + return this.lastIndexingRun; + } + + /** + * Get the createdAt property: The timestamp when the resource was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Get the createdBy property: The ID of the user who created this resource. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the createdByType property: The type of user who created this resource. + * + * @return the createdByType value. + */ + @Generated + public ByType getCreatedByType() { + return this.createdByType; + } + + /** + * Get the lastModifiedAt property: The timestamp when the resource was last updated. + * + * @return the lastModifiedAt value. + */ + @Generated + public OffsetDateTime getLastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Get the lastModifiedBy property: The ID of the user who updated this resource. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Get the lastModifiedByType property: The type of user who updated this resource. + * + * @return the lastModifiedByType value. + */ + @Generated + public ByType getLastModifiedByType() { + return this.lastModifiedByType; + } + + /** + * Get the tags property: The tags. + * + * @return the tags value. + */ + @Generated + public List getTags() { + return this.tags; + } + + /** + * Set the tags property: The tags. + * + * @param tags the tags value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setTags(List tags) { + this.tags = tags; + this.updatedProperties.add("tags"); + return this; + } + + /** + * Get the description property: The description. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description. + *

Required when create the resource.

+ * + * @param description the description value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * Get the copilotInstruction property: The copilot instruction. + * + * @return the copilotInstruction value. + */ + @Generated + public String getCopilotInstruction() { + return this.copilotInstruction; + } + + /** + * Set the copilotInstruction property: The copilot instruction. + *

Required when create the resource.

+ * + * @param copilotInstruction the copilotInstruction value to set. + * @return the KnowledgeBase object itself. + */ + @Generated + public KnowledgeBase setCopilotInstruction(String copilotInstruction) { + this.copilotInstruction = copilotInstruction; + this.updatedProperties.add("copilotInstruction"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("storageAssetReferences", this.storageAssetReferences, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("tags", this.tags, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("copilotInstruction", this.copilotInstruction); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("storageAssetReferences")) { + if (this.storageAssetReferences == null) { + jsonWriter.writeNullField("storageAssetReferences"); + } else { + jsonWriter.writeArrayField("storageAssetReferences", this.storageAssetReferences, + (writer, element) -> writer.writeJson(element)); + } + } + if (updatedProperties.contains("tags")) { + if (this.tags == null) { + jsonWriter.writeNullField("tags"); + } else { + jsonWriter.writeArrayField("tags", this.tags, (writer, element) -> writer.writeJson(element)); + } + } + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + if (updatedProperties.contains("copilotInstruction")) { + if (this.copilotInstruction == null) { + jsonWriter.writeNullField("copilotInstruction"); + } else { + jsonWriter.writeStringField("copilotInstruction", this.copilotInstruction); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBase from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBase if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the KnowledgeBase. + */ + @Generated + public static KnowledgeBase fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KnowledgeBase deserializedKnowledgeBase = new KnowledgeBase(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedKnowledgeBase.name = reader.getString(); + } else if ("bookshelfName".equals(fieldName)) { + deserializedKnowledgeBase.bookshelfName = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedKnowledgeBase.id = reader.getString(); + } else if ("storageAssetReferences".equals(fieldName)) { + List storageAssetReferences + = reader.readArray(reader1 -> StorageAssetReference.fromJson(reader1)); + deserializedKnowledgeBase.storageAssetReferences = storageAssetReferences; + } else if ("knowledgeBaseUrl".equals(fieldName)) { + deserializedKnowledgeBase.knowledgeBaseUrl = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedKnowledgeBase.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("error".equals(fieldName)) { + deserializedKnowledgeBase.error = ResponseError.fromJson(reader); + } else if ("status".equals(fieldName)) { + deserializedKnowledgeBase.status = IndexingStatus.fromString(reader.getString()); + } else if ("createdByApiVersion".equals(fieldName)) { + deserializedKnowledgeBase.createdByApiVersion = reader.getString(); + } else if ("lastIndexingRun".equals(fieldName)) { + deserializedKnowledgeBase.lastIndexingRun = LastIndexingRun.fromJson(reader); + } else if ("createdAt".equals(fieldName)) { + deserializedKnowledgeBase.createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedKnowledgeBase.createdBy = reader.getString(); + } else if ("createdByType".equals(fieldName)) { + deserializedKnowledgeBase.createdByType = ByType.fromString(reader.getString()); + } else if ("lastModifiedAt".equals(fieldName)) { + deserializedKnowledgeBase.lastModifiedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedKnowledgeBase.lastModifiedBy = reader.getString(); + } else if ("lastModifiedByType".equals(fieldName)) { + deserializedKnowledgeBase.lastModifiedByType = ByType.fromString(reader.getString()); + } else if ("tags".equals(fieldName)) { + List tags = reader.readArray(reader1 -> Tag.fromJson(reader1)); + deserializedKnowledgeBase.tags = tags; + } else if ("description".equals(fieldName)) { + deserializedKnowledgeBase.description = reader.getString(); + } else if ("copilotInstruction".equals(fieldName)) { + deserializedKnowledgeBase.copilotInstruction = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKnowledgeBase; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBaseIndexingOperationResponse.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBaseIndexingOperationResponse.java new file mode 100644 index 000000000000..988b5b98595c --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBaseIndexingOperationResponse.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response for indexing operations. + */ +@Immutable +public final class KnowledgeBaseIndexingOperationResponse extends KnowledgeBaseOperationResponse { + /* + * The type of operation. + */ + @Generated + private KnowledgeBaseOperationType operationType = KnowledgeBaseOperationType.INDEXING; + + /* + * Result details for indexing operations. + */ + @Generated + private IndexingOperationResult indexingResult; + + /** + * Creates an instance of KnowledgeBaseIndexingOperationResponse class. + * + * @param id the id value to set. + * @param status the status value to set. + */ + @Generated + private KnowledgeBaseIndexingOperationResponse(String id, OperationState status) { + super(id, status); + } + + /** + * Get the operationType property: The type of operation. + * + * @return the operationType value. + */ + @Generated + @Override + public KnowledgeBaseOperationType getOperationType() { + return this.operationType; + } + + /** + * Get the indexingResult property: Result details for indexing operations. + * + * @return the indexingResult value. + */ + @Generated + public IndexingOperationResult getIndexingResult() { + return this.indexingResult; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeStringField("status", getStatus() == null ? null : getStatus().toString()); + jsonWriter.writeJsonField("error", getError()); + jsonWriter.writeStringField("operationType", this.operationType == null ? null : this.operationType.toString()); + jsonWriter.writeJsonField("indexingResult", this.indexingResult); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseIndexingOperationResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseIndexingOperationResponse if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the KnowledgeBaseIndexingOperationResponse. + */ + @Generated + public static KnowledgeBaseIndexingOperationResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + OperationState status = null; + ResponseError error = null; + KnowledgeBaseOperationType operationType = KnowledgeBaseOperationType.INDEXING; + IndexingOperationResult indexingResult = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("status".equals(fieldName)) { + status = OperationState.fromString(reader.getString()); + } else if ("error".equals(fieldName)) { + error = ResponseError.fromJson(reader); + } else if ("operationType".equals(fieldName)) { + operationType = KnowledgeBaseOperationType.fromString(reader.getString()); + } else if ("indexingResult".equals(fieldName)) { + indexingResult = IndexingOperationResult.fromJson(reader); + } else { + reader.skipChildren(); + } + } + KnowledgeBaseIndexingOperationResponse deserializedKnowledgeBaseIndexingOperationResponse + = new KnowledgeBaseIndexingOperationResponse(id, status); + deserializedKnowledgeBaseIndexingOperationResponse.setError(error); + deserializedKnowledgeBaseIndexingOperationResponse.operationType = operationType; + deserializedKnowledgeBaseIndexingOperationResponse.indexingResult = indexingResult; + + return deserializedKnowledgeBaseIndexingOperationResponse; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBaseOperationResponse.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBaseOperationResponse.java new file mode 100644 index 000000000000..e6f8d622dd6e --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBaseOperationResponse.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response indicating the KnowledgeBase operation. + */ +@Immutable +public class KnowledgeBaseOperationResponse implements JsonSerializable { + /* + * The type of operation. + */ + @Generated + private KnowledgeBaseOperationType operationType + = KnowledgeBaseOperationType.fromString("KnowledgeBaseOperationResponse"); + + /* + * The unique ID of the operation. + */ + @Generated + private final String id; + + /* + * The status of the operation. + */ + @Generated + private final OperationState status; + + /* + * Error object that describes the error when status is 'Failed'. + */ + @Generated + private ResponseError error; + + /** + * Creates an instance of KnowledgeBaseOperationResponse class. + * + * @param id the id value to set. + * @param status the status value to set. + */ + @Generated + protected KnowledgeBaseOperationResponse(String id, OperationState status) { + this.id = id; + this.status = status; + } + + /** + * Get the operationType property: The type of operation. + * + * @return the operationType value. + */ + @Generated + public KnowledgeBaseOperationType getOperationType() { + return this.operationType; + } + + /** + * Get the id property: The unique ID of the operation. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the status property: The status of the operation. + * + * @return the status value. + */ + @Generated + public OperationState getStatus() { + return this.status; + } + + /** + * Get the error property: Error object that describes the error when status is 'Failed'. + * + * @return the error value. + */ + @Generated + public ResponseError getError() { + return this.error; + } + + /** + * Set the error property: Error object that describes the error when status is 'Failed'. + * + * @param error the error value to set. + * @return the KnowledgeBaseOperationResponse object itself. + */ + @Generated + KnowledgeBaseOperationResponse setError(ResponseError error) { + this.error = error; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("operationType", this.operationType == null ? null : this.operationType.toString()); + jsonWriter.writeJsonField("error", this.error); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseOperationResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseOperationResponse if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the KnowledgeBaseOperationResponse. + */ + @Generated + public static KnowledgeBaseOperationResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("operationType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Indexing".equals(discriminatorValue)) { + return KnowledgeBaseIndexingOperationResponse.fromJson(readerToUse.reset()); + } else if ("Search".equals(discriminatorValue)) { + return KnowledgeBaseSearchOperationResponse.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + @Generated + static KnowledgeBaseOperationResponse fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + OperationState status = null; + KnowledgeBaseOperationType operationType = null; + ResponseError error = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("status".equals(fieldName)) { + status = OperationState.fromString(reader.getString()); + } else if ("operationType".equals(fieldName)) { + operationType = KnowledgeBaseOperationType.fromString(reader.getString()); + } else if ("error".equals(fieldName)) { + error = ResponseError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + KnowledgeBaseOperationResponse deserializedKnowledgeBaseOperationResponse + = new KnowledgeBaseOperationResponse(id, status); + deserializedKnowledgeBaseOperationResponse.operationType = operationType; + deserializedKnowledgeBaseOperationResponse.error = error; + + return deserializedKnowledgeBaseOperationResponse; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBaseOperationType.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBaseOperationType.java new file mode 100644 index 000000000000..ae84fe4f5d0f --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBaseOperationType.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status indicating the KnowledgeBase operation. + */ +public final class KnowledgeBaseOperationType extends ExpandableStringEnum { + /** + * An indexing operation. + */ + @Generated + public static final KnowledgeBaseOperationType INDEXING = fromString("Indexing"); + + /** + * A cancel indexing operation. + */ + @Generated + public static final KnowledgeBaseOperationType CANCEL_INDEXING = fromString("CancelIndexing"); + + /** + * A search operation. + */ + @Generated + public static final KnowledgeBaseOperationType SEARCH = fromString("Search"); + + /** + * A delete operation. + */ + @Generated + public static final KnowledgeBaseOperationType DELETE = fromString("Delete"); + + /** + * Creates a new instance of KnowledgeBaseOperationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public KnowledgeBaseOperationType() { + } + + /** + * Creates or finds a KnowledgeBaseOperationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnowledgeBaseOperationType. + */ + @Generated + public static KnowledgeBaseOperationType fromString(String name) { + return fromString(name, KnowledgeBaseOperationType.class); + } + + /** + * Gets known KnowledgeBaseOperationType values. + * + * @return known KnowledgeBaseOperationType values. + */ + @Generated + public static Collection values() { + return values(KnowledgeBaseOperationType.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBaseSearchOperationResponse.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBaseSearchOperationResponse.java new file mode 100644 index 000000000000..05d2d161aa60 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/KnowledgeBaseSearchOperationResponse.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response for search operations. + */ +@Immutable +public final class KnowledgeBaseSearchOperationResponse extends KnowledgeBaseOperationResponse { + /* + * The type of operation. + */ + @Generated + private KnowledgeBaseOperationType operationType = KnowledgeBaseOperationType.SEARCH; + + /* + * Result details for search operations. + */ + @Generated + private SearchResponse searchResult; + + /** + * Creates an instance of KnowledgeBaseSearchOperationResponse class. + * + * @param id the id value to set. + * @param status the status value to set. + */ + @Generated + private KnowledgeBaseSearchOperationResponse(String id, OperationState status) { + super(id, status); + } + + /** + * Get the operationType property: The type of operation. + * + * @return the operationType value. + */ + @Generated + @Override + public KnowledgeBaseOperationType getOperationType() { + return this.operationType; + } + + /** + * Get the searchResult property: Result details for search operations. + * + * @return the searchResult value. + */ + @Generated + public SearchResponse getSearchResult() { + return this.searchResult; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", getId()); + jsonWriter.writeStringField("status", getStatus() == null ? null : getStatus().toString()); + jsonWriter.writeJsonField("error", getError()); + jsonWriter.writeStringField("operationType", this.operationType == null ? null : this.operationType.toString()); + jsonWriter.writeJsonField("searchResult", this.searchResult); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KnowledgeBaseSearchOperationResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KnowledgeBaseSearchOperationResponse if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the KnowledgeBaseSearchOperationResponse. + */ + @Generated + public static KnowledgeBaseSearchOperationResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + OperationState status = null; + ResponseError error = null; + KnowledgeBaseOperationType operationType = KnowledgeBaseOperationType.SEARCH; + SearchResponse searchResult = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("status".equals(fieldName)) { + status = OperationState.fromString(reader.getString()); + } else if ("error".equals(fieldName)) { + error = ResponseError.fromJson(reader); + } else if ("operationType".equals(fieldName)) { + operationType = KnowledgeBaseOperationType.fromString(reader.getString()); + } else if ("searchResult".equals(fieldName)) { + searchResult = SearchResponse.fromJson(reader); + } else { + reader.skipChildren(); + } + } + KnowledgeBaseSearchOperationResponse deserializedKnowledgeBaseSearchOperationResponse + = new KnowledgeBaseSearchOperationResponse(id, status); + deserializedKnowledgeBaseSearchOperationResponse.setError(error); + deserializedKnowledgeBaseSearchOperationResponse.operationType = operationType; + deserializedKnowledgeBaseSearchOperationResponse.searchResult = searchResult; + + return deserializedKnowledgeBaseSearchOperationResponse; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/LastIndexingRun.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/LastIndexingRun.java new file mode 100644 index 000000000000..e0ae4644052a --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/LastIndexingRun.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The details of the last indexing run. + */ +@Immutable +public final class LastIndexingRun implements JsonSerializable { + /* + * The operation run identifier. + */ + @Generated + private String runId; + + /* + * The status of the indexing run. + */ + @Generated + private IndexingStatus status; + + /* + * Error object that describes the error when status is 'Failed'. + */ + @Generated + private ResponseError error; + + /* + * Indexing metrics for the run. + */ + @Generated + private IndexingMetrics indexingMetrics; + + /** + * Creates an instance of LastIndexingRun class. + */ + @Generated + private LastIndexingRun() { + } + + /** + * Get the runId property: The operation run identifier. + * + * @return the runId value. + */ + @Generated + public String getRunId() { + return this.runId; + } + + /** + * Get the status property: The status of the indexing run. + * + * @return the status value. + */ + @Generated + public IndexingStatus getStatus() { + return this.status; + } + + /** + * Get the error property: Error object that describes the error when status is 'Failed'. + * + * @return the error value. + */ + @Generated + public ResponseError getError() { + return this.error; + } + + /** + * Get the indexingMetrics property: Indexing metrics for the run. + * + * @return the indexingMetrics value. + */ + @Generated + public IndexingMetrics getIndexingMetrics() { + return this.indexingMetrics; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("runId", this.runId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("error", this.error); + jsonWriter.writeJsonField("indexingMetrics", this.indexingMetrics); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LastIndexingRun from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LastIndexingRun if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the LastIndexingRun. + */ + @Generated + public static LastIndexingRun fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LastIndexingRun deserializedLastIndexingRun = new LastIndexingRun(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("runId".equals(fieldName)) { + deserializedLastIndexingRun.runId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedLastIndexingRun.status = IndexingStatus.fromString(reader.getString()); + } else if ("error".equals(fieldName)) { + deserializedLastIndexingRun.error = ResponseError.fromJson(reader); + } else if ("indexingMetrics".equals(fieldName)) { + deserializedLastIndexingRun.indexingMetrics = IndexingMetrics.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLastIndexingRun; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/NodepoolUsage.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/NodepoolUsage.java new file mode 100644 index 000000000000..13a164596803 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/NodepoolUsage.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Overview of compute usage for a nodepool. + */ +@Immutable +public final class NodepoolUsage implements JsonSerializable { + /* + * CPUs in use (e.g. 1, or 500m for 500 milli-CPUs) + * across all nodes in the nodepool. + */ + @Generated + private final String reservedCPUs; + + /* + * CPUs which are free to use (e.g. 1, or 500m for 500 milli-CPUs) + * across all nodes in the nodepool. + */ + @Generated + private final String allocatableCPUs; + + /* + * Memory which is in use (e.g. 500Mi or 1Gi). + */ + @Generated + private final String reservedMemory; + + /* + * Memory which is free to use (e.g. 500Mi or 1Gi). + */ + @Generated + private final String allocatableMemory; + + /* + * GPUs which are in use. + */ + @Generated + private final String reservedGPUs; + + /* + * GPUs which are free to use. + */ + @Generated + private final String allocatableGPUs; + + /** + * Creates an instance of NodepoolUsage class. + * + * @param reservedCPUs the reservedCPUs value to set. + * @param allocatableCPUs the allocatableCPUs value to set. + * @param reservedMemory the reservedMemory value to set. + * @param allocatableMemory the allocatableMemory value to set. + * @param reservedGPUs the reservedGPUs value to set. + * @param allocatableGPUs the allocatableGPUs value to set. + */ + @Generated + private NodepoolUsage(String reservedCPUs, String allocatableCPUs, String reservedMemory, String allocatableMemory, + String reservedGPUs, String allocatableGPUs) { + this.reservedCPUs = reservedCPUs; + this.allocatableCPUs = allocatableCPUs; + this.reservedMemory = reservedMemory; + this.allocatableMemory = allocatableMemory; + this.reservedGPUs = reservedGPUs; + this.allocatableGPUs = allocatableGPUs; + } + + /** + * Get the reservedCPUs property: CPUs in use (e.g. 1, or 500m for 500 milli-CPUs) + * across all nodes in the nodepool. + * + * @return the reservedCPUs value. + */ + @Generated + public String getReservedCPUs() { + return this.reservedCPUs; + } + + /** + * Get the allocatableCPUs property: CPUs which are free to use (e.g. 1, or 500m for 500 milli-CPUs) + * across all nodes in the nodepool. + * + * @return the allocatableCPUs value. + */ + @Generated + public String getAllocatableCPUs() { + return this.allocatableCPUs; + } + + /** + * Get the reservedMemory property: Memory which is in use (e.g. 500Mi or 1Gi). + * + * @return the reservedMemory value. + */ + @Generated + public String getReservedMemory() { + return this.reservedMemory; + } + + /** + * Get the allocatableMemory property: Memory which is free to use (e.g. 500Mi or 1Gi). + * + * @return the allocatableMemory value. + */ + @Generated + public String getAllocatableMemory() { + return this.allocatableMemory; + } + + /** + * Get the reservedGPUs property: GPUs which are in use. + * + * @return the reservedGPUs value. + */ + @Generated + public String getReservedGPUs() { + return this.reservedGPUs; + } + + /** + * Get the allocatableGPUs property: GPUs which are free to use. + * + * @return the allocatableGPUs value. + */ + @Generated + public String getAllocatableGPUs() { + return this.allocatableGPUs; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("reservedCPUs", this.reservedCPUs); + jsonWriter.writeStringField("allocatableCPUs", this.allocatableCPUs); + jsonWriter.writeStringField("reservedMemory", this.reservedMemory); + jsonWriter.writeStringField("allocatableMemory", this.allocatableMemory); + jsonWriter.writeStringField("reservedGPUs", this.reservedGPUs); + jsonWriter.writeStringField("allocatableGPUs", this.allocatableGPUs); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NodepoolUsage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NodepoolUsage if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NodepoolUsage. + */ + @Generated + public static NodepoolUsage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String reservedCPUs = null; + String allocatableCPUs = null; + String reservedMemory = null; + String allocatableMemory = null; + String reservedGPUs = null; + String allocatableGPUs = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("reservedCPUs".equals(fieldName)) { + reservedCPUs = reader.getString(); + } else if ("allocatableCPUs".equals(fieldName)) { + allocatableCPUs = reader.getString(); + } else if ("reservedMemory".equals(fieldName)) { + reservedMemory = reader.getString(); + } else if ("allocatableMemory".equals(fieldName)) { + allocatableMemory = reader.getString(); + } else if ("reservedGPUs".equals(fieldName)) { + reservedGPUs = reader.getString(); + } else if ("allocatableGPUs".equals(fieldName)) { + allocatableGPUs = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new NodepoolUsage(reservedCPUs, allocatableCPUs, reservedMemory, allocatableMemory, reservedGPUs, + allocatableGPUs); + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Operation.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Operation.java new file mode 100644 index 000000000000..c6a833527da9 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Operation.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Summary information for an operation. + */ +@Immutable +public final class Operation implements JsonSerializable { + /* + * Operation id. + */ + @Generated + private final String id; + + /* + * The nodepool the operation targets. + */ + @Generated + private final String nodepoolId; + + /* + * Current status of the operation. + */ + @Generated + private final RunStatus status; + + /* + * Human-readable details about the run status. + */ + @Generated + private final String runtimeDetails; + + /* + * When the operation was submitted. + */ + @Generated + private final OffsetDateTime createdAt; + + /* + * When the operation completed. + */ + @Generated + private OffsetDateTime completedAt; + + /* + * The user who created the operation. + */ + @Generated + private String createdBy; + + /** + * Creates an instance of Operation class. + * + * @param id the id value to set. + * @param nodepoolId the nodepoolId value to set. + * @param status the status value to set. + * @param runtimeDetails the runtimeDetails value to set. + * @param createdAt the createdAt value to set. + */ + @Generated + private Operation(String id, String nodepoolId, RunStatus status, String runtimeDetails, OffsetDateTime createdAt) { + this.id = id; + this.nodepoolId = nodepoolId; + this.status = status; + this.runtimeDetails = runtimeDetails; + this.createdAt = createdAt; + } + + /** + * Get the id property: Operation id. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the nodepoolId property: The nodepool the operation targets. + * + * @return the nodepoolId value. + */ + @Generated + public String getNodepoolId() { + return this.nodepoolId; + } + + /** + * Get the status property: Current status of the operation. + * + * @return the status value. + */ + @Generated + public RunStatus getStatus() { + return this.status; + } + + /** + * Get the runtimeDetails property: Human-readable details about the run status. + * + * @return the runtimeDetails value. + */ + @Generated + public String getRuntimeDetails() { + return this.runtimeDetails; + } + + /** + * Get the createdAt property: When the operation was submitted. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Get the completedAt property: When the operation completed. + * + * @return the completedAt value. + */ + @Generated + public OffsetDateTime getCompletedAt() { + return this.completedAt; + } + + /** + * Get the createdBy property: The user who created the operation. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("nodepoolId", this.nodepoolId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("runtimeDetails", this.runtimeDetails); + jsonWriter.writeStringField("createdAt", + this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); + jsonWriter.writeStringField("completedAt", + this.completedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.completedAt)); + jsonWriter.writeStringField("createdBy", this.createdBy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Operation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Operation if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Operation. + */ + @Generated + public static Operation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + String nodepoolId = null; + RunStatus status = null; + String runtimeDetails = null; + OffsetDateTime createdAt = null; + OffsetDateTime completedAt = null; + String createdBy = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("nodepoolId".equals(fieldName)) { + nodepoolId = reader.getString(); + } else if ("status".equals(fieldName)) { + status = RunStatus.fromString(reader.getString()); + } else if ("runtimeDetails".equals(fieldName)) { + runtimeDetails = reader.getString(); + } else if ("createdAt".equals(fieldName)) { + createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("completedAt".equals(fieldName)) { + completedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + createdBy = reader.getString(); + } else { + reader.skipChildren(); + } + } + Operation deserializedOperation = new Operation(id, nodepoolId, status, runtimeDetails, createdAt); + deserializedOperation.completedAt = completedAt; + deserializedOperation.createdBy = createdBy; + + return deserializedOperation; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/OperationState.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/OperationState.java new file mode 100644 index 000000000000..aafb39b49d20 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/OperationState.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum describing allowed operation states. + */ +public final class OperationState extends ExpandableStringEnum { + /** + * The operation has not started. + */ + @Generated + public static final OperationState NOT_STARTED = fromString("NotStarted"); + + /** + * The operation is in progress. + */ + @Generated + public static final OperationState RUNNING = fromString("Running"); + + /** + * The operation has completed successfully. + */ + @Generated + public static final OperationState SUCCEEDED = fromString("Succeeded"); + + /** + * The operation has failed. + */ + @Generated + public static final OperationState FAILED = fromString("Failed"); + + /** + * The operation has been canceled by the user. + */ + @Generated + public static final OperationState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of OperationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public OperationState() { + } + + /** + * Creates or finds a OperationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationState. + */ + @Generated + public static OperationState fromString(String name) { + return fromString(name, OperationState.class); + } + + /** + * Gets known OperationState values. + * + * @return known OperationState values. + */ + @Generated + public static Collection values() { + return values(OperationState.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/OperationStatusRunResultError.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/OperationStatusRunResultError.java new file mode 100644 index 000000000000..8b5ed962d5bc --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/OperationStatusRunResultError.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Provides status details for long running operations. + */ +@Immutable +public final class OperationStatusRunResultError implements JsonSerializable { + /* + * The unique ID of the operation. + */ + @Generated + private final String id; + + /* + * The status of the operation + */ + @Generated + private final OperationState status; + + /* + * Error object that describes the error when status is "Failed". + */ + @Generated + private ResponseError error; + + /* + * The result of the operation. + */ + @Generated + private RunResult result; + + /** + * Creates an instance of OperationStatusRunResultError class. + * + * @param id the id value to set. + * @param status the status value to set. + */ + @Generated + private OperationStatusRunResultError(String id, OperationState status) { + this.id = id; + this.status = status; + } + + /** + * Get the id property: The unique ID of the operation. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the status property: The status of the operation. + * + * @return the status value. + */ + @Generated + public OperationState getStatus() { + return this.status; + } + + /** + * Get the error property: Error object that describes the error when status is "Failed". + * + * @return the error value. + */ + @Generated + public ResponseError getError() { + return this.error; + } + + /** + * Get the result property: The result of the operation. + * + * @return the result value. + */ + @Generated + public RunResult getResult() { + return this.result; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("error", this.error); + jsonWriter.writeJsonField("result", this.result); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationStatusRunResultError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationStatusRunResultError if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationStatusRunResultError. + */ + @Generated + public static OperationStatusRunResultError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String id = null; + OperationState status = null; + ResponseError error = null; + RunResult result = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + id = reader.getString(); + } else if ("status".equals(fieldName)) { + status = OperationState.fromString(reader.getString()); + } else if ("error".equals(fieldName)) { + error = ResponseError.fromJson(reader); + } else if ("result".equals(fieldName)) { + result = RunResult.fromJson(reader); + } else { + reader.skipChildren(); + } + } + OperationStatusRunResultError deserializedOperationStatusRunResultError + = new OperationStatusRunResultError(id, status); + deserializedOperationStatusRunResultError.error = error; + deserializedOperationStatusRunResultError.result = result; + + return deserializedOperationStatusRunResultError; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/OutputDataMount.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/OutputDataMount.java new file mode 100644 index 000000000000..14af5d8d7595 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/OutputDataMount.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Definition of a mount for collecting tool output data. + */ +@Fluent +public final class OutputDataMount implements JsonSerializable { + /* + * URI of location to persist output to. + */ + @Generated + private final String storageUri; + + /* + * Absolute path within the container from which to collect output data. + */ + @Generated + private final String mountPath; + + /* + * The protocol to use for mounting this storage. Overrides any value specified on the storage container. + */ + @Generated + private StorageMountProtocol mountProtocol; + + /** + * Creates an instance of OutputDataMount class. + * + * @param storageUri the storageUri value to set. + * @param mountPath the mountPath value to set. + */ + @Generated + public OutputDataMount(String storageUri, String mountPath) { + this.storageUri = storageUri; + this.mountPath = mountPath; + } + + /** + * Get the storageUri property: URI of location to persist output to. + * + * @return the storageUri value. + */ + @Generated + public String getStorageUri() { + return this.storageUri; + } + + /** + * Get the mountPath property: Absolute path within the container from which to collect output data. + * + * @return the mountPath value. + */ + @Generated + public String getMountPath() { + return this.mountPath; + } + + /** + * Get the mountProtocol property: The protocol to use for mounting this storage. Overrides any value specified on + * the storage container. + * + * @return the mountProtocol value. + */ + @Generated + public StorageMountProtocol getMountProtocol() { + return this.mountProtocol; + } + + /** + * Set the mountProtocol property: The protocol to use for mounting this storage. Overrides any value specified on + * the storage container. + * + * @param mountProtocol the mountProtocol value to set. + * @return the OutputDataMount object itself. + */ + @Generated + public OutputDataMount setMountProtocol(StorageMountProtocol mountProtocol) { + this.mountProtocol = mountProtocol; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("storageUri", this.storageUri); + jsonWriter.writeStringField("mountPath", this.mountPath); + jsonWriter.writeStringField("mountProtocol", this.mountProtocol == null ? null : this.mountProtocol.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OutputDataMount from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OutputDataMount if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OutputDataMount. + */ + @Generated + public static OutputDataMount fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String storageUri = null; + String mountPath = null; + StorageMountProtocol mountProtocol = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageUri".equals(fieldName)) { + storageUri = reader.getString(); + } else if ("mountPath".equals(fieldName)) { + mountPath = reader.getString(); + } else if ("mountProtocol".equals(fieldName)) { + mountProtocol = StorageMountProtocol.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + OutputDataMount deserializedOutputDataMount = new OutputDataMount(storageUri, mountPath); + deserializedOutputDataMount.mountProtocol = mountProtocol; + + return deserializedOutputDataMount; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/OutputDataUri.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/OutputDataUri.java new file mode 100644 index 000000000000..c24a7c3ce385 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/OutputDataUri.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Model for providing the URI of the output collected from a specific container path. + */ +@Immutable +public final class OutputDataUri implements JsonSerializable { + /* + * The URI of the output data. + */ + @Generated + private final String storageUri; + + /* + * The path within the container from which the output was collected. + */ + @Generated + private final String mountPath; + + /** + * Creates an instance of OutputDataUri class. + * + * @param storageUri the storageUri value to set. + * @param mountPath the mountPath value to set. + */ + @Generated + private OutputDataUri(String storageUri, String mountPath) { + this.storageUri = storageUri; + this.mountPath = mountPath; + } + + /** + * Get the storageUri property: The URI of the output data. + * + * @return the storageUri value. + */ + @Generated + public String getStorageUri() { + return this.storageUri; + } + + /** + * Get the mountPath property: The path within the container from which the output was collected. + * + * @return the mountPath value. + */ + @Generated + public String getMountPath() { + return this.mountPath; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("storageUri", this.storageUri); + jsonWriter.writeStringField("mountPath", this.mountPath); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OutputDataUri from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OutputDataUri if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OutputDataUri. + */ + @Generated + public static OutputDataUri fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String storageUri = null; + String mountPath = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageUri".equals(fieldName)) { + storageUri = reader.getString(); + } else if ("mountPath".equals(fieldName)) { + mountPath = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new OutputDataUri(storageUri, mountPath); + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/PagedConversation.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/PagedConversation.java new file mode 100644 index 000000000000..d9848e95b6d2 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/PagedConversation.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Paged collection of Conversation items. + */ +@Immutable +public final class PagedConversation implements JsonSerializable { + /* + * The Conversation items on this page + */ + @Generated + private final List value; + + /* + * The link to the next page of items + */ + @Generated + private String nextLink; + + /** + * Creates an instance of PagedConversation class. + * + * @param value the value value to set. + */ + @Generated + private PagedConversation(List value) { + this.value = value; + } + + /** + * Get the value property: The Conversation items on this page. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + @Generated + public String getNextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PagedConversation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PagedConversation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PagedConversation. + */ + @Generated + public static PagedConversation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + String nextLink = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.readArray(reader1 -> Conversation.fromJson(reader1)); + } else if ("nextLink".equals(fieldName)) { + nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + PagedConversation deserializedPagedConversation = new PagedConversation(value); + deserializedPagedConversation.nextLink = nextLink; + + return deserializedPagedConversation; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/PagedInvestigation.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/PagedInvestigation.java new file mode 100644 index 000000000000..e7daa7df435e --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/PagedInvestigation.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Paged collection of Investigation items. + */ +@Immutable +public final class PagedInvestigation implements JsonSerializable { + /* + * The Investigation items on this page + */ + @Generated + private final List value; + + /* + * The link to the next page of items + */ + @Generated + private String nextLink; + + /** + * Creates an instance of PagedInvestigation class. + * + * @param value the value value to set. + */ + @Generated + private PagedInvestigation(List value) { + this.value = value; + } + + /** + * Get the value property: The Investigation items on this page. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + @Generated + public String getNextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PagedInvestigation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PagedInvestigation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PagedInvestigation. + */ + @Generated + public static PagedInvestigation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + String nextLink = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.readArray(reader1 -> Investigation.fromJson(reader1)); + } else if ("nextLink".equals(fieldName)) { + nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + PagedInvestigation deserializedPagedInvestigation = new PagedInvestigation(value); + deserializedPagedInvestigation.nextLink = nextLink; + + return deserializedPagedInvestigation; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/PagedOperation.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/PagedOperation.java new file mode 100644 index 000000000000..aa4ff4ffd556 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/PagedOperation.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Paged collection of Operation items. + */ +@Immutable +public final class PagedOperation implements JsonSerializable { + /* + * The Operation items on this page + */ + @Generated + private final List value; + + /* + * The link to the next page of items + */ + @Generated + private String nextLink; + + /** + * Creates an instance of PagedOperation class. + * + * @param value the value value to set. + */ + @Generated + private PagedOperation(List value) { + this.value = value; + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + @Generated + public String getNextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PagedOperation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PagedOperation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PagedOperation. + */ + @Generated + public static PagedOperation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + String nextLink = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.readArray(reader1 -> Operation.fromJson(reader1)); + } else if ("nextLink".equals(fieldName)) { + nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + PagedOperation deserializedPagedOperation = new PagedOperation(value); + deserializedPagedOperation.nextLink = nextLink; + + return deserializedPagedOperation; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/PagedWorkingMemoryEntry.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/PagedWorkingMemoryEntry.java new file mode 100644 index 000000000000..032d55912130 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/PagedWorkingMemoryEntry.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Paged collection of WorkingMemoryEntry items. + */ +@Immutable +public final class PagedWorkingMemoryEntry implements JsonSerializable { + /* + * The WorkingMemoryEntry items on this page + */ + @Generated + private final List value; + + /* + * The link to the next page of items + */ + @Generated + private String nextLink; + + /** + * Creates an instance of PagedWorkingMemoryEntry class. + * + * @param value the value value to set. + */ + @Generated + private PagedWorkingMemoryEntry(List value) { + this.value = value; + } + + /** + * Get the value property: The WorkingMemoryEntry items on this page. + * + * @return the value value. + */ + @Generated + public List getValue() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + @Generated + public String getNextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PagedWorkingMemoryEntry from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PagedWorkingMemoryEntry if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PagedWorkingMemoryEntry. + */ + @Generated + public static PagedWorkingMemoryEntry fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List value = null; + String nextLink = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + value = reader.readArray(reader1 -> WorkingMemoryEntry.fromJson(reader1)); + } else if ("nextLink".equals(fieldName)) { + nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + PagedWorkingMemoryEntry deserializedPagedWorkingMemoryEntry = new PagedWorkingMemoryEntry(value); + deserializedPagedWorkingMemoryEntry.nextLink = nextLink; + + return deserializedPagedWorkingMemoryEntry; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/ProvisioningState.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/ProvisioningState.java new file mode 100644 index 000000000000..ada7d04937a3 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/ProvisioningState.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The resource provisioning state. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + @Generated + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + @Generated + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + @Generated + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * The resource create request has been accepted. + */ + @Generated + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * The resource is being provisioned. + */ + @Generated + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * The resource is updating. + */ + @Generated + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * The resource is being deleted. + */ + @Generated + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @Generated + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + @Generated + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunOptions.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunOptions.java new file mode 100644 index 000000000000..cd7ac1824772 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunOptions.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import java.util.List; + +/** + * Options for run API. + */ +@Fluent +public final class RunOptions { + /* + * Name of the associated Project. + */ + @Generated + private final String projectName; + + /* + * ID of the tool to execute + */ + @Generated + private final String toolId; + + /* + * Command to pass to tool container entrypoint. + * + * If the tool has multiple containers defined, this command is executed on all of them. + * + * If omitted, all containers execute their raw entrypoints. + * + * This command is parsed into an argument list which is passed to the underlying container runtime. + * For example, if the command is + * "python /code/wrapper.py --input /inputs/abcdef-input-1/input.txt --output /outputs/abcdef-output-1", + * then the container runtime will receive the following argument list: + * ["python", "/code/wrapper.py", "--input", "/inputs/abcdef-input-1/input.txt", "--output", + * "/outputs/abcdef-output-1"] + * + * The container's entrypoint is not overridden. In Docker terminology, the above argument list becomes + * the CMD, not the ENTRYPOINT of the launched container. + * + * Our parsing includes the following limited interpretation of special characters: + * - The only special characters are " ' and \. + * - Backslashes `\` escape the next character if that character is a special character, preserving its literal + * value. + * - Double quotes `"` preserve everything inside them literally, with the exception of the characters " and \, + * which must be escaped with a backslash `\`. Unmatched quotes will throw an error. + * - Single quotes `'` preserve everything inside them literally. A single-quote cannot occur within single-quotes. + * Unmatched quotes will throw an error. + * + * If you wish to run a command that relies on shell features such as globbing or output redirection, you either + * need to: + * - use a container with an entrypoint that is a shell (e.g. `/bin/sh` or `/bin/bash`) and pass a command which is + * valid for that shell e.g. + * `-c 'python /code/wrapper.py --input /inputs/abcdef-input-1/* --output /outputs/abcdef-output-1'` + * - use a container which has a shell installed, and include the shell in the command, e.g. + * `sh -c "python /code/wrapper.py --input /inputs/abcdef-input-1/* --output /outputs/abcdef-output-1"` + */ + @Generated + private String command; + + /* + * Encoded inline files to be mounted into the container, e.g. for generated code. + */ + @Generated + private List inlineFiles; + + /* + * Input data references and mount paths. + */ + @Generated + private List inputData; + + /* + * Output data references and mount paths. + */ + @Generated + private List outputData; + + /* + * IDs of NodePools to use for this run. + */ + @Generated + private final List nodePoolIds; + + /* + * Override the infrastructure requirements in the tool definitions. + */ + @Generated + private InfraOverrides infraOverrides; + + /* + * Optional environment variables to set in the tool container. This must not contain any secrets. + */ + @Generated + private List environmentVariables; + + /** + * Creates an instance of RunOptions class. + * + * @param projectName the projectName value to set. + * @param toolId the toolId value to set. + * @param nodePoolIds the nodePoolIds value to set. + */ + @Generated + public RunOptions(String projectName, String toolId, List nodePoolIds) { + this.projectName = projectName; + this.toolId = toolId; + this.nodePoolIds = nodePoolIds; + } + + /** + * Get the projectName property: Name of the associated Project. + * + * @return the projectName value. + */ + @Generated + public String getProjectName() { + return this.projectName; + } + + /** + * Get the toolId property: ID of the tool to execute. + * + * @return the toolId value. + */ + @Generated + public String getToolId() { + return this.toolId; + } + + /** + * Get the command property: Command to pass to tool container entrypoint. + * + * If the tool has multiple containers defined, this command is executed on all of them. + * + * If omitted, all containers execute their raw entrypoints. + * + * This command is parsed into an argument list which is passed to the underlying container runtime. + * For example, if the command is "python /code/wrapper.py --input /inputs/abcdef-input-1/input.txt --output + * /outputs/abcdef-output-1", + * then the container runtime will receive the following argument list: + * ["python", "/code/wrapper.py", "--input", "/inputs/abcdef-input-1/input.txt", "--output", + * "/outputs/abcdef-output-1"] + * + * The container's entrypoint is not overridden. In Docker terminology, the above argument list becomes + * the CMD, not the ENTRYPOINT of the launched container. + * + * Our parsing includes the following limited interpretation of special characters: + * - The only special characters are " ' and \. + * - Backslashes `\` escape the next character if that character is a special character, preserving its literal + * value. + * - Double quotes `"` preserve everything inside them literally, with the exception of the characters " and \, + * which must be escaped with a backslash `\`. Unmatched quotes will throw an error. + * - Single quotes `'` preserve everything inside them literally. A single-quote cannot occur within single-quotes. + * Unmatched quotes will throw an error. + * + * If you wish to run a command that relies on shell features such as globbing or output redirection, you either + * need to: + * - use a container with an entrypoint that is a shell (e.g. `/bin/sh` or `/bin/bash`) and pass a command which is + * valid for that shell e.g. + * `-c 'python /code/wrapper.py --input /inputs/abcdef-input-1/* --output /outputs/abcdef-output-1'` + * - use a container which has a shell installed, and include the shell in the command, e.g. + * `sh -c "python /code/wrapper.py --input /inputs/abcdef-input-1/* --output /outputs/abcdef-output-1"`. + * + * @return the command value. + */ + @Generated + public String getCommand() { + return this.command; + } + + /** + * Set the command property: Command to pass to tool container entrypoint. + * + * If the tool has multiple containers defined, this command is executed on all of them. + * + * If omitted, all containers execute their raw entrypoints. + * + * This command is parsed into an argument list which is passed to the underlying container runtime. + * For example, if the command is "python /code/wrapper.py --input /inputs/abcdef-input-1/input.txt --output + * /outputs/abcdef-output-1", + * then the container runtime will receive the following argument list: + * ["python", "/code/wrapper.py", "--input", "/inputs/abcdef-input-1/input.txt", "--output", + * "/outputs/abcdef-output-1"] + * + * The container's entrypoint is not overridden. In Docker terminology, the above argument list becomes + * the CMD, not the ENTRYPOINT of the launched container. + * + * Our parsing includes the following limited interpretation of special characters: + * - The only special characters are " ' and \. + * - Backslashes `\` escape the next character if that character is a special character, preserving its literal + * value. + * - Double quotes `"` preserve everything inside them literally, with the exception of the characters " and \, + * which must be escaped with a backslash `\`. Unmatched quotes will throw an error. + * - Single quotes `'` preserve everything inside them literally. A single-quote cannot occur within single-quotes. + * Unmatched quotes will throw an error. + * + * If you wish to run a command that relies on shell features such as globbing or output redirection, you either + * need to: + * - use a container with an entrypoint that is a shell (e.g. `/bin/sh` or `/bin/bash`) and pass a command which is + * valid for that shell e.g. + * `-c 'python /code/wrapper.py --input /inputs/abcdef-input-1/* --output /outputs/abcdef-output-1'` + * - use a container which has a shell installed, and include the shell in the command, e.g. + * `sh -c "python /code/wrapper.py --input /inputs/abcdef-input-1/* --output /outputs/abcdef-output-1"`. + * + * @param command the command value to set. + * @return the RunOptions object itself. + */ + @Generated + public RunOptions setCommand(String command) { + this.command = command; + return this; + } + + /** + * Get the inlineFiles property: Encoded inline files to be mounted into the container, e.g. for generated code. + * + * @return the inlineFiles value. + */ + @Generated + public List getInlineFiles() { + return this.inlineFiles; + } + + /** + * Set the inlineFiles property: Encoded inline files to be mounted into the container, e.g. for generated code. + * + * @param inlineFiles the inlineFiles value to set. + * @return the RunOptions object itself. + */ + @Generated + public RunOptions setInlineFiles(List inlineFiles) { + this.inlineFiles = inlineFiles; + return this; + } + + /** + * Get the inputData property: Input data references and mount paths. + * + * @return the inputData value. + */ + @Generated + public List getInputData() { + return this.inputData; + } + + /** + * Set the inputData property: Input data references and mount paths. + * + * @param inputData the inputData value to set. + * @return the RunOptions object itself. + */ + @Generated + public RunOptions setInputData(List inputData) { + this.inputData = inputData; + return this; + } + + /** + * Get the outputData property: Output data references and mount paths. + * + * @return the outputData value. + */ + @Generated + public List getOutputData() { + return this.outputData; + } + + /** + * Set the outputData property: Output data references and mount paths. + * + * @param outputData the outputData value to set. + * @return the RunOptions object itself. + */ + @Generated + public RunOptions setOutputData(List outputData) { + this.outputData = outputData; + return this; + } + + /** + * Get the nodePoolIds property: IDs of NodePools to use for this run. + * + * @return the nodePoolIds value. + */ + @Generated + public List getNodePoolIds() { + return this.nodePoolIds; + } + + /** + * Get the infraOverrides property: Override the infrastructure requirements in the tool definitions. + * + * @return the infraOverrides value. + */ + @Generated + public InfraOverrides getInfraOverrides() { + return this.infraOverrides; + } + + /** + * Set the infraOverrides property: Override the infrastructure requirements in the tool definitions. + * + * @param infraOverrides the infraOverrides value to set. + * @return the RunOptions object itself. + */ + @Generated + public RunOptions setInfraOverrides(InfraOverrides infraOverrides) { + this.infraOverrides = infraOverrides; + return this; + } + + /** + * Get the environmentVariables property: Optional environment variables to set in the tool container. This must not + * contain any secrets. + * + * @return the environmentVariables value. + */ + @Generated + public List getEnvironmentVariables() { + return this.environmentVariables; + } + + /** + * Set the environmentVariables property: Optional environment variables to set in the tool container. This must not + * contain any secrets. + * + * @param environmentVariables the environmentVariables value to set. + * @return the RunOptions object itself. + */ + @Generated + public RunOptions setEnvironmentVariables(List environmentVariables) { + this.environmentVariables = environmentVariables; + return this; + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunRequestEnvironmentVariable.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunRequestEnvironmentVariable.java new file mode 100644 index 000000000000..bbbf269500fa --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunRequestEnvironmentVariable.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The RunRequestEnvironmentVariable model. + */ +@Fluent +public final class RunRequestEnvironmentVariable implements JsonSerializable { + /* + * Name of the environment variable. This must not contain any secrets. + */ + @Generated + private final String name; + + /* + * Value of the environment variable. This must not contain any secrets. + */ + @Generated + private String value; + + /** + * Creates an instance of RunRequestEnvironmentVariable class. + * + * @param name the name value to set. + */ + @Generated + public RunRequestEnvironmentVariable(String name) { + this.name = name; + } + + /** + * Get the name property: Name of the environment variable. This must not contain any secrets. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the value property: Value of the environment variable. This must not contain any secrets. + * + * @return the value value. + */ + @Generated + public String getValue() { + return this.value; + } + + /** + * Set the value property: Value of the environment variable. This must not contain any secrets. + * + * @param value the value value to set. + * @return the RunRequestEnvironmentVariable object itself. + */ + @Generated + public RunRequestEnvironmentVariable setValue(String value) { + this.value = value; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunRequestEnvironmentVariable from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunRequestEnvironmentVariable if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunRequestEnvironmentVariable. + */ + @Generated + public static RunRequestEnvironmentVariable fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String name = null; + String value = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + name = reader.getString(); + } else if ("value".equals(fieldName)) { + value = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunRequestEnvironmentVariable deserializedRunRequestEnvironmentVariable + = new RunRequestEnvironmentVariable(name); + deserializedRunRequestEnvironmentVariable.value = value; + + return deserializedRunRequestEnvironmentVariable; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunResult.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunResult.java new file mode 100644 index 000000000000..92872b032d25 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunResult.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Run result. + */ +@Immutable +public final class RunResult implements JsonSerializable { + /* + * Status of the run. + */ + @Generated + private String status; + + /* + * Human-readable details about the run status. + */ + @Generated + private final String runtimeDetails; + + /* + * The timestamp when the resource was created + */ + @Generated + private OffsetDateTime createdAt; + + /* + * The time the run completed. + */ + @Generated + private OffsetDateTime completedAt; + + /* + * The user that started the tool run. + */ + @Generated + private String createdBy; + + /* + * Details provided by the tool (rather than the platform). + */ + @Generated + private RunResultToolReport toolReport; + + /* + * Output data URIs. + */ + @Generated + private final List outputData; + + /* + * Debugging information. + */ + @Generated + private final String debugInfo; + + /** + * Creates an instance of RunResult class. + * + * @param runtimeDetails the runtimeDetails value to set. + * @param outputData the outputData value to set. + * @param debugInfo the debugInfo value to set. + */ + @Generated + private RunResult(String runtimeDetails, List outputData, String debugInfo) { + this.runtimeDetails = runtimeDetails; + this.outputData = outputData; + this.debugInfo = debugInfo; + } + + /** + * Get the status property: Status of the run. + * + * @return the status value. + */ + @Generated + public String getStatus() { + return this.status; + } + + /** + * Get the runtimeDetails property: Human-readable details about the run status. + * + * @return the runtimeDetails value. + */ + @Generated + public String getRuntimeDetails() { + return this.runtimeDetails; + } + + /** + * Get the createdAt property: The timestamp when the resource was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Get the completedAt property: The time the run completed. + * + * @return the completedAt value. + */ + @Generated + public OffsetDateTime getCompletedAt() { + return this.completedAt; + } + + /** + * Get the createdBy property: The user that started the tool run. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the toolReport property: Details provided by the tool (rather than the platform). + * + * @return the toolReport value. + */ + @Generated + public RunResultToolReport getToolReport() { + return this.toolReport; + } + + /** + * Get the outputData property: Output data URIs. + * + * @return the outputData value. + */ + @Generated + public List getOutputData() { + return this.outputData; + } + + /** + * Get the debugInfo property: Debugging information. + * + * @return the debugInfo value. + */ + @Generated + public String getDebugInfo() { + return this.debugInfo; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("runtimeDetails", this.runtimeDetails); + jsonWriter.writeArrayField("outputData", this.outputData, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("debugInfo", this.debugInfo); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeStringField("createdBy", this.createdBy); + jsonWriter.writeJsonField("toolReport", this.toolReport); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunResult if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunResult. + */ + @Generated + public static RunResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String runtimeDetails = null; + List outputData = null; + String debugInfo = null; + String status = null; + OffsetDateTime createdAt = null; + OffsetDateTime completedAt = null; + String createdBy = null; + RunResultToolReport toolReport = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("runtimeDetails".equals(fieldName)) { + runtimeDetails = reader.getString(); + } else if ("outputData".equals(fieldName)) { + outputData = reader.readArray(reader1 -> OutputDataUri.fromJson(reader1)); + } else if ("debugInfo".equals(fieldName)) { + debugInfo = reader.getString(); + } else if ("status".equals(fieldName)) { + status = reader.getString(); + } else if ("createdAt".equals(fieldName)) { + createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("completedAt".equals(fieldName)) { + completedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + createdBy = reader.getString(); + } else if ("toolReport".equals(fieldName)) { + toolReport = RunResultToolReport.fromJson(reader); + } else { + reader.skipChildren(); + } + } + RunResult deserializedRunResult = new RunResult(runtimeDetails, outputData, debugInfo); + deserializedRunResult.status = status; + deserializedRunResult.createdAt = createdAt; + deserializedRunResult.completedAt = completedAt; + deserializedRunResult.createdBy = createdBy; + deserializedRunResult.toolReport = toolReport; + + return deserializedRunResult; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunResultToolReport.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunResultToolReport.java new file mode 100644 index 000000000000..057e30eaba41 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunResultToolReport.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The RunResultToolReport model. + */ +@Immutable +public final class RunResultToolReport implements JsonSerializable { + /* + * Percentage compete + */ + @Generated + private final int percentageComplete; + + /* + * The statusInformation property. + */ + @Generated + private RunResultToolReportStatusInformation statusInformation; + + /* + * Logs from the tool. + */ + @Generated + private String logs; + + /** + * Creates an instance of RunResultToolReport class. + * + * @param percentageComplete the percentageComplete value to set. + */ + @Generated + private RunResultToolReport(int percentageComplete) { + this.percentageComplete = percentageComplete; + } + + /** + * Get the percentageComplete property: Percentage compete. + * + * @return the percentageComplete value. + */ + @Generated + public int getPercentageComplete() { + return this.percentageComplete; + } + + /** + * Get the statusInformation property: The statusInformation property. + * + * @return the statusInformation value. + */ + @Generated + public RunResultToolReportStatusInformation getStatusInformation() { + return this.statusInformation; + } + + /** + * Get the logs property: Logs from the tool. + * + * @return the logs value. + */ + @Generated + public String getLogs() { + return this.logs; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("percentageComplete", this.percentageComplete); + jsonWriter.writeJsonField("statusInformation", this.statusInformation); + jsonWriter.writeStringField("logs", this.logs); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunResultToolReport from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunResultToolReport if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunResultToolReport. + */ + @Generated + public static RunResultToolReport fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + int percentageComplete = 0; + RunResultToolReportStatusInformation statusInformation = null; + String logs = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("percentageComplete".equals(fieldName)) { + percentageComplete = reader.getInt(); + } else if ("statusInformation".equals(fieldName)) { + statusInformation = RunResultToolReportStatusInformation.fromJson(reader); + } else if ("logs".equals(fieldName)) { + logs = reader.getString(); + } else { + reader.skipChildren(); + } + } + RunResultToolReport deserializedRunResultToolReport = new RunResultToolReport(percentageComplete); + deserializedRunResultToolReport.statusInformation = statusInformation; + deserializedRunResultToolReport.logs = logs; + + return deserializedRunResultToolReport; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunResultToolReportStatusInformation.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunResultToolReportStatusInformation.java new file mode 100644 index 000000000000..9c3ad9908686 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunResultToolReportStatusInformation.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The RunResultToolReportStatusInformation model. + */ +@Immutable +public final class RunResultToolReportStatusInformation + implements JsonSerializable { + /** + * Creates an instance of RunResultToolReportStatusInformation class. + */ + @Generated + private RunResultToolReportStatusInformation() { + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunResultToolReportStatusInformation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunResultToolReportStatusInformation if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RunResultToolReportStatusInformation. + */ + @Generated + public static RunResultToolReportStatusInformation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunResultToolReportStatusInformation deserializedRunResultToolReportStatusInformation + = new RunResultToolReportStatusInformation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + reader.skipChildren(); + } + + return deserializedRunResultToolReportStatusInformation; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunStatus.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunStatus.java new file mode 100644 index 000000000000..1169e965bae8 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/RunStatus.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum for run status. + */ +public final class RunStatus extends ExpandableStringEnum { + /** + * Not Started. + */ + @Generated + public static final RunStatus NOT_STARTED = fromString("NotStarted"); + + /** + * Running. + */ + @Generated + public static final RunStatus RUNNING = fromString("Running"); + + /** + * Succeeded. + */ + @Generated + public static final RunStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Canceled. + */ + @Generated + public static final RunStatus CANCELED = fromString("Canceled"); + + /** + * Failed. + */ + @Generated + public static final RunStatus FAILED = fromString("Failed"); + + /** + * Creates a new instance of RunStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public RunStatus() { + } + + /** + * Creates or finds a RunStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RunStatus. + */ + @Generated + public static RunStatus fromString(String name) { + return fromString(name, RunStatus.class); + } + + /** + * Gets known RunStatus values. + * + * @return known RunStatus values. + */ + @Generated + public static Collection values() { + return values(RunStatus.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/SearchRequest.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/SearchRequest.java new file mode 100644 index 000000000000..c9cd84b9dcf0 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/SearchRequest.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The search action request body. + */ +@Immutable +public final class SearchRequest implements JsonSerializable { + /* + * The query text to search against the knowledge base. + */ + @Generated + private final String query; + + /** + * Creates an instance of SearchRequest class. + * + * @param query the query value to set. + */ + @Generated + public SearchRequest(String query) { + this.query = query; + } + + /** + * Get the query property: The query text to search against the knowledge base. + * + * @return the query value. + */ + @Generated + public String getQuery() { + return this.query; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("query", this.query); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SearchRequest. + */ + @Generated + public static SearchRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String query = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("query".equals(fieldName)) { + query = reader.getString(); + } else { + reader.skipChildren(); + } + } + return new SearchRequest(query); + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/SearchResponse.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/SearchResponse.java new file mode 100644 index 000000000000..9c1da643e141 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/SearchResponse.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Results of a knowledge base search. + */ +@Immutable +public final class SearchResponse implements JsonSerializable { + /* + * The search results. + */ + @Generated + private final List searchResults; + + /** + * Creates an instance of SearchResponse class. + * + * @param searchResults the searchResults value to set. + */ + @Generated + private SearchResponse(List searchResults) { + this.searchResults = searchResults; + } + + /** + * Get the searchResults property: The search results. + * + * @return the searchResults value. + */ + @Generated + public List getSearchResults() { + return this.searchResults; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("searchResults", this.searchResults, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchResponse if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SearchResponse. + */ + @Generated + public static SearchResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + List searchResults = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("searchResults".equals(fieldName)) { + searchResults = reader.readArray(reader1 -> SearchResultItem.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new SearchResponse(searchResults); + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/SearchResultItem.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/SearchResultItem.java new file mode 100644 index 000000000000..2fa02bfb27f2 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/SearchResultItem.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A single search result item. + */ +@Immutable +public final class SearchResultItem implements JsonSerializable { + /* + * The generated response text for this result. + */ + @Generated + private final String text; + + /* + * Source citations for this result. + */ + @Generated + private List citations; + + /** + * Creates an instance of SearchResultItem class. + * + * @param text the text value to set. + */ + @Generated + private SearchResultItem(String text) { + this.text = text; + } + + /** + * Get the text property: The generated response text for this result. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the citations property: Source citations for this result. + * + * @return the citations value. + */ + @Generated + public List getCitations() { + return this.citations; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("text", this.text); + jsonWriter.writeArrayField("citations", this.citations, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SearchResultItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SearchResultItem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SearchResultItem. + */ + @Generated + public static SearchResultItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String text = null; + List citations = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("text".equals(fieldName)) { + text = reader.getString(); + } else if ("citations".equals(fieldName)) { + citations = reader.readArray(reader1 -> Citation.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + SearchResultItem deserializedSearchResultItem = new SearchResultItem(text); + deserializedSearchResultItem.citations = citations; + + return deserializedSearchResultItem; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/StartTaskRequest.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/StartTaskRequest.java new file mode 100644 index 000000000000..d5947992a624 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/StartTaskRequest.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request body for starting a task. + */ +@Fluent +public final class StartTaskRequest implements JsonSerializable { + /* + * Assignee that will execute the task. Optional. + */ + @Generated + private TaskAssignee assignee; + + /** + * Creates an instance of StartTaskRequest class. + */ + @Generated + public StartTaskRequest() { + } + + /** + * Get the assignee property: Assignee that will execute the task. Optional. + * + * @return the assignee value. + */ + @Generated + public TaskAssignee getAssignee() { + return this.assignee; + } + + /** + * Set the assignee property: Assignee that will execute the task. Optional. + * + * @param assignee the assignee value to set. + * @return the StartTaskRequest object itself. + */ + @Generated + public StartTaskRequest setAssignee(TaskAssignee assignee) { + this.assignee = assignee; + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("assignee", this.assignee); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StartTaskRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StartTaskRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the StartTaskRequest. + */ + @Generated + public static StartTaskRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StartTaskRequest deserializedStartTaskRequest = new StartTaskRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assignee".equals(fieldName)) { + deserializedStartTaskRequest.assignee = TaskAssignee.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStartTaskRequest; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/StorageAssetReference.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/StorageAssetReference.java new file mode 100644 index 000000000000..9fea9fd3f4f3 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/StorageAssetReference.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Reference to a storage asset with identity information. + */ +@Fluent +public final class StorageAssetReference implements JsonSerializable { + /* + * The ARM resource ID of the storage asset. + */ + @Generated + private String id; + + /* + * The ARM resource ID of the User Assigned Managed Identity to access the storage asset. + */ + @Generated + private String userAssignedIdentity; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setStorageAssetReferenceAccessor(new JsonMergePatchHelper.StorageAssetReferenceAccessor() { + @Override + public StorageAssetReference prepareModelForJsonMergePatch(StorageAssetReference model, + boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(StorageAssetReference model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of StorageAssetReference class. + */ + @Generated + public StorageAssetReference() { + } + + /** + * Get the id property: The ARM resource ID of the storage asset. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Set the id property: The ARM resource ID of the storage asset. + *

Required when create the resource.

+ * + * @param id the id value to set. + * @return the StorageAssetReference object itself. + */ + @Generated + public StorageAssetReference setId(String id) { + this.id = id; + this.updatedProperties.add("id"); + return this; + } + + /** + * Get the userAssignedIdentity property: The ARM resource ID of the User Assigned Managed Identity to access the + * storage asset. + * + * @return the userAssignedIdentity value. + */ + @Generated + public String getUserAssignedIdentity() { + return this.userAssignedIdentity; + } + + /** + * Set the userAssignedIdentity property: The ARM resource ID of the User Assigned Managed Identity to access the + * storage asset. + * + * @param userAssignedIdentity the userAssignedIdentity value to set. + * @return the StorageAssetReference object itself. + */ + @Generated + public StorageAssetReference setUserAssignedIdentity(String userAssignedIdentity) { + this.userAssignedIdentity = userAssignedIdentity; + this.updatedProperties.add("userAssignedIdentity"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("userAssignedIdentity", this.userAssignedIdentity); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("id")) { + if (this.id == null) { + jsonWriter.writeNullField("id"); + } else { + jsonWriter.writeStringField("id", this.id); + } + } + if (updatedProperties.contains("userAssignedIdentity")) { + if (this.userAssignedIdentity == null) { + jsonWriter.writeNullField("userAssignedIdentity"); + } else { + jsonWriter.writeStringField("userAssignedIdentity", this.userAssignedIdentity); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageAssetReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageAssetReference if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the StorageAssetReference. + */ + @Generated + public static StorageAssetReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageAssetReference deserializedStorageAssetReference = new StorageAssetReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedStorageAssetReference.id = reader.getString(); + } else if ("userAssignedIdentity".equals(fieldName)) { + deserializedStorageAssetReference.userAssignedIdentity = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageAssetReference; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/StorageMountProtocol.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/StorageMountProtocol.java new file mode 100644 index 000000000000..9aaedadac0a4 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/StorageMountProtocol.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The protocol to use for mounting an storage container. + */ +public final class StorageMountProtocol extends ExpandableStringEnum { + /** + * NFS protocol. Version of NFS used may vary based on storage type. + */ + @Generated + public static final StorageMountProtocol NFS = fromString("NFS"); + + /** + * Blobfuse in file cache mode. + */ + @Generated + public static final StorageMountProtocol BLOBFUSE_CACHING = fromString("BlobfuseCaching"); + + /** + * Creates a new instance of StorageMountProtocol value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public StorageMountProtocol() { + } + + /** + * Creates or finds a StorageMountProtocol from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageMountProtocol. + */ + @Generated + public static StorageMountProtocol fromString(String name) { + return fromString(name, StorageMountProtocol.class); + } + + /** + * Gets known StorageMountProtocol values. + * + * @return known StorageMountProtocol values. + */ + @Generated + public static Collection values() { + return values(StorageMountProtocol.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/SupercomputerUsage.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/SupercomputerUsage.java new file mode 100644 index 000000000000..c7df3ac83b31 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/SupercomputerUsage.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Overview of compute usage for a supercomputer. + */ +@Immutable +public final class SupercomputerUsage implements JsonSerializable { + /* + * Number of active jobs on the supercomputer. + */ + @Generated + private final long activeJobs; + + /* + * Number of pending jobs on the supercomputer. + */ + @Generated + private final long pendingJobs; + + /* + * Nodepool utilization for each nodepool for a supercomputer. + */ + @Generated + private final Map nodepools; + + /** + * Creates an instance of SupercomputerUsage class. + * + * @param activeJobs the activeJobs value to set. + * @param pendingJobs the pendingJobs value to set. + * @param nodepools the nodepools value to set. + */ + @Generated + private SupercomputerUsage(long activeJobs, long pendingJobs, Map nodepools) { + this.activeJobs = activeJobs; + this.pendingJobs = pendingJobs; + this.nodepools = nodepools; + } + + /** + * Get the activeJobs property: Number of active jobs on the supercomputer. + * + * @return the activeJobs value. + */ + @Generated + public long getActiveJobs() { + return this.activeJobs; + } + + /** + * Get the pendingJobs property: Number of pending jobs on the supercomputer. + * + * @return the pendingJobs value. + */ + @Generated + public long getPendingJobs() { + return this.pendingJobs; + } + + /** + * Get the nodepools property: Nodepool utilization for each nodepool for a supercomputer. + * + * @return the nodepools value. + */ + @Generated + public Map getNodepools() { + return this.nodepools; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeLongField("activeJobs", this.activeJobs); + jsonWriter.writeLongField("pendingJobs", this.pendingJobs); + jsonWriter.writeMapField("nodepools", this.nodepools, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SupercomputerUsage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SupercomputerUsage if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SupercomputerUsage. + */ + @Generated + public static SupercomputerUsage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + long activeJobs = 0L; + long pendingJobs = 0L; + Map nodepools = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("activeJobs".equals(fieldName)) { + activeJobs = reader.getLong(); + } else if ("pendingJobs".equals(fieldName)) { + pendingJobs = reader.getLong(); + } else if ("nodepools".equals(fieldName)) { + nodepools = reader.readMap(reader1 -> NodepoolUsage.fromJson(reader1)); + } else { + reader.skipChildren(); + } + } + return new SupercomputerUsage(activeJobs, pendingJobs, nodepools); + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Tag.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Tag.java new file mode 100644 index 000000000000..7dd2eaab3e24 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Tag.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Definition of Tag. + */ +@Fluent +public final class Tag implements JsonSerializable { + /* + * Property key + */ + @Generated + private String key; + + /* + * Property value + */ + @Generated + private String value; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTagAccessor(new JsonMergePatchHelper.TagAccessor() { + @Override + public Tag prepareModelForJsonMergePatch(Tag model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(Tag model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of Tag class. + */ + @Generated + public Tag() { + } + + /** + * Get the key property: Property key. + * + * @return the key value. + */ + @Generated + public String getKey() { + return this.key; + } + + /** + * Set the key property: Property key. + * + * @param key the key value to set. + * @return the Tag object itself. + */ + @Generated + public Tag setKey(String key) { + this.key = key; + this.updatedProperties.add("key"); + return this; + } + + /** + * Get the value property: Property value. + * + * @return the value value. + */ + @Generated + public String getValue() { + return this.value; + } + + /** + * Set the value property: Property value. + * + * @param value the value value to set. + * @return the Tag object itself. + */ + @Generated + public Tag setValue(String value) { + this.value = value; + this.updatedProperties.add("value"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("key", this.key); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("key")) { + if (this.key == null) { + jsonWriter.writeNullField("key"); + } else { + jsonWriter.writeStringField("key", this.key); + } + } + if (updatedProperties.contains("value")) { + if (this.value == null) { + jsonWriter.writeNullField("value"); + } else { + jsonWriter.writeStringField("value", this.value); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Tag from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Tag if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Tag. + */ + @Generated + public static Tag fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Tag deserializedTag = new Tag(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("key".equals(fieldName)) { + deserializedTag.key = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedTag.value = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTag; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Task.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Task.java new file mode 100644 index 000000000000..b5332f90fa98 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/Task.java @@ -0,0 +1,801 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Task resource. + */ +@Fluent +public final class Task implements JsonSerializable { + /* + * The unique identifier of the task. + */ + @Generated + private String name; + + /* + * The title of the task. + */ + @Generated + private String title; + + /* + * The priority of the task. + */ + @Generated + private TaskPriority priority; + + /* + * The description of the task. + */ + @Generated + private String description; + + /* + * Array of validation requirements for the task. + */ + @Generated + private List validationRequirements; + + /* + * ID of the parent task if this is a subtask. + */ + @Generated + private String parentId; + + /* + * IDs of tasks that must complete before this task can be executed. + */ + @Generated + private List dependsOn; + + /* + * IDs of tasks that are related to this task. + */ + @Generated + private List relatedTo; + + /* + * Application or user assigned to this task. + */ + @Generated + private TaskAssignee assignedTo; + + /* + * Comments or notes about the task. + */ + @Generated + private List comments; + + /* + * The current status of the task. + */ + @Generated + private TaskStatus status; + + /* + * The timestamp when the resource was created + */ + @Generated + private OffsetDateTime createdAt; + + /* + * The ID of the user who created this resource. + */ + @Generated + private String createdBy; + + /* + * Type of entity that created the resource (User, Application, System, or custom type). + */ + @Generated + private ByType createdByType; + + /* + * The timestamp when the resource was last updated + */ + @Generated + private OffsetDateTime lastModifiedAt; + + /* + * The ID of the user who updated this resource. + */ + @Generated + private String lastModifiedBy; + + /* + * The type of user who updated this resource. + */ + @Generated + private ByType lastModifiedByType; + + /* + * History of execution events for this task. + */ + @Generated + private List executionHistory; + + /* + * The investigation identifier associated with the task. + */ + @Generated + private String investigationId; + + /* + * Task execution result with text and storage assets. + */ + @Generated + private TaskResult taskResult; + + /* + * List of storage assets related to the task. + */ + @Generated + private List storageAssetIds; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTaskAccessor(new JsonMergePatchHelper.TaskAccessor() { + @Override + public Task prepareModelForJsonMergePatch(Task model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(Task model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of Task class. + */ + @Generated + public Task() { + } + + /** + * Get the name property: The unique identifier of the task. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the title property: The title of the task. + * + * @return the title value. + */ + @Generated + public String getTitle() { + return this.title; + } + + /** + * Set the title property: The title of the task. + * + * @param title the title value to set. + * @return the Task object itself. + */ + @Generated + public Task setTitle(String title) { + this.title = title; + this.updatedProperties.add("title"); + return this; + } + + /** + * Get the priority property: The priority of the task. + * + * @return the priority value. + */ + @Generated + public TaskPriority getPriority() { + return this.priority; + } + + /** + * Set the priority property: The priority of the task. + * + * @param priority the priority value to set. + * @return the Task object itself. + */ + @Generated + public Task setPriority(TaskPriority priority) { + this.priority = priority; + this.updatedProperties.add("priority"); + return this; + } + + /** + * Get the description property: The description of the task. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description of the task. + * + * @param description the description value to set. + * @return the Task object itself. + */ + @Generated + public Task setDescription(String description) { + this.description = description; + this.updatedProperties.add("description"); + return this; + } + + /** + * Get the validationRequirements property: Array of validation requirements for the task. + * + * @return the validationRequirements value. + */ + @Generated + public List getValidationRequirements() { + return this.validationRequirements; + } + + /** + * Set the validationRequirements property: Array of validation requirements for the task. + * + * @param validationRequirements the validationRequirements value to set. + * @return the Task object itself. + */ + @Generated + public Task setValidationRequirements(List validationRequirements) { + this.validationRequirements = validationRequirements; + this.updatedProperties.add("validationRequirements"); + return this; + } + + /** + * Get the parentId property: ID of the parent task if this is a subtask. + * + * @return the parentId value. + */ + @Generated + public String getParentId() { + return this.parentId; + } + + /** + * Set the parentId property: ID of the parent task if this is a subtask. + * + * @param parentId the parentId value to set. + * @return the Task object itself. + */ + @Generated + public Task setParentId(String parentId) { + this.parentId = parentId; + this.updatedProperties.add("parentId"); + return this; + } + + /** + * Get the dependsOn property: IDs of tasks that must complete before this task can be executed. + * + * @return the dependsOn value. + */ + @Generated + public List getDependsOn() { + return this.dependsOn; + } + + /** + * Set the dependsOn property: IDs of tasks that must complete before this task can be executed. + * + * @param dependsOn the dependsOn value to set. + * @return the Task object itself. + */ + @Generated + public Task setDependsOn(List dependsOn) { + this.dependsOn = dependsOn; + this.updatedProperties.add("dependsOn"); + return this; + } + + /** + * Get the relatedTo property: IDs of tasks that are related to this task. + * + * @return the relatedTo value. + */ + @Generated + public List getRelatedTo() { + return this.relatedTo; + } + + /** + * Set the relatedTo property: IDs of tasks that are related to this task. + * + * @param relatedTo the relatedTo value to set. + * @return the Task object itself. + */ + @Generated + public Task setRelatedTo(List relatedTo) { + this.relatedTo = relatedTo; + this.updatedProperties.add("relatedTo"); + return this; + } + + /** + * Get the assignedTo property: Application or user assigned to this task. + * + * @return the assignedTo value. + */ + @Generated + public TaskAssignee getAssignedTo() { + return this.assignedTo; + } + + /** + * Set the assignedTo property: Application or user assigned to this task. + * + * @param assignedTo the assignedTo value to set. + * @return the Task object itself. + */ + @Generated + public Task setAssignedTo(TaskAssignee assignedTo) { + this.assignedTo = assignedTo; + this.updatedProperties.add("assignedTo"); + return this; + } + + /** + * Get the comments property: Comments or notes about the task. + * + * @return the comments value. + */ + @Generated + public List getComments() { + return this.comments; + } + + /** + * Set the comments property: Comments or notes about the task. + * + * @param comments the comments value to set. + * @return the Task object itself. + */ + @Generated + public Task setComments(List comments) { + this.comments = comments; + this.updatedProperties.add("comments"); + return this; + } + + /** + * Get the status property: The current status of the task. + * + * @return the status value. + */ + @Generated + public TaskStatus getStatus() { + return this.status; + } + + /** + * Set the status property: The current status of the task. + * + * @param status the status value to set. + * @return the Task object itself. + */ + @Generated + public Task setStatus(TaskStatus status) { + this.status = status; + this.updatedProperties.add("status"); + return this; + } + + /** + * Get the createdAt property: The timestamp when the resource was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Get the createdBy property: The ID of the user who created this resource. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Get the createdByType property: Type of entity that created the resource (User, Application, System, or custom + * type). + * + * @return the createdByType value. + */ + @Generated + public ByType getCreatedByType() { + return this.createdByType; + } + + /** + * Set the createdByType property: Type of entity that created the resource (User, Application, System, or custom + * type). + * + * @param createdByType the createdByType value to set. + * @return the Task object itself. + */ + @Generated + public Task setCreatedByType(ByType createdByType) { + this.createdByType = createdByType; + this.updatedProperties.add("createdByType"); + return this; + } + + /** + * Get the lastModifiedAt property: The timestamp when the resource was last updated. + * + * @return the lastModifiedAt value. + */ + @Generated + public OffsetDateTime getLastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Get the lastModifiedBy property: The ID of the user who updated this resource. + * + * @return the lastModifiedBy value. + */ + @Generated + public String getLastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Get the lastModifiedByType property: The type of user who updated this resource. + * + * @return the lastModifiedByType value. + */ + @Generated + public ByType getLastModifiedByType() { + return this.lastModifiedByType; + } + + /** + * Get the executionHistory property: History of execution events for this task. + * + * @return the executionHistory value. + */ + @Generated + public List getExecutionHistory() { + return this.executionHistory; + } + + /** + * Get the investigationId property: The investigation identifier associated with the task. + * + * @return the investigationId value. + */ + @Generated + public String getInvestigationId() { + return this.investigationId; + } + + /** + * Set the investigationId property: The investigation identifier associated with the task. + * + * @param investigationId the investigationId value to set. + * @return the Task object itself. + */ + @Generated + public Task setInvestigationId(String investigationId) { + this.investigationId = investigationId; + this.updatedProperties.add("investigationId"); + return this; + } + + /** + * Get the taskResult property: Task execution result with text and storage assets. + * + * @return the taskResult value. + */ + @Generated + public TaskResult getTaskResult() { + return this.taskResult; + } + + /** + * Set the taskResult property: Task execution result with text and storage assets. + * + * @param taskResult the taskResult value to set. + * @return the Task object itself. + */ + @Generated + public Task setTaskResult(TaskResult taskResult) { + this.taskResult = taskResult; + this.updatedProperties.add("taskResult"); + return this; + } + + /** + * Get the storageAssetIds property: List of storage assets related to the task. + * + * @return the storageAssetIds value. + */ + @Generated + public List getStorageAssetIds() { + return this.storageAssetIds; + } + + /** + * Set the storageAssetIds property: List of storage assets related to the task. + * + * @param storageAssetIds the storageAssetIds value to set. + * @return the Task object itself. + */ + @Generated + public Task setStorageAssetIds(List storageAssetIds) { + this.storageAssetIds = storageAssetIds; + this.updatedProperties.add("storageAssetIds"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("priority", this.priority == null ? null : this.priority.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeArrayField("validationRequirements", this.validationRequirements, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("parentId", this.parentId); + jsonWriter.writeArrayField("dependsOn", this.dependsOn, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("relatedTo", this.relatedTo, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("assignedTo", this.assignedTo); + jsonWriter.writeArrayField("comments", this.comments, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("createdByType", + this.createdByType == null ? null : this.createdByType.toString()); + jsonWriter.writeStringField("investigationId", this.investigationId); + jsonWriter.writeJsonField("taskResult", this.taskResult); + jsonWriter.writeArrayField("storageAssetIds", this.storageAssetIds, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("title")) { + if (this.title == null) { + jsonWriter.writeNullField("title"); + } else { + jsonWriter.writeStringField("title", this.title); + } + } + if (updatedProperties.contains("priority")) { + if (this.priority == null) { + jsonWriter.writeNullField("priority"); + } else { + jsonWriter.writeStringField("priority", this.priority.toString()); + } + } + if (updatedProperties.contains("description")) { + if (this.description == null) { + jsonWriter.writeNullField("description"); + } else { + jsonWriter.writeStringField("description", this.description); + } + } + if (updatedProperties.contains("validationRequirements")) { + if (this.validationRequirements == null) { + jsonWriter.writeNullField("validationRequirements"); + } else { + jsonWriter.writeArrayField("validationRequirements", this.validationRequirements, + (writer, element) -> writer.writeString(element)); + } + } + if (updatedProperties.contains("parentId")) { + if (this.parentId == null) { + jsonWriter.writeNullField("parentId"); + } else { + jsonWriter.writeStringField("parentId", this.parentId); + } + } + if (updatedProperties.contains("dependsOn")) { + if (this.dependsOn == null) { + jsonWriter.writeNullField("dependsOn"); + } else { + jsonWriter.writeArrayField("dependsOn", this.dependsOn, + (writer, element) -> writer.writeString(element)); + } + } + if (updatedProperties.contains("relatedTo")) { + if (this.relatedTo == null) { + jsonWriter.writeNullField("relatedTo"); + } else { + jsonWriter.writeArrayField("relatedTo", this.relatedTo, + (writer, element) -> writer.writeString(element)); + } + } + if (updatedProperties.contains("assignedTo")) { + if (this.assignedTo == null) { + jsonWriter.writeNullField("assignedTo"); + } else { + JsonMergePatchHelper.getTaskAssigneeAccessor().prepareModelForJsonMergePatch(this.assignedTo, true); + jsonWriter.writeJsonField("assignedTo", this.assignedTo); + JsonMergePatchHelper.getTaskAssigneeAccessor().prepareModelForJsonMergePatch(this.assignedTo, false); + } + } + if (updatedProperties.contains("comments")) { + if (this.comments == null) { + jsonWriter.writeNullField("comments"); + } else { + jsonWriter.writeArrayField("comments", this.comments, (writer, element) -> writer.writeJson(element)); + } + } + if (updatedProperties.contains("status")) { + if (this.status == null) { + jsonWriter.writeNullField("status"); + } else { + jsonWriter.writeStringField("status", this.status.toString()); + } + } + if (updatedProperties.contains("createdByType")) { + if (this.createdByType == null) { + jsonWriter.writeNullField("createdByType"); + } else { + jsonWriter.writeStringField("createdByType", this.createdByType.toString()); + } + } + if (updatedProperties.contains("investigationId")) { + if (this.investigationId == null) { + jsonWriter.writeNullField("investigationId"); + } else { + jsonWriter.writeStringField("investigationId", this.investigationId); + } + } + if (updatedProperties.contains("taskResult")) { + if (this.taskResult == null) { + jsonWriter.writeNullField("taskResult"); + } else { + JsonMergePatchHelper.getTaskResultAccessor().prepareModelForJsonMergePatch(this.taskResult, true); + jsonWriter.writeJsonField("taskResult", this.taskResult); + JsonMergePatchHelper.getTaskResultAccessor().prepareModelForJsonMergePatch(this.taskResult, false); + } + } + if (updatedProperties.contains("storageAssetIds")) { + if (this.storageAssetIds == null) { + jsonWriter.writeNullField("storageAssetIds"); + } else { + jsonWriter.writeArrayField("storageAssetIds", this.storageAssetIds, + (writer, element) -> writer.writeString(element)); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Task from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Task if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Task. + */ + @Generated + public static Task fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Task deserializedTask = new Task(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedTask.name = reader.getString(); + } else if ("title".equals(fieldName)) { + deserializedTask.title = reader.getString(); + } else if ("priority".equals(fieldName)) { + deserializedTask.priority = TaskPriority.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedTask.description = reader.getString(); + } else if ("validationRequirements".equals(fieldName)) { + List validationRequirements = reader.readArray(reader1 -> reader1.getString()); + deserializedTask.validationRequirements = validationRequirements; + } else if ("parentId".equals(fieldName)) { + deserializedTask.parentId = reader.getString(); + } else if ("dependsOn".equals(fieldName)) { + List dependsOn = reader.readArray(reader1 -> reader1.getString()); + deserializedTask.dependsOn = dependsOn; + } else if ("relatedTo".equals(fieldName)) { + List relatedTo = reader.readArray(reader1 -> reader1.getString()); + deserializedTask.relatedTo = relatedTo; + } else if ("assignedTo".equals(fieldName)) { + deserializedTask.assignedTo = TaskAssignee.fromJson(reader); + } else if ("comments".equals(fieldName)) { + List comments = reader.readArray(reader1 -> TaskComment.fromJson(reader1)); + deserializedTask.comments = comments; + } else if ("status".equals(fieldName)) { + deserializedTask.status = TaskStatus.fromString(reader.getString()); + } else if ("createdAt".equals(fieldName)) { + deserializedTask.createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedTask.createdBy = reader.getString(); + } else if ("createdByType".equals(fieldName)) { + deserializedTask.createdByType = ByType.fromString(reader.getString()); + } else if ("lastModifiedAt".equals(fieldName)) { + deserializedTask.lastModifiedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedBy".equals(fieldName)) { + deserializedTask.lastModifiedBy = reader.getString(); + } else if ("lastModifiedByType".equals(fieldName)) { + deserializedTask.lastModifiedByType = ByType.fromString(reader.getString()); + } else if ("executionHistory".equals(fieldName)) { + List executionHistory + = reader.readArray(reader1 -> ExecutionHistoryEntry.fromJson(reader1)); + deserializedTask.executionHistory = executionHistory; + } else if ("investigationId".equals(fieldName)) { + deserializedTask.investigationId = reader.getString(); + } else if ("taskResult".equals(fieldName)) { + deserializedTask.taskResult = TaskResult.fromJson(reader); + } else if ("storageAssetIds".equals(fieldName)) { + List storageAssetIds = reader.readArray(reader1 -> reader1.getString()); + deserializedTask.storageAssetIds = storageAssetIds; + } else { + reader.skipChildren(); + } + } + + return deserializedTask; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskAssignee.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskAssignee.java new file mode 100644 index 000000000000..029567837027 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskAssignee.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +/** + * Task assignee information. + */ +@Fluent +public final class TaskAssignee implements JsonSerializable { + /* + * The unique identifier of the assignee. + */ + @Generated + private String id; + + /* + * Type of assignee (User, Application, System, or custom type). + */ + @Generated + private ByType type; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTaskAssigneeAccessor(new JsonMergePatchHelper.TaskAssigneeAccessor() { + @Override + public TaskAssignee prepareModelForJsonMergePatch(TaskAssignee model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TaskAssignee model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TaskAssignee class. + */ + @Generated + public TaskAssignee() { + } + + /** + * Get the id property: The unique identifier of the assignee. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Set the id property: The unique identifier of the assignee. + *

Required when create the resource.

+ * + * @param id the id value to set. + * @return the TaskAssignee object itself. + */ + @Generated + public TaskAssignee setId(String id) { + this.id = id; + this.updatedProperties.add("id"); + return this; + } + + /** + * Get the type property: Type of assignee (User, Application, System, or custom type). + * + * @return the type value. + */ + @Generated + public ByType getType() { + return this.type; + } + + /** + * Set the type property: Type of assignee (User, Application, System, or custom type). + *

Required when create the resource.

+ * + * @param type the type value to set. + * @return the TaskAssignee object itself. + */ + @Generated + public TaskAssignee setType(ByType type) { + this.type = type; + this.updatedProperties.add("type"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("id")) { + if (this.id == null) { + jsonWriter.writeNullField("id"); + } else { + jsonWriter.writeStringField("id", this.id); + } + } + if (updatedProperties.contains("type")) { + if (this.type == null) { + jsonWriter.writeNullField("type"); + } else { + jsonWriter.writeStringField("type", this.type.toString()); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskAssignee from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskAssignee if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TaskAssignee. + */ + @Generated + public static TaskAssignee fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskAssignee deserializedTaskAssignee = new TaskAssignee(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTaskAssignee.id = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTaskAssignee.type = ByType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskAssignee; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskComment.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskComment.java new file mode 100644 index 000000000000..3d301034069d --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskComment.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.HashSet; +import java.util.Set; + +/** + * Task comment. + */ +@Fluent +public final class TaskComment implements JsonSerializable { + /* + * When the comment was created. + */ + @Generated + private OffsetDateTime timestamp; + + /* + * ID of the user or application who created the comment. + */ + @Generated + private String createdBy; + + /* + * Type of creator (User, Application, System, or custom type). + */ + @Generated + private ByType createdByType; + + /* + * The comment text content. + */ + @Generated + private String text; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTaskCommentAccessor(new JsonMergePatchHelper.TaskCommentAccessor() { + @Override + public TaskComment prepareModelForJsonMergePatch(TaskComment model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TaskComment model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TaskComment class. + */ + @Generated + public TaskComment() { + } + + /** + * Get the timestamp property: When the comment was created. + * + * @return the timestamp value. + */ + @Generated + public OffsetDateTime getTimestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: When the comment was created. + * + * @param timestamp the timestamp value to set. + * @return the TaskComment object itself. + */ + @Generated + public TaskComment setTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + this.updatedProperties.add("timestamp"); + return this; + } + + /** + * Get the createdBy property: ID of the user or application who created the comment. + * + * @return the createdBy value. + */ + @Generated + public String getCreatedBy() { + return this.createdBy; + } + + /** + * Set the createdBy property: ID of the user or application who created the comment. + *

Required when create the resource.

+ * + * @param createdBy the createdBy value to set. + * @return the TaskComment object itself. + */ + @Generated + public TaskComment setCreatedBy(String createdBy) { + this.createdBy = createdBy; + this.updatedProperties.add("createdBy"); + return this; + } + + /** + * Get the createdByType property: Type of creator (User, Application, System, or custom type). + * + * @return the createdByType value. + */ + @Generated + public ByType getCreatedByType() { + return this.createdByType; + } + + /** + * Set the createdByType property: Type of creator (User, Application, System, or custom type). + *

Required when create the resource.

+ * + * @param createdByType the createdByType value to set. + * @return the TaskComment object itself. + */ + @Generated + public TaskComment setCreatedByType(ByType createdByType) { + this.createdByType = createdByType; + this.updatedProperties.add("createdByType"); + return this; + } + + /** + * Get the text property: The comment text content. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Set the text property: The comment text content. + *

Required when create the resource.

+ * + * @param text the text value to set. + * @return the TaskComment object itself. + */ + @Generated + public TaskComment setText(String text) { + this.text = text; + this.updatedProperties.add("text"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("timestamp", + this.timestamp == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.timestamp)); + jsonWriter.writeStringField("createdBy", this.createdBy); + jsonWriter.writeStringField("createdByType", + this.createdByType == null ? null : this.createdByType.toString()); + jsonWriter.writeStringField("text", this.text); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("timestamp")) { + if (this.timestamp == null) { + jsonWriter.writeNullField("timestamp"); + } else { + jsonWriter.writeStringField("timestamp", + this.timestamp == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.timestamp)); + } + } + if (updatedProperties.contains("createdBy")) { + if (this.createdBy == null) { + jsonWriter.writeNullField("createdBy"); + } else { + jsonWriter.writeStringField("createdBy", this.createdBy); + } + } + if (updatedProperties.contains("createdByType")) { + if (this.createdByType == null) { + jsonWriter.writeNullField("createdByType"); + } else { + jsonWriter.writeStringField("createdByType", this.createdByType.toString()); + } + } + if (updatedProperties.contains("text")) { + if (this.text == null) { + jsonWriter.writeNullField("text"); + } else { + jsonWriter.writeStringField("text", this.text); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskComment from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskComment if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TaskComment. + */ + @Generated + public static TaskComment fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskComment deserializedTaskComment = new TaskComment(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timestamp".equals(fieldName)) { + deserializedTaskComment.timestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdBy".equals(fieldName)) { + deserializedTaskComment.createdBy = reader.getString(); + } else if ("createdByType".equals(fieldName)) { + deserializedTaskComment.createdByType = ByType.fromString(reader.getString()); + } else if ("text".equals(fieldName)) { + deserializedTaskComment.text = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskComment; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskPriority.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskPriority.java new file mode 100644 index 000000000000..7867ead21a17 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskPriority.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Task priority level. + */ +public final class TaskPriority extends ExpandableStringEnum { + /** + * Low priority. + */ + @Generated + public static final TaskPriority LOW = fromString("Low"); + + /** + * Medium priority. + */ + @Generated + public static final TaskPriority MEDIUM = fromString("Medium"); + + /** + * High priority. + */ + @Generated + public static final TaskPriority HIGH = fromString("High"); + + /** + * Creates a new instance of TaskPriority value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TaskPriority() { + } + + /** + * Creates or finds a TaskPriority from its string representation. + * + * @param name a name to look for. + * @return the corresponding TaskPriority. + */ + @Generated + public static TaskPriority fromString(String name) { + return fromString(name, TaskPriority.class); + } + + /** + * Gets known TaskPriority values. + * + * @return known TaskPriority values. + */ + @Generated + public static Collection values() { + return values(TaskPriority.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskResult.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskResult.java new file mode 100644 index 000000000000..56913c06ae2f --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskResult.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.ai.discovery.implementation.JsonMergePatchHelper; +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Task execution result. + */ +@Fluent +public final class TaskResult implements JsonSerializable { + /* + * The text content of the task result. + */ + @Generated + private String text; + + /* + * Array of storage asset identifiers related to the result. + */ + @Generated + private List storageAssetIds; + + /** + * Stores updated model property, the value is property name, not serialized name. + */ + @Generated + private final Set updatedProperties = new HashSet<>(); + + @Generated + private boolean jsonMergePatch; + + @Generated + private void serializeAsJsonMergePatch(boolean jsonMergePatch) { + this.jsonMergePatch = jsonMergePatch; + } + + static { + JsonMergePatchHelper.setTaskResultAccessor(new JsonMergePatchHelper.TaskResultAccessor() { + @Override + public TaskResult prepareModelForJsonMergePatch(TaskResult model, boolean jsonMergePatchEnabled) { + model.serializeAsJsonMergePatch(jsonMergePatchEnabled); + return model; + } + + @Override + public boolean isJsonMergePatch(TaskResult model) { + return model.jsonMergePatch; + } + }); + } + + /** + * Creates an instance of TaskResult class. + */ + @Generated + public TaskResult() { + } + + /** + * Get the text property: The text content of the task result. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Set the text property: The text content of the task result. + * + * @param text the text value to set. + * @return the TaskResult object itself. + */ + @Generated + public TaskResult setText(String text) { + this.text = text; + this.updatedProperties.add("text"); + return this; + } + + /** + * Get the storageAssetIds property: Array of storage asset identifiers related to the result. + * + * @return the storageAssetIds value. + */ + @Generated + public List getStorageAssetIds() { + return this.storageAssetIds; + } + + /** + * Set the storageAssetIds property: Array of storage asset identifiers related to the result. + * + * @param storageAssetIds the storageAssetIds value to set. + * @return the TaskResult object itself. + */ + @Generated + public TaskResult setStorageAssetIds(List storageAssetIds) { + this.storageAssetIds = storageAssetIds; + this.updatedProperties.add("storageAssetIds"); + return this; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + if (jsonMergePatch) { + return toJsonMergePatch(jsonWriter); + } else { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("text", this.text); + jsonWriter.writeArrayField("storageAssetIds", this.storageAssetIds, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + } + + @Generated + private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (updatedProperties.contains("text")) { + if (this.text == null) { + jsonWriter.writeNullField("text"); + } else { + jsonWriter.writeStringField("text", this.text); + } + } + if (updatedProperties.contains("storageAssetIds")) { + if (this.storageAssetIds == null) { + jsonWriter.writeNullField("storageAssetIds"); + } else { + jsonWriter.writeArrayField("storageAssetIds", this.storageAssetIds, + (writer, element) -> writer.writeString(element)); + } + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskResult if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the TaskResult. + */ + @Generated + public static TaskResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskResult deserializedTaskResult = new TaskResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("text".equals(fieldName)) { + deserializedTaskResult.text = reader.getString(); + } else if ("storageAssetIds".equals(fieldName)) { + List storageAssetIds = reader.readArray(reader1 -> reader1.getString()); + deserializedTaskResult.storageAssetIds = storageAssetIds; + } else { + reader.skipChildren(); + } + } + + return deserializedTaskResult; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskStatus.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskStatus.java new file mode 100644 index 000000000000..b2f475b89d8a --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/TaskStatus.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Task status enumeration. + */ +public final class TaskStatus extends ExpandableStringEnum { + /** + * The task is newly created. + */ + @Generated + public static final TaskStatus NEW = fromString("New"); + + /** + * The task is on hold. + */ + @Generated + public static final TaskStatus ON_HOLD = fromString("OnHold"); + + /** + * The task has been completed. + */ + @Generated + public static final TaskStatus COMPLETE = fromString("Complete"); + + /** + * The task has been removed. + */ + @Generated + public static final TaskStatus REMOVED = fromString("Removed"); + + /** + * The task has been flagged for human review. + */ + @Generated + public static final TaskStatus FLAGGED_HUMAN = fromString("FlaggedHuman"); + + /** + * The task has been flagged for AI review. + */ + @Generated + public static final TaskStatus FLAGGED_AI = fromString("FlaggedAi"); + + /** + * The task is currently executing. + */ + @Generated + public static final TaskStatus EXECUTING = fromString("Executing"); + + /** + * The task execution is done. + */ + @Generated + public static final TaskStatus EXECUTION_DONE = fromString("ExecutionDone"); + + /** + * The task has become stale. + */ + @Generated + public static final TaskStatus STALE = fromString("Stale"); + + /** + * The task has failed. + */ + @Generated + public static final TaskStatus FAILED = fromString("Failed"); + + /** + * The task is incomplete. + */ + @Generated + public static final TaskStatus INCOMPLETE = fromString("Incomplete"); + + /** + * Creates a new instance of TaskStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public TaskStatus() { + } + + /** + * Creates or finds a TaskStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding TaskStatus. + */ + @Generated + public static TaskStatus fromString(String name) { + return fromString(name, TaskStatus.class); + } + + /** + * Gets known TaskStatus values. + * + * @return known TaskStatus values. + */ + @Generated + public static Collection values() { + return values(TaskStatus.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/WorkingMemoryEntry.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/WorkingMemoryEntry.java new file mode 100644 index 000000000000..89ba97fe7ff4 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/WorkingMemoryEntry.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Working memory entry. + */ +@Immutable +public final class WorkingMemoryEntry implements JsonSerializable { + /* + * The content of the working memory entry. + */ + @Generated + private final String content; + + /* + * The type of the working memory entry. + */ + @Generated + private final WorkingMemoryEntryType type; + + /* + * The timestamp when the resource was created. + */ + @Generated + private OffsetDateTime createdAt; + + /** + * Creates an instance of WorkingMemoryEntry class. + * + * @param content the content value to set. + * @param type the type value to set. + */ + @Generated + private WorkingMemoryEntry(String content, WorkingMemoryEntryType type) { + this.content = content; + this.type = type; + } + + /** + * Get the content property: The content of the working memory entry. + * + * @return the content value. + */ + @Generated + public String getContent() { + return this.content; + } + + /** + * Get the type property: The type of the working memory entry. + * + * @return the type value. + */ + @Generated + public WorkingMemoryEntryType getType() { + return this.type; + } + + /** + * Get the createdAt property: The timestamp when the resource was created. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * {@inheritDoc} + */ + @Generated + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("content", this.content); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("createdAt", + this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkingMemoryEntry from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkingMemoryEntry if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkingMemoryEntry. + */ + @Generated + public static WorkingMemoryEntry fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String content = null; + WorkingMemoryEntryType type = null; + OffsetDateTime createdAt = null; + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("content".equals(fieldName)) { + content = reader.getString(); + } else if ("type".equals(fieldName)) { + type = WorkingMemoryEntryType.fromString(reader.getString()); + } else if ("createdAt".equals(fieldName)) { + createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + WorkingMemoryEntry deserializedWorkingMemoryEntry = new WorkingMemoryEntry(content, type); + deserializedWorkingMemoryEntry.createdAt = createdAt; + + return deserializedWorkingMemoryEntry; + }); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/WorkingMemoryEntryType.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/WorkingMemoryEntryType.java new file mode 100644 index 000000000000..1a1cd7361b73 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/WorkingMemoryEntryType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Working memory entry type. + */ +public final class WorkingMemoryEntryType extends ExpandableStringEnum { + /** + * Thought. + */ + @Generated + public static final WorkingMemoryEntryType THOUGHT = fromString("Thought"); + + /** + * Creates a new instance of WorkingMemoryEntryType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public WorkingMemoryEntryType() { + } + + /** + * Creates or finds a WorkingMemoryEntryType from its string representation. + * + * @param name a name to look for. + * @return the corresponding WorkingMemoryEntryType. + */ + @Generated + public static WorkingMemoryEntryType fromString(String name) { + return fromString(name, WorkingMemoryEntryType.class); + } + + /** + * Gets known WorkingMemoryEntryType values. + * + * @return known WorkingMemoryEntryType values. + */ + @Generated + public static Collection values() { + return values(WorkingMemoryEntryType.class); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/package-info.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/package-info.java new file mode 100644 index 000000000000..4e1f58879187 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/models/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for Discovery. + */ +package com.azure.ai.discovery.models; diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/package-info.java b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/package-info.java new file mode 100644 index 000000000000..f6cae12b19f7 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/com/azure/ai/discovery/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for Discovery. + */ +package com.azure.ai.discovery; diff --git a/sdk/discovery/azure-ai-discovery/src/main/java/module-info.java b/sdk/discovery/azure-ai-discovery/src/main/java/module-info.java new file mode 100644 index 000000000000..5abef5f877c6 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.ai.discovery { + requires transitive com.azure.core; + + exports com.azure.ai.discovery; + exports com.azure.ai.discovery.models; + + opens com.azure.ai.discovery.models to com.azure.core; + opens com.azure.ai.discovery.implementation.models to com.azure.core; +} diff --git a/sdk/discovery/azure-ai-discovery/src/main/resources/META-INF/azure-ai-discovery_metadata.json b/sdk/discovery/azure-ai-discovery/src/main/resources/META-INF/azure-ai-discovery_metadata.json new file mode 100644 index 000000000000..24d06aab739b --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/resources/META-INF/azure-ai-discovery_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Microsoft.Discovery.Workspace":"2026-06-01","Microsoft.Discovery.Bookshelf":"2026-06-01"},"crossLanguagePackageId":"Microsoft.Discovery.Workspace","crossLanguageVersion":"ba4f11bf0408","crossLanguageDefinitions":{"com.azure.ai.discovery.BookshelfAsyncClient":"Microsoft.Discovery.Bookshelf.KnowledgeBases","com.azure.ai.discovery.BookshelfAsyncClient.beginCancelIndexing":"Microsoft.Discovery.Bookshelf.KnowledgeBases.cancelIndexing","com.azure.ai.discovery.BookshelfAsyncClient.beginCancelIndexingWithModel":"Microsoft.Discovery.Bookshelf.KnowledgeBases.cancelIndexing","com.azure.ai.discovery.BookshelfAsyncClient.beginCreateOrUpdate":"Microsoft.Discovery.Bookshelf.KnowledgeBases.createOrUpdate","com.azure.ai.discovery.BookshelfAsyncClient.beginCreateOrUpdateWithModel":"Microsoft.Discovery.Bookshelf.KnowledgeBases.createOrUpdate","com.azure.ai.discovery.BookshelfAsyncClient.beginDelete":"Microsoft.Discovery.Bookshelf.KnowledgeBases.delete","com.azure.ai.discovery.BookshelfAsyncClient.beginDeleteWithModel":"Microsoft.Discovery.Bookshelf.KnowledgeBases.delete","com.azure.ai.discovery.BookshelfAsyncClient.beginSearch":"Microsoft.Discovery.Bookshelf.KnowledgeBases.search","com.azure.ai.discovery.BookshelfAsyncClient.beginSearchWithModel":"Microsoft.Discovery.Bookshelf.KnowledgeBases.search","com.azure.ai.discovery.BookshelfAsyncClient.beginStartIndexing":"Microsoft.Discovery.Bookshelf.KnowledgeBases.startIndexing","com.azure.ai.discovery.BookshelfAsyncClient.beginStartIndexingWithModel":"Microsoft.Discovery.Bookshelf.KnowledgeBases.startIndexing","com.azure.ai.discovery.BookshelfAsyncClient.get":"Microsoft.Discovery.Bookshelf.KnowledgeBases.get","com.azure.ai.discovery.BookshelfAsyncClient.getOperationStatus":"Microsoft.Discovery.Bookshelf.KnowledgeBases.getOperationStatus","com.azure.ai.discovery.BookshelfAsyncClient.getOperationStatusWithResponse":"Microsoft.Discovery.Bookshelf.KnowledgeBases.getOperationStatus","com.azure.ai.discovery.BookshelfAsyncClient.getWithResponse":"Microsoft.Discovery.Bookshelf.KnowledgeBases.get","com.azure.ai.discovery.BookshelfAsyncClient.list":"Microsoft.Discovery.Bookshelf.KnowledgeBases.list","com.azure.ai.discovery.BookshelfClient":"Microsoft.Discovery.Bookshelf.KnowledgeBases","com.azure.ai.discovery.BookshelfClient.beginCancelIndexing":"Microsoft.Discovery.Bookshelf.KnowledgeBases.cancelIndexing","com.azure.ai.discovery.BookshelfClient.beginCancelIndexingWithModel":"Microsoft.Discovery.Bookshelf.KnowledgeBases.cancelIndexing","com.azure.ai.discovery.BookshelfClient.beginCreateOrUpdate":"Microsoft.Discovery.Bookshelf.KnowledgeBases.createOrUpdate","com.azure.ai.discovery.BookshelfClient.beginCreateOrUpdateWithModel":"Microsoft.Discovery.Bookshelf.KnowledgeBases.createOrUpdate","com.azure.ai.discovery.BookshelfClient.beginDelete":"Microsoft.Discovery.Bookshelf.KnowledgeBases.delete","com.azure.ai.discovery.BookshelfClient.beginDeleteWithModel":"Microsoft.Discovery.Bookshelf.KnowledgeBases.delete","com.azure.ai.discovery.BookshelfClient.beginSearch":"Microsoft.Discovery.Bookshelf.KnowledgeBases.search","com.azure.ai.discovery.BookshelfClient.beginSearchWithModel":"Microsoft.Discovery.Bookshelf.KnowledgeBases.search","com.azure.ai.discovery.BookshelfClient.beginStartIndexing":"Microsoft.Discovery.Bookshelf.KnowledgeBases.startIndexing","com.azure.ai.discovery.BookshelfClient.beginStartIndexingWithModel":"Microsoft.Discovery.Bookshelf.KnowledgeBases.startIndexing","com.azure.ai.discovery.BookshelfClient.get":"Microsoft.Discovery.Bookshelf.KnowledgeBases.get","com.azure.ai.discovery.BookshelfClient.getOperationStatus":"Microsoft.Discovery.Bookshelf.KnowledgeBases.getOperationStatus","com.azure.ai.discovery.BookshelfClient.getOperationStatusWithResponse":"Microsoft.Discovery.Bookshelf.KnowledgeBases.getOperationStatus","com.azure.ai.discovery.BookshelfClient.getWithResponse":"Microsoft.Discovery.Bookshelf.KnowledgeBases.get","com.azure.ai.discovery.BookshelfClient.list":"Microsoft.Discovery.Bookshelf.KnowledgeBases.list","com.azure.ai.discovery.BookshelfClientBuilder":"Microsoft.Discovery.Bookshelf","com.azure.ai.discovery.ConversationsAsyncClient":"Microsoft.Discovery.Workspace.Conversations","com.azure.ai.discovery.ConversationsAsyncClient.create":"Microsoft.Discovery.Workspace.Conversations.create","com.azure.ai.discovery.ConversationsAsyncClient.createWithResponse":"Microsoft.Discovery.Workspace.Conversations.create","com.azure.ai.discovery.ConversationsAsyncClient.delete":"Microsoft.Discovery.Workspace.Conversations.delete","com.azure.ai.discovery.ConversationsAsyncClient.deleteWithResponse":"Microsoft.Discovery.Workspace.Conversations.delete","com.azure.ai.discovery.ConversationsAsyncClient.get":"Microsoft.Discovery.Workspace.Conversations.get","com.azure.ai.discovery.ConversationsAsyncClient.getWithResponse":"Microsoft.Discovery.Workspace.Conversations.get","com.azure.ai.discovery.ConversationsAsyncClient.list":"Microsoft.Discovery.Workspace.Conversations.list","com.azure.ai.discovery.ConversationsAsyncClient.listWithResponse":"Microsoft.Discovery.Workspace.Conversations.list","com.azure.ai.discovery.ConversationsAsyncClient.stableUpdate":"Microsoft.Discovery.Workspace.Conversations.stableUpdate","com.azure.ai.discovery.ConversationsAsyncClient.stableUpdateWithResponse":"Microsoft.Discovery.Workspace.Conversations.stableUpdate","com.azure.ai.discovery.ConversationsClient":"Microsoft.Discovery.Workspace.Conversations","com.azure.ai.discovery.ConversationsClient.create":"Microsoft.Discovery.Workspace.Conversations.create","com.azure.ai.discovery.ConversationsClient.createWithResponse":"Microsoft.Discovery.Workspace.Conversations.create","com.azure.ai.discovery.ConversationsClient.delete":"Microsoft.Discovery.Workspace.Conversations.delete","com.azure.ai.discovery.ConversationsClient.deleteWithResponse":"Microsoft.Discovery.Workspace.Conversations.delete","com.azure.ai.discovery.ConversationsClient.get":"Microsoft.Discovery.Workspace.Conversations.get","com.azure.ai.discovery.ConversationsClient.getWithResponse":"Microsoft.Discovery.Workspace.Conversations.get","com.azure.ai.discovery.ConversationsClient.list":"Microsoft.Discovery.Workspace.Conversations.list","com.azure.ai.discovery.ConversationsClient.listWithResponse":"Microsoft.Discovery.Workspace.Conversations.list","com.azure.ai.discovery.ConversationsClient.stableUpdate":"Microsoft.Discovery.Workspace.Conversations.stableUpdate","com.azure.ai.discovery.ConversationsClient.stableUpdateWithResponse":"Microsoft.Discovery.Workspace.Conversations.stableUpdate","com.azure.ai.discovery.InvestigationsAsyncClient":"Microsoft.Discovery.Workspace.Investigations","com.azure.ai.discovery.InvestigationsAsyncClient.beginDelete":"Microsoft.Discovery.Workspace.Investigations.delete","com.azure.ai.discovery.InvestigationsAsyncClient.beginDeleteWithModel":"Microsoft.Discovery.Workspace.Investigations.delete","com.azure.ai.discovery.InvestigationsAsyncClient.createOrReplace":"Microsoft.Discovery.Workspace.Investigations.createOrReplace","com.azure.ai.discovery.InvestigationsAsyncClient.createOrReplaceWithResponse":"Microsoft.Discovery.Workspace.Investigations.createOrReplace","com.azure.ai.discovery.InvestigationsAsyncClient.get":"Microsoft.Discovery.Workspace.Investigations.get","com.azure.ai.discovery.InvestigationsAsyncClient.getDiscoveryEngine":"Microsoft.Discovery.Workspace.Investigations.getDiscoveryEngine","com.azure.ai.discovery.InvestigationsAsyncClient.getDiscoveryEngineMemory":"Microsoft.Discovery.Workspace.Investigations.getDiscoveryEngineMemory","com.azure.ai.discovery.InvestigationsAsyncClient.getDiscoveryEngineMemoryWithResponse":"Microsoft.Discovery.Workspace.Investigations.getDiscoveryEngineMemory","com.azure.ai.discovery.InvestigationsAsyncClient.getDiscoveryEngineWithResponse":"Microsoft.Discovery.Workspace.Investigations.getDiscoveryEngine","com.azure.ai.discovery.InvestigationsAsyncClient.getOperationStatus":"Microsoft.Discovery.Workspace.Investigations.getOperationStatus","com.azure.ai.discovery.InvestigationsAsyncClient.getOperationStatusWithResponse":"Microsoft.Discovery.Workspace.Investigations.getOperationStatus","com.azure.ai.discovery.InvestigationsAsyncClient.getWithResponse":"Microsoft.Discovery.Workspace.Investigations.get","com.azure.ai.discovery.InvestigationsAsyncClient.list":"Microsoft.Discovery.Workspace.Investigations.list","com.azure.ai.discovery.InvestigationsAsyncClient.listWithResponse":"Microsoft.Discovery.Workspace.Investigations.list","com.azure.ai.discovery.InvestigationsAsyncClient.startDiscoveryEngine":"Microsoft.Discovery.Workspace.Investigations.startDiscoveryEngine","com.azure.ai.discovery.InvestigationsAsyncClient.startDiscoveryEngineWithResponse":"Microsoft.Discovery.Workspace.Investigations.startDiscoveryEngine","com.azure.ai.discovery.InvestigationsAsyncClient.stopDiscoveryEngine":"Microsoft.Discovery.Workspace.Investigations.stopDiscoveryEngine","com.azure.ai.discovery.InvestigationsAsyncClient.stopDiscoveryEngineWithResponse":"Microsoft.Discovery.Workspace.Investigations.stopDiscoveryEngine","com.azure.ai.discovery.InvestigationsAsyncClient.update":"Microsoft.Discovery.Workspace.Investigations.update","com.azure.ai.discovery.InvestigationsAsyncClient.updateDiscoveryEngine":"Microsoft.Discovery.Workspace.Investigations.updateDiscoveryEngine","com.azure.ai.discovery.InvestigationsAsyncClient.updateDiscoveryEngineWithResponse":"Microsoft.Discovery.Workspace.Investigations.updateDiscoveryEngine","com.azure.ai.discovery.InvestigationsAsyncClient.updateWithResponse":"Microsoft.Discovery.Workspace.Investigations.update","com.azure.ai.discovery.InvestigationsClient":"Microsoft.Discovery.Workspace.Investigations","com.azure.ai.discovery.InvestigationsClient.beginDelete":"Microsoft.Discovery.Workspace.Investigations.delete","com.azure.ai.discovery.InvestigationsClient.beginDeleteWithModel":"Microsoft.Discovery.Workspace.Investigations.delete","com.azure.ai.discovery.InvestigationsClient.createOrReplace":"Microsoft.Discovery.Workspace.Investigations.createOrReplace","com.azure.ai.discovery.InvestigationsClient.createOrReplaceWithResponse":"Microsoft.Discovery.Workspace.Investigations.createOrReplace","com.azure.ai.discovery.InvestigationsClient.get":"Microsoft.Discovery.Workspace.Investigations.get","com.azure.ai.discovery.InvestigationsClient.getDiscoveryEngine":"Microsoft.Discovery.Workspace.Investigations.getDiscoveryEngine","com.azure.ai.discovery.InvestigationsClient.getDiscoveryEngineMemory":"Microsoft.Discovery.Workspace.Investigations.getDiscoveryEngineMemory","com.azure.ai.discovery.InvestigationsClient.getDiscoveryEngineMemoryWithResponse":"Microsoft.Discovery.Workspace.Investigations.getDiscoveryEngineMemory","com.azure.ai.discovery.InvestigationsClient.getDiscoveryEngineWithResponse":"Microsoft.Discovery.Workspace.Investigations.getDiscoveryEngine","com.azure.ai.discovery.InvestigationsClient.getOperationStatus":"Microsoft.Discovery.Workspace.Investigations.getOperationStatus","com.azure.ai.discovery.InvestigationsClient.getOperationStatusWithResponse":"Microsoft.Discovery.Workspace.Investigations.getOperationStatus","com.azure.ai.discovery.InvestigationsClient.getWithResponse":"Microsoft.Discovery.Workspace.Investigations.get","com.azure.ai.discovery.InvestigationsClient.list":"Microsoft.Discovery.Workspace.Investigations.list","com.azure.ai.discovery.InvestigationsClient.listWithResponse":"Microsoft.Discovery.Workspace.Investigations.list","com.azure.ai.discovery.InvestigationsClient.startDiscoveryEngine":"Microsoft.Discovery.Workspace.Investigations.startDiscoveryEngine","com.azure.ai.discovery.InvestigationsClient.startDiscoveryEngineWithResponse":"Microsoft.Discovery.Workspace.Investigations.startDiscoveryEngine","com.azure.ai.discovery.InvestigationsClient.stopDiscoveryEngine":"Microsoft.Discovery.Workspace.Investigations.stopDiscoveryEngine","com.azure.ai.discovery.InvestigationsClient.stopDiscoveryEngineWithResponse":"Microsoft.Discovery.Workspace.Investigations.stopDiscoveryEngine","com.azure.ai.discovery.InvestigationsClient.update":"Microsoft.Discovery.Workspace.Investigations.update","com.azure.ai.discovery.InvestigationsClient.updateDiscoveryEngine":"Microsoft.Discovery.Workspace.Investigations.updateDiscoveryEngine","com.azure.ai.discovery.InvestigationsClient.updateDiscoveryEngineWithResponse":"Microsoft.Discovery.Workspace.Investigations.updateDiscoveryEngine","com.azure.ai.discovery.InvestigationsClient.updateWithResponse":"Microsoft.Discovery.Workspace.Investigations.update","com.azure.ai.discovery.TasksAsyncClient":"Microsoft.Discovery.Workspace.Tasks","com.azure.ai.discovery.TasksAsyncClient.addComment":"Microsoft.Discovery.Workspace.Tasks.addComment","com.azure.ai.discovery.TasksAsyncClient.addCommentWithResponse":"Microsoft.Discovery.Workspace.Tasks.addComment","com.azure.ai.discovery.TasksAsyncClient.addExecutionHistory":"Microsoft.Discovery.Workspace.Tasks.addExecutionHistory","com.azure.ai.discovery.TasksAsyncClient.addExecutionHistoryWithResponse":"Microsoft.Discovery.Workspace.Tasks.addExecutionHistory","com.azure.ai.discovery.TasksAsyncClient.create":"Microsoft.Discovery.Workspace.Tasks.create","com.azure.ai.discovery.TasksAsyncClient.createWithResponse":"Microsoft.Discovery.Workspace.Tasks.create","com.azure.ai.discovery.TasksAsyncClient.delete":"Microsoft.Discovery.Workspace.Tasks.delete","com.azure.ai.discovery.TasksAsyncClient.deleteWithResponse":"Microsoft.Discovery.Workspace.Tasks.delete","com.azure.ai.discovery.TasksAsyncClient.get":"Microsoft.Discovery.Workspace.Tasks.get","com.azure.ai.discovery.TasksAsyncClient.getWithResponse":"Microsoft.Discovery.Workspace.Tasks.get","com.azure.ai.discovery.TasksAsyncClient.list":"Microsoft.Discovery.Workspace.Tasks.list","com.azure.ai.discovery.TasksAsyncClient.stableUpdate":"Microsoft.Discovery.Workspace.Tasks.stableUpdate","com.azure.ai.discovery.TasksAsyncClient.stableUpdateWithResponse":"Microsoft.Discovery.Workspace.Tasks.stableUpdate","com.azure.ai.discovery.TasksAsyncClient.start":"Microsoft.Discovery.Workspace.Tasks.start","com.azure.ai.discovery.TasksAsyncClient.startWithResponse":"Microsoft.Discovery.Workspace.Tasks.start","com.azure.ai.discovery.TasksClient":"Microsoft.Discovery.Workspace.Tasks","com.azure.ai.discovery.TasksClient.addComment":"Microsoft.Discovery.Workspace.Tasks.addComment","com.azure.ai.discovery.TasksClient.addCommentWithResponse":"Microsoft.Discovery.Workspace.Tasks.addComment","com.azure.ai.discovery.TasksClient.addExecutionHistory":"Microsoft.Discovery.Workspace.Tasks.addExecutionHistory","com.azure.ai.discovery.TasksClient.addExecutionHistoryWithResponse":"Microsoft.Discovery.Workspace.Tasks.addExecutionHistory","com.azure.ai.discovery.TasksClient.create":"Microsoft.Discovery.Workspace.Tasks.create","com.azure.ai.discovery.TasksClient.createWithResponse":"Microsoft.Discovery.Workspace.Tasks.create","com.azure.ai.discovery.TasksClient.delete":"Microsoft.Discovery.Workspace.Tasks.delete","com.azure.ai.discovery.TasksClient.deleteWithResponse":"Microsoft.Discovery.Workspace.Tasks.delete","com.azure.ai.discovery.TasksClient.get":"Microsoft.Discovery.Workspace.Tasks.get","com.azure.ai.discovery.TasksClient.getWithResponse":"Microsoft.Discovery.Workspace.Tasks.get","com.azure.ai.discovery.TasksClient.list":"Microsoft.Discovery.Workspace.Tasks.list","com.azure.ai.discovery.TasksClient.stableUpdate":"Microsoft.Discovery.Workspace.Tasks.stableUpdate","com.azure.ai.discovery.TasksClient.stableUpdateWithResponse":"Microsoft.Discovery.Workspace.Tasks.stableUpdate","com.azure.ai.discovery.TasksClient.start":"Microsoft.Discovery.Workspace.Tasks.start","com.azure.ai.discovery.TasksClient.startWithResponse":"Microsoft.Discovery.Workspace.Tasks.start","com.azure.ai.discovery.ToolsAsyncClient":"Microsoft.Discovery.Workspace.Tools","com.azure.ai.discovery.ToolsAsyncClient.beginCancelRunLro":"Microsoft.Discovery.Workspace.Tools.cancelRunLro","com.azure.ai.discovery.ToolsAsyncClient.beginCancelRunLroWithModel":"Microsoft.Discovery.Workspace.Tools.cancelRunLro","com.azure.ai.discovery.ToolsAsyncClient.beginRun":"Microsoft.Discovery.Workspace.Tools.run","com.azure.ai.discovery.ToolsAsyncClient.beginRunWithModel":"Microsoft.Discovery.Workspace.Tools.run","com.azure.ai.discovery.ToolsAsyncClient.getComputeUsage":"Microsoft.Discovery.Workspace.Tools.getComputeUsage","com.azure.ai.discovery.ToolsAsyncClient.getComputeUsageWithResponse":"Microsoft.Discovery.Workspace.Tools.getComputeUsage","com.azure.ai.discovery.ToolsAsyncClient.getOperations":"Microsoft.Discovery.Workspace.Tools.getOperations","com.azure.ai.discovery.ToolsAsyncClient.getOperationsWithResponse":"Microsoft.Discovery.Workspace.Tools.getOperations","com.azure.ai.discovery.ToolsAsyncClient.getRunStatus":"Microsoft.Discovery.Workspace.Tools.getRunStatus","com.azure.ai.discovery.ToolsAsyncClient.getRunStatusWithResponse":"Microsoft.Discovery.Workspace.Tools.getRunStatus","com.azure.ai.discovery.ToolsClient":"Microsoft.Discovery.Workspace.Tools","com.azure.ai.discovery.ToolsClient.beginCancelRunLro":"Microsoft.Discovery.Workspace.Tools.cancelRunLro","com.azure.ai.discovery.ToolsClient.beginCancelRunLroWithModel":"Microsoft.Discovery.Workspace.Tools.cancelRunLro","com.azure.ai.discovery.ToolsClient.beginRun":"Microsoft.Discovery.Workspace.Tools.run","com.azure.ai.discovery.ToolsClient.beginRunWithModel":"Microsoft.Discovery.Workspace.Tools.run","com.azure.ai.discovery.ToolsClient.getComputeUsage":"Microsoft.Discovery.Workspace.Tools.getComputeUsage","com.azure.ai.discovery.ToolsClient.getComputeUsageWithResponse":"Microsoft.Discovery.Workspace.Tools.getComputeUsage","com.azure.ai.discovery.ToolsClient.getOperations":"Microsoft.Discovery.Workspace.Tools.getOperations","com.azure.ai.discovery.ToolsClient.getOperationsWithResponse":"Microsoft.Discovery.Workspace.Tools.getOperations","com.azure.ai.discovery.ToolsClient.getRunStatus":"Microsoft.Discovery.Workspace.Tools.getRunStatus","com.azure.ai.discovery.ToolsClient.getRunStatusWithResponse":"Microsoft.Discovery.Workspace.Tools.getRunStatus","com.azure.ai.discovery.WorkspaceClientBuilder":"Microsoft.Discovery.Workspace","com.azure.ai.discovery.implementation.models.CreateRequest":"Microsoft.Discovery.Workspace.create.Request.anonymous","com.azure.ai.discovery.implementation.models.RunRequest":"Microsoft.Discovery.Workspace.run.Request.anonymous","com.azure.ai.discovery.implementation.models.StartIndexingRequest":"Microsoft.Discovery.Bookshelf.startIndexing.Request.anonymous","com.azure.ai.discovery.models.ByType":"Microsoft.Discovery.Common.ByType","com.azure.ai.discovery.models.Citation":"Microsoft.Discovery.Bookshelf.Citation","com.azure.ai.discovery.models.CitationType":"Microsoft.Discovery.Bookshelf.CitationType","com.azure.ai.discovery.models.ComputeUsage":"Microsoft.Discovery.Workspace.ComputeUsage","com.azure.ai.discovery.models.Conversation":"Microsoft.Discovery.Workspace.Conversation","com.azure.ai.discovery.models.DiscoveryEngine":"Microsoft.Discovery.Workspace.DiscoveryEngine","com.azure.ai.discovery.models.DiscoveryEngineStatus":"Microsoft.Discovery.Workspace.DiscoveryEngineStatus","com.azure.ai.discovery.models.DiscoveryEngineUpdate":"Microsoft.Discovery.Workspace.DiscoveryEngineUpdate","com.azure.ai.discovery.models.ExecutionHistoryEntry":"Microsoft.Discovery.Workspace.ExecutionHistoryEntry","com.azure.ai.discovery.models.IndexingMetrics":"Microsoft.Discovery.Bookshelf.IndexingMetrics","com.azure.ai.discovery.models.IndexingOperationResult":"Microsoft.Discovery.Bookshelf.IndexingOperationResult","com.azure.ai.discovery.models.IndexingStatus":"Microsoft.Discovery.Bookshelf.IndexingStatus","com.azure.ai.discovery.models.InfraOverrides":"Microsoft.Discovery.Workspace.InfraOverrides","com.azure.ai.discovery.models.InlineFile":"Microsoft.Discovery.Workspace.InlineFile","com.azure.ai.discovery.models.InputDataMount":"Microsoft.Discovery.Workspace.InputDataMount","com.azure.ai.discovery.models.Investigation":"Microsoft.Discovery.Workspace.Investigation","com.azure.ai.discovery.models.InvestigationOperationStatus":"Microsoft.Discovery.Workspace.InvestigationOperationStatus","com.azure.ai.discovery.models.InvestigationStatus":"Microsoft.Discovery.Workspace.InvestigationStatus","com.azure.ai.discovery.models.KnowledgeBase":"Microsoft.Discovery.Bookshelf.KnowledgeBase","com.azure.ai.discovery.models.KnowledgeBaseIndexingOperationResponse":"Microsoft.Discovery.Bookshelf.KnowledgeBaseIndexingOperationResponse","com.azure.ai.discovery.models.KnowledgeBaseOperationResponse":"Microsoft.Discovery.Bookshelf.KnowledgeBaseOperationResponse","com.azure.ai.discovery.models.KnowledgeBaseOperationType":"Microsoft.Discovery.Bookshelf.KnowledgeBaseOperationType","com.azure.ai.discovery.models.KnowledgeBaseSearchOperationResponse":"Microsoft.Discovery.Bookshelf.KnowledgeBaseSearchOperationResponse","com.azure.ai.discovery.models.LastIndexingRun":"Microsoft.Discovery.Bookshelf.LastIndexingRun","com.azure.ai.discovery.models.NodepoolUsage":"Microsoft.Discovery.Workspace.NodepoolUsage","com.azure.ai.discovery.models.Operation":"Microsoft.Discovery.Workspace.Operation","com.azure.ai.discovery.models.OperationState":"Azure.Core.Foundations.OperationState","com.azure.ai.discovery.models.OperationStatusRunResultError":"Azure.Core.Foundations.OperationStatus","com.azure.ai.discovery.models.OutputDataMount":"Microsoft.Discovery.Workspace.OutputDataMount","com.azure.ai.discovery.models.OutputDataUri":"Microsoft.Discovery.Workspace.OutputDataUri","com.azure.ai.discovery.models.PagedConversation":"Azure.Core.Foundations.CustomPage","com.azure.ai.discovery.models.PagedInvestigation":"Azure.Core.Foundations.CustomPage","com.azure.ai.discovery.models.PagedOperation":"Azure.Core.Foundations.CustomPage","com.azure.ai.discovery.models.PagedWorkingMemoryEntry":"Azure.Core.Foundations.CustomPage","com.azure.ai.discovery.models.ProvisioningState":"Microsoft.Discovery.Common.ProvisioningState","com.azure.ai.discovery.models.RunOptions":null,"com.azure.ai.discovery.models.RunRequestEnvironmentVariable":"Microsoft.Discovery.Workspace.run.Request.environmentVariable.anonymous","com.azure.ai.discovery.models.RunResult":"Microsoft.Discovery.Workspace.RunResult","com.azure.ai.discovery.models.RunResultToolReport":"Microsoft.Discovery.Workspace.RunResult.toolReport.anonymous","com.azure.ai.discovery.models.RunResultToolReportStatusInformation":"Microsoft.Discovery.Workspace.RunResult.toolReport.statusInformation.anonymous","com.azure.ai.discovery.models.RunStatus":"Microsoft.Discovery.Workspace.RunStatus","com.azure.ai.discovery.models.SearchRequest":"Microsoft.Discovery.Bookshelf.SearchRequest","com.azure.ai.discovery.models.SearchResponse":"Microsoft.Discovery.Bookshelf.SearchResponse","com.azure.ai.discovery.models.SearchResultItem":"Microsoft.Discovery.Bookshelf.SearchResultItem","com.azure.ai.discovery.models.StartTaskRequest":"Microsoft.Discovery.Workspace.StartTaskRequest","com.azure.ai.discovery.models.StorageAssetReference":"Microsoft.Discovery.Bookshelf.StorageAssetReference","com.azure.ai.discovery.models.StorageMountProtocol":"Microsoft.Discovery.Workspace.StorageMountProtocol","com.azure.ai.discovery.models.SupercomputerUsage":"Microsoft.Discovery.Workspace.SupercomputerUsage","com.azure.ai.discovery.models.Tag":"Microsoft.Discovery.Common.Tag","com.azure.ai.discovery.models.Task":"Microsoft.Discovery.Workspace.Task","com.azure.ai.discovery.models.TaskAssignee":"Microsoft.Discovery.Workspace.TaskAssignee","com.azure.ai.discovery.models.TaskComment":"Microsoft.Discovery.Workspace.TaskComment","com.azure.ai.discovery.models.TaskPriority":"Microsoft.Discovery.Workspace.TaskPriority","com.azure.ai.discovery.models.TaskResult":"Microsoft.Discovery.Workspace.TaskResult","com.azure.ai.discovery.models.TaskStatus":"Microsoft.Discovery.Workspace.TaskStatus","com.azure.ai.discovery.models.WorkingMemoryEntry":"Microsoft.Discovery.Workspace.WorkingMemoryEntry","com.azure.ai.discovery.models.WorkingMemoryEntryType":"Microsoft.Discovery.Workspace.WorkingMemoryEntryType"},"generatedFiles":["src/main/java/com/azure/ai/discovery/BookshelfAsyncClient.java","src/main/java/com/azure/ai/discovery/BookshelfClient.java","src/main/java/com/azure/ai/discovery/BookshelfClientBuilder.java","src/main/java/com/azure/ai/discovery/ConversationsAsyncClient.java","src/main/java/com/azure/ai/discovery/ConversationsClient.java","src/main/java/com/azure/ai/discovery/DiscoveryServiceVersion.java","src/main/java/com/azure/ai/discovery/DiscoveryServiceVersion.java","src/main/java/com/azure/ai/discovery/InvestigationsAsyncClient.java","src/main/java/com/azure/ai/discovery/InvestigationsClient.java","src/main/java/com/azure/ai/discovery/TasksAsyncClient.java","src/main/java/com/azure/ai/discovery/TasksClient.java","src/main/java/com/azure/ai/discovery/ToolsAsyncClient.java","src/main/java/com/azure/ai/discovery/ToolsClient.java","src/main/java/com/azure/ai/discovery/WorkspaceClientBuilder.java","src/main/java/com/azure/ai/discovery/implementation/BookshelfClientImpl.java","src/main/java/com/azure/ai/discovery/implementation/ConversationsImpl.java","src/main/java/com/azure/ai/discovery/implementation/InvestigationsImpl.java","src/main/java/com/azure/ai/discovery/implementation/JsonMergePatchHelper.java","src/main/java/com/azure/ai/discovery/implementation/KnowledgeBasesImpl.java","src/main/java/com/azure/ai/discovery/implementation/OperationLocationPollingStrategy.java","src/main/java/com/azure/ai/discovery/implementation/PollingUtils.java","src/main/java/com/azure/ai/discovery/implementation/SyncOperationLocationPollingStrategy.java","src/main/java/com/azure/ai/discovery/implementation/TasksImpl.java","src/main/java/com/azure/ai/discovery/implementation/ToolsImpl.java","src/main/java/com/azure/ai/discovery/implementation/WorkspaceClientImpl.java","src/main/java/com/azure/ai/discovery/implementation/models/CreateRequest.java","src/main/java/com/azure/ai/discovery/implementation/models/RunRequest.java","src/main/java/com/azure/ai/discovery/implementation/models/StartIndexingRequest.java","src/main/java/com/azure/ai/discovery/implementation/models/package-info.java","src/main/java/com/azure/ai/discovery/implementation/package-info.java","src/main/java/com/azure/ai/discovery/models/ByType.java","src/main/java/com/azure/ai/discovery/models/Citation.java","src/main/java/com/azure/ai/discovery/models/CitationType.java","src/main/java/com/azure/ai/discovery/models/ComputeUsage.java","src/main/java/com/azure/ai/discovery/models/Conversation.java","src/main/java/com/azure/ai/discovery/models/DiscoveryEngine.java","src/main/java/com/azure/ai/discovery/models/DiscoveryEngineStatus.java","src/main/java/com/azure/ai/discovery/models/DiscoveryEngineUpdate.java","src/main/java/com/azure/ai/discovery/models/ExecutionHistoryEntry.java","src/main/java/com/azure/ai/discovery/models/IndexingMetrics.java","src/main/java/com/azure/ai/discovery/models/IndexingOperationResult.java","src/main/java/com/azure/ai/discovery/models/IndexingStatus.java","src/main/java/com/azure/ai/discovery/models/InfraOverrides.java","src/main/java/com/azure/ai/discovery/models/InlineFile.java","src/main/java/com/azure/ai/discovery/models/InputDataMount.java","src/main/java/com/azure/ai/discovery/models/Investigation.java","src/main/java/com/azure/ai/discovery/models/InvestigationOperationStatus.java","src/main/java/com/azure/ai/discovery/models/InvestigationStatus.java","src/main/java/com/azure/ai/discovery/models/KnowledgeBase.java","src/main/java/com/azure/ai/discovery/models/KnowledgeBaseIndexingOperationResponse.java","src/main/java/com/azure/ai/discovery/models/KnowledgeBaseOperationResponse.java","src/main/java/com/azure/ai/discovery/models/KnowledgeBaseOperationType.java","src/main/java/com/azure/ai/discovery/models/KnowledgeBaseSearchOperationResponse.java","src/main/java/com/azure/ai/discovery/models/LastIndexingRun.java","src/main/java/com/azure/ai/discovery/models/NodepoolUsage.java","src/main/java/com/azure/ai/discovery/models/Operation.java","src/main/java/com/azure/ai/discovery/models/OperationState.java","src/main/java/com/azure/ai/discovery/models/OperationStatusRunResultError.java","src/main/java/com/azure/ai/discovery/models/OutputDataMount.java","src/main/java/com/azure/ai/discovery/models/OutputDataUri.java","src/main/java/com/azure/ai/discovery/models/PagedConversation.java","src/main/java/com/azure/ai/discovery/models/PagedInvestigation.java","src/main/java/com/azure/ai/discovery/models/PagedOperation.java","src/main/java/com/azure/ai/discovery/models/PagedWorkingMemoryEntry.java","src/main/java/com/azure/ai/discovery/models/ProvisioningState.java","src/main/java/com/azure/ai/discovery/models/RunOptions.java","src/main/java/com/azure/ai/discovery/models/RunRequestEnvironmentVariable.java","src/main/java/com/azure/ai/discovery/models/RunResult.java","src/main/java/com/azure/ai/discovery/models/RunResultToolReport.java","src/main/java/com/azure/ai/discovery/models/RunResultToolReportStatusInformation.java","src/main/java/com/azure/ai/discovery/models/RunStatus.java","src/main/java/com/azure/ai/discovery/models/SearchRequest.java","src/main/java/com/azure/ai/discovery/models/SearchResponse.java","src/main/java/com/azure/ai/discovery/models/SearchResultItem.java","src/main/java/com/azure/ai/discovery/models/StartTaskRequest.java","src/main/java/com/azure/ai/discovery/models/StorageAssetReference.java","src/main/java/com/azure/ai/discovery/models/StorageMountProtocol.java","src/main/java/com/azure/ai/discovery/models/SupercomputerUsage.java","src/main/java/com/azure/ai/discovery/models/Tag.java","src/main/java/com/azure/ai/discovery/models/Task.java","src/main/java/com/azure/ai/discovery/models/TaskAssignee.java","src/main/java/com/azure/ai/discovery/models/TaskComment.java","src/main/java/com/azure/ai/discovery/models/TaskPriority.java","src/main/java/com/azure/ai/discovery/models/TaskResult.java","src/main/java/com/azure/ai/discovery/models/TaskStatus.java","src/main/java/com/azure/ai/discovery/models/WorkingMemoryEntry.java","src/main/java/com/azure/ai/discovery/models/WorkingMemoryEntryType.java","src/main/java/com/azure/ai/discovery/models/package-info.java","src/main/java/com/azure/ai/discovery/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/discovery/azure-ai-discovery/src/main/resources/azure-ai-discovery.properties b/sdk/discovery/azure-ai-discovery/src/main/resources/azure-ai-discovery.properties new file mode 100644 index 000000000000..ca812989b4f2 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/main/resources/azure-ai-discovery.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/sdk/discovery/azure-ai-discovery/src/samples/java/com/azure/ai/discovery/ReadmeSamples.java b/sdk/discovery/azure-ai-discovery/src/samples/java/com/azure/ai/discovery/ReadmeSamples.java new file mode 100644 index 000000000000..9047cd7e2301 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/samples/java/com/azure/ai/discovery/ReadmeSamples.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery; + +public final class ReadmeSamples { + public void readmeSamples() { + // BEGIN: com.azure.ai.discovery.readme + // END: com.azure.ai.discovery.readme + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/BookshelfAsyncClientTest.java b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/BookshelfAsyncClientTest.java new file mode 100644 index 000000000000..aecea2d14cc8 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/BookshelfAsyncClientTest.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.models.KnowledgeBase; +import com.azure.ai.discovery.models.KnowledgeBaseIndexingOperationResponse; +import com.azure.ai.discovery.models.KnowledgeBaseOperationResponse; +import com.azure.ai.discovery.models.SearchRequest; +import com.azure.ai.discovery.models.StorageAssetReference; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.util.polling.AsyncPollResponse; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import java.util.Arrays; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Tests for {@link BookshelfAsyncClient}, covering knowledge-base create-or-update, get, list, indexing, search, + * operation-status retrieval, and delete. All mutating operations are long-running. + */ +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public final class BookshelfAsyncClientTest extends DiscoveryClientTestBase { + + private KnowledgeBase newKnowledgeBase() { + return new KnowledgeBase().setDescription("Created by SDK tests") + .setCopilotInstruction("Use this tool to query cooling technology information.") + .setStorageAssetReferences(Arrays.asList( + new StorageAssetReference().setId(storageAssetId).setUserAssignedIdentity(userAssignedIdentity))); + } + + @Test + @Order(1) + public void testBeginCreateOrUpdate() { + BookshelfAsyncClient client = getBookshelfAsyncClient(); + KnowledgeBase result = client.beginCreateOrUpdate(knowledgeBaseName, newKnowledgeBase()) + .last() + .flatMap(AsyncPollResponse::getFinalResult) + .block(); + + assertNotNull(result); + } + + @Test + @Order(3) + public void testGet() { + BookshelfAsyncClient client = getBookshelfAsyncClient(); + KnowledgeBase knowledgeBase = client.get(knowledgeBaseName).block(); + + assertNotNull(knowledgeBase); + assertNotNull(knowledgeBase.getName()); + } + + @Test + @Order(2) + public void testList() { + BookshelfAsyncClient client = getBookshelfAsyncClient(); + List knowledgeBases = client.list().collectList().block(); + + assertNotNull(knowledgeBases); + assertTrue(knowledgeBases.stream().findAny().isPresent()); + } + + @Test + @Order(4) + public void testBeginStartIndexing() { + BookshelfAsyncClient client = getBookshelfAsyncClient(); + KnowledgeBaseOperationResponse response = client.beginStartIndexing(knowledgeBaseName).blockLast().getValue(); + + assertNotNull(response); + } + + @Test + @Order(5) + public void testBeginSearch() { + BookshelfAsyncClient client = getBookshelfAsyncClient(); + KnowledgeBaseOperationResponse response + = client.beginSearch(knowledgeBaseName, new SearchRequest("immersion cooling")).blockLast().getValue(); + + assertNotNull(response); + } + + @Test + @Order(6) + public void testGetOperationStatus() { + BookshelfAsyncClient client = getBookshelfAsyncClient(); + // The operation id is the indexing run id; read it from the typed operation result rather than the + // top-level "id" field, which the test proxy sanitizes during playback. + KnowledgeBaseIndexingOperationResponse operation + = (KnowledgeBaseIndexingOperationResponse) client.beginStartIndexing(knowledgeBaseName) + .blockLast() + .getValue(); + String operationId = operation.getIndexingResult().getRunId(); + + KnowledgeBaseOperationResponse status = client.getOperationStatus(knowledgeBaseName, operationId).block(); + assertNotNull(status); + } + + @Test + @Order(7) + public void testBeginDelete() { + BookshelfAsyncClient client = getBookshelfAsyncClient(); + String throwawayName = testResourceNamer.randomName("sdk-del-kb", 24); + client.beginCreateOrUpdate(throwawayName, newKnowledgeBase()).blockLast(); + + client.beginDelete(throwawayName).blockLast(); + + // The knowledge base must no longer be retrievable after deletion. + assertThrows(HttpResponseException.class, () -> client.get(throwawayName).block()); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/BookshelfClientTest.java b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/BookshelfClientTest.java new file mode 100644 index 000000000000..ff9288b75dd6 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/BookshelfClientTest.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.models.KnowledgeBase; +import com.azure.ai.discovery.models.KnowledgeBaseIndexingOperationResponse; +import com.azure.ai.discovery.models.KnowledgeBaseOperationResponse; +import com.azure.ai.discovery.models.SearchRequest; +import com.azure.ai.discovery.models.StorageAssetReference; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.polling.SyncPoller; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import java.util.Arrays; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Tests for {@link BookshelfClient}, covering knowledge-base create-or-update, get, list, indexing (start/cancel), + * search, operation-status retrieval, and delete. All mutating operations are long-running. + */ +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public final class BookshelfClientTest extends DiscoveryClientTestBase { + + private KnowledgeBase newKnowledgeBase() { + return new KnowledgeBase().setDescription("Created by SDK tests") + .setCopilotInstruction("Use this tool to query cooling technology information.") + .setStorageAssetReferences(Arrays.asList( + new StorageAssetReference().setId(storageAssetId).setUserAssignedIdentity(userAssignedIdentity))); + } + + @Test + @Order(1) + public void testBeginCreateOrUpdate() { + BookshelfClient client = getBookshelfClient(); + SyncPoller poller + = client.beginCreateOrUpdate(knowledgeBaseName, newKnowledgeBase()); + KnowledgeBase result = poller.getFinalResult(); + + assertNotNull(result); + } + + @Test + @Order(3) + public void testGet() { + BookshelfClient client = getBookshelfClient(); + KnowledgeBase knowledgeBase = client.get(knowledgeBaseName); + + assertNotNull(knowledgeBase); + assertNotNull(knowledgeBase.getName()); + } + + @Test + @Order(2) + public void testList() { + BookshelfClient client = getBookshelfClient(); + PagedIterable knowledgeBases = client.list(); + + assertNotNull(knowledgeBases); + assertTrue(knowledgeBases.stream().findAny().isPresent()); + } + + @Test + @Order(4) + public void testBeginStartIndexing() { + BookshelfClient client = getBookshelfClient(); + SyncPoller poller = client.beginStartIndexing(knowledgeBaseName); + poller.waitForCompletion(); + + assertNotNull(poller.poll().getValue()); + } + + @Test + @Order(5) + public void testBeginSearch() { + BookshelfClient client = getBookshelfClient(); + SyncPoller poller + = client.beginSearch(knowledgeBaseName, new SearchRequest("immersion cooling")); + + assertNotNull(poller.waitForCompletion().getValue()); + } + + @Test + @Order(6) + public void testGetOperationStatus() { + BookshelfClient client = getBookshelfClient(); + SyncPoller poller = client.beginStartIndexing(knowledgeBaseName); + // The operation id is the indexing run id; read it from the typed operation result rather than the + // top-level "id" field, which the test proxy sanitizes during playback. + KnowledgeBaseIndexingOperationResponse operation + = (KnowledgeBaseIndexingOperationResponse) poller.poll().getValue(); + String operationId = operation.getIndexingResult().getRunId(); + + KnowledgeBaseOperationResponse status = client.getOperationStatus(knowledgeBaseName, operationId); + assertNotNull(status); + } + + @Test + @Order(7) + public void testBeginDelete() { + BookshelfClient client = getBookshelfClient(); + String throwawayName = testResourceNamer.randomName("sdk-del-kb", 24); + client.beginCreateOrUpdate(throwawayName, newKnowledgeBase()).waitForCompletion(); + + client.beginDelete(throwawayName).waitForCompletion(); + + // The knowledge base must no longer be retrievable after deletion. + assertThrows(HttpResponseException.class, () -> client.get(throwawayName)); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/ConversationsAsyncClientTest.java b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/ConversationsAsyncClientTest.java new file mode 100644 index 000000000000..10fb79f56b14 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/ConversationsAsyncClientTest.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.models.Conversation; +import com.azure.ai.discovery.models.PagedConversation; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * Tests for {@link ConversationsAsyncClient}, covering create, get, list, stableUpdate, and delete. + */ +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public final class ConversationsAsyncClientTest extends DiscoveryClientTestBase { + + @Test + @Order(1) + public void testCreate() { + ConversationsAsyncClient client = getConversationsAsyncClient(); + Conversation conversation + = client.create(projectName, investigationPath(projectName, investigationName), "Test conversation") + .block(); + + assertNotNull(conversation); + assertEquals(projectName, conversation.getProjectName()); + assertNotNull(conversation.getName()); + assertNotNull(conversation.getCreatedAt()); + } + + @Test + @Order(2) + public void testList() { + ConversationsAsyncClient client = getConversationsAsyncClient(); + PagedConversation page = client.list(null, projectName, null, null, null, null).block(); + + assertNotNull(page); + assertNotNull(page.getValue()); + assertFalse(page.getValue().isEmpty()); + for (Conversation conversation : page.getValue()) { + assertEquals(projectName, conversation.getProjectName()); + assertNotNull(conversation.getCreatedAt()); + } + } + + @Test + @Order(3) + public void testGet() { + ConversationsAsyncClient client = getConversationsAsyncClient(); + Conversation created + = client.create(projectName, investigationPath(projectName, investigationName), "Conversation for get test") + .block(); + + Conversation conversation = client.get(created.getName()).block(); + assertNotNull(conversation); + assertEquals(created.getName(), conversation.getName()); + assertEquals(projectName, conversation.getProjectName()); + } + + @Test + @Order(4) + public void testStableUpdate() { + ConversationsAsyncClient client = getConversationsAsyncClient(); + Conversation created = client + .create(projectName, investigationPath(projectName, investigationName), "Conversation before update") + .block(); + + Conversation updated + = client.stableUpdate(created.getName(), new Conversation().setDisplayName("Conversation after update")) + .block(); + + assertNotNull(updated); + assertEquals("Conversation after update", updated.getDisplayName()); + } + + @Test + @Order(5) + public void testDelete() { + ConversationsAsyncClient client = getConversationsAsyncClient(); + Conversation created + = client.create(projectName, investigationPath(projectName, investigationName), "Conversation to delete") + .block(); + + client.delete(created.getName()).block(); + + PagedConversation page = client.list(null, projectName, null, null, null, null).block(); + boolean stillPresent + = page.getValue().stream().anyMatch(conversation -> created.getName().equals(conversation.getName())); + assertFalse(stillPresent); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/ConversationsClientTest.java b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/ConversationsClientTest.java new file mode 100644 index 000000000000..1f5dabb8b5c1 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/ConversationsClientTest.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.models.Conversation; +import com.azure.ai.discovery.models.PagedConversation; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * Tests for {@link ConversationsClient}, covering all convenience operations: create, get, list, stableUpdate, and + * delete. + */ +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public final class ConversationsClientTest extends DiscoveryClientTestBase { + + @Test + @Order(1) + public void testCreate() { + ConversationsClient client = getConversationsClient(); + Conversation conversation + = client.create(projectName, investigationPath(projectName, investigationName), "Test conversation"); + + assertNotNull(conversation); + assertEquals(projectName, conversation.getProjectName()); + assertNotNull(conversation.getName()); + assertNotNull(conversation.getCreatedAt()); + } + + @Test + @Order(2) + public void testList() { + ConversationsClient client = getConversationsClient(); + PagedConversation page = client.list(null, projectName, null, null, null, null); + + assertNotNull(page.getValue()); + List conversations = page.getValue(); + assertFalse(conversations.isEmpty()); + for (Conversation conversation : conversations) { + assertEquals(projectName, conversation.getProjectName()); + assertNotNull(conversation.getCreatedAt()); + assertNotNull(conversation.getInvestigationName()); + } + } + + @Test + @Order(3) + public void testGet() { + ConversationsClient client = getConversationsClient(); + Conversation created = client.create(projectName, investigationPath(projectName, investigationName), + "Conversation for get test"); + + Conversation conversation = client.get(created.getName()); + assertNotNull(conversation); + assertEquals(created.getName(), conversation.getName()); + assertEquals(projectName, conversation.getProjectName()); + assertNotNull(conversation.getCreatedAt()); + } + + @Test + @Order(4) + public void testStableUpdate() { + ConversationsClient client = getConversationsClient(); + Conversation created = client.create(projectName, investigationPath(projectName, investigationName), + "Conversation before update"); + + Conversation updated + = client.stableUpdate(created.getName(), new Conversation().setDisplayName("Conversation after update")); + + assertNotNull(updated); + assertEquals(created.getName(), updated.getName()); + assertEquals("Conversation after update", updated.getDisplayName()); + } + + @Test + @Order(5) + public void testDelete() { + ConversationsClient client = getConversationsClient(); + Conversation created + = client.create(projectName, investigationPath(projectName, investigationName), "Conversation to delete"); + + client.delete(created.getName()); + + // Listing after deletion should not contain the deleted conversation. + PagedConversation page = client.list(null, projectName, null, null, null, null); + boolean stillPresent + = page.getValue().stream().anyMatch(conversation -> created.getName().equals(conversation.getName())); + assertFalse(stillPresent); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/DiscoveryClientTestBase.java b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/DiscoveryClientTestBase.java new file mode 100644 index 000000000000..678cfbfd3f07 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/DiscoveryClientTestBase.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.discovery; + +import com.azure.core.credential.AccessToken; +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.test.models.CustomMatcher; +import com.azure.core.test.models.TestProxySanitizer; +import com.azure.core.test.models.TestProxySanitizerType; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; +import reactor.core.publisher.Mono; + +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Base class for {@code azure-ai-discovery} recorded tests. Provides configured sync and async clients for both the + * Discovery Workspace and Discovery Bookshelf services, wired for record/playback via the test proxy. + */ +class DiscoveryClientTestBase extends TestProxyTestBase { + + // Sanitized placeholder values. These are the values scrubbed into recordings and used during playback, so they + // must stay in sync with the sanitized environment used by the recording-cleanup tooling. + private static final String SANITIZED_WORKSPACE_ENDPOINT = "https://test-wkspc.workspace.discovery.azure.com"; + private static final String SANITIZED_BOOKSHELF_ENDPOINT = "https://test-bkshlf.bookshelf.discovery.azure.com"; + private static final String SANITIZED_PROJECT_NAME = "test-project"; + private static final String SANITIZED_INVESTIGATION_NAME = "test-invst"; + private static final String SANITIZED_KNOWLEDGE_BASE_NAME = "test-kb"; + private static final String SANITIZED_AGENT_NAME = "test-agent"; + private static final String SANITIZED_TOOL_ID + = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Discovery/tools/testtool"; + private static final String SANITIZED_NODE_POOL_ID + = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Discovery/supercomputers/test-sc/nodePools/nodepool1"; + private static final String SANITIZED_STORAGE_ASSET_ID + = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/microsoft.discovery/storagecontainers/test-storage/storageassets/test-sa"; + private static final String SANITIZED_USER_ASSIGNED_IDENTITY + = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-mi"; + + // Regex-based sanitizer patterns (mirroring the Python conftest). These scrub structural, service-independent + // values (subscription/GUIDs, service endpoints). Resource names (project/investigation/knowledge base/tool ids) + // are intentionally NOT sanitized here; they are handled by the external recording-cleanup tooling. + private static final String ZERO_GUID = "00000000-0000-0000-0000-000000000000"; + private static final String GUID_REGEX + = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"; + private static final String WORKSPACE_ENDPOINT_REGEX + = "https://[a-zA-Z0-9-]+[.]workspace[a-zA-Z0-9-]*[.]discovery[.]azure[.]com"; + private static final String BOOKSHELF_ENDPOINT_REGEX + = "https://[a-zA-Z0-9-]+[.]bookshelf[a-zA-Z0-9-]*[.]discovery[.]azure[.]com"; + + protected String workspaceEndpoint; + protected String bookshelfEndpoint; + protected String projectName; + protected String investigationName; + protected String knowledgeBaseName; + protected String agentName; + protected String toolId; + protected String nodePoolId; + protected String storageAssetId; + protected String userAssignedIdentity; + + @Override + protected void beforeTest() { + Configuration configuration = Configuration.getGlobalConfiguration(); + // Fallback defaults mirror the sanitized values used when scrubbing recordings, so playback requests match + // the cleaned recordings. Live/record runs override these via environment variables. + workspaceEndpoint = configuration.get("AZURE_DISCOVERY_WORKSPACE_ENDPOINT", SANITIZED_WORKSPACE_ENDPOINT); + bookshelfEndpoint = configuration.get("AZURE_DISCOVERY_BOOKSHELF_ENDPOINT", SANITIZED_BOOKSHELF_ENDPOINT); + projectName = configuration.get("AZURE_DISCOVERY_PROJECT_NAME", SANITIZED_PROJECT_NAME); + investigationName = configuration.get("AZURE_DISCOVERY_INVESTIGATION_NAME", SANITIZED_INVESTIGATION_NAME); + knowledgeBaseName = configuration.get("KNOWLEDGE_BASE_NAME", SANITIZED_KNOWLEDGE_BASE_NAME); + agentName = configuration.get("AGENT_NAME", SANITIZED_AGENT_NAME); + toolId = configuration.get("TOOL_ID", SANITIZED_TOOL_ID); + nodePoolId = configuration.get("NODE_POOL_ID", SANITIZED_NODE_POOL_ID); + storageAssetId = configuration.get("STORAGE_ASSET_ID", SANITIZED_STORAGE_ASSET_ID); + userAssignedIdentity = configuration.get("USER_ASSIGNED_IDENTITY", SANITIZED_USER_ASSIGNED_IDENTITY); + registerSanitizers(); + registerMatchers(); + } + + /** + * Registers a relaxed playback request matcher. It ignores request bodies and volatile headers so that recordings + * match regardless of per-request values (auth tokens, dates, correlation ids) that differ between the recorded + * and replayed requests. Playback entries are still matched by method, URL, and order. + */ + private void registerMatchers() { + if (getTestMode() != TestMode.PLAYBACK) { + return; + } + interceptorManager.addMatchers(new CustomMatcher().setComparingBodies(false) + .setExcludedHeaders(Arrays.asList("Authorization", "Connection", "Content-Length", "Content-Type", "Date", + "User-Agent", "traceparent", "x-ms-client-request-id", "x-ms-date", "Accept")) + .setIgnoredQueryParameters(Arrays.asList("api-version"))); + } + + /** + * Registers test-proxy sanitizers, mirroring the Python conftest. These scrub structural values (subscription + * IDs / GUIDs, service endpoints, the client-request-id header, and the bogus LRO {@code Location} header) from + * recordings. Resource-name scrubbing is left to the external recording-cleanup tooling, which is the same + * approach used by the other language SDKs. Runs for record and playback modes only. + */ + private void registerSanitizers() { + if (getTestMode() == TestMode.LIVE) { + return; + } + List sanitizers = new ArrayList<>(); + // NOTE: We intentionally do NOT blanket-sanitize every GUID. Resource identifiers such as conversation names + // and long-running-operation ids are unique GUIDs that tests assert on; collapsing them all to a single value + // both breaks those assertions and prevents playback URL matching for LRO polling. Sensitive subscription and + // tenant identifiers are scrubbed structurally by the recording-cleanup tooling and the default sanitizers. + // Workspace and Bookshelf service endpoints, in both URLs and bodies. + sanitizers.add( + new TestProxySanitizer(WORKSPACE_ENDPOINT_REGEX, SANITIZED_WORKSPACE_ENDPOINT, TestProxySanitizerType.URL)); + sanitizers.add(new TestProxySanitizer(WORKSPACE_ENDPOINT_REGEX, SANITIZED_WORKSPACE_ENDPOINT, + TestProxySanitizerType.BODY_REGEX)); + sanitizers.add( + new TestProxySanitizer(BOOKSHELF_ENDPOINT_REGEX, SANITIZED_BOOKSHELF_ENDPOINT, TestProxySanitizerType.URL)); + sanitizers.add(new TestProxySanitizer(BOOKSHELF_ENDPOINT_REGEX, SANITIZED_BOOKSHELF_ENDPOINT, + TestProxySanitizerType.BODY_REGEX)); + // Client-request-id header. + sanitizers.add( + new TestProxySanitizer("x-ms-client-request-id", GUID_REGEX, ZERO_GUID, TestProxySanitizerType.HEADER)); + // Some LROs return a bogus "https://example.com" Location header; clear it so the poller uses + // operation-location instead. + sanitizers + .add(new TestProxySanitizer("Location", "^https://example[.]com$", "", TestProxySanitizerType.HEADER)); + interceptorManager.addSanitizers(sanitizers); + // Remove the default "$..name" body-key sanitizer (AZSDK3493); it would replace name fields with "Sanitized", + // which collapses the unique resource names that several tests assert on. + interceptorManager.removeSanitizers("AZSDK3493"); + // Remove the default operation-location header sanitizer (AZSDK2030); it rewrites the LRO poll URL to + // "https://example.com", which breaks long-running-operation polling during playback. The Python and other + // language test frameworks remove this same default sanitizer for the same reason. + interceptorManager.removeSanitizers("AZSDK2030"); + // Remove the default "$..id" body-key sanitizer (AZSDK3430); it replaces operation "id" fields with + // "Sanitized", which prevents getRunStatus/getOperationStatus from resolving the real operation id during + // playback. Operation ids are not sensitive, and request bodies are not compared by the matcher below. + interceptorManager.removeSanitizers("AZSDK3430"); + } + + // --- Workspace clients --- + + private WorkspaceClientBuilder workspaceClientBuilder() { + WorkspaceClientBuilder builder = new WorkspaceClientBuilder().endpoint(workspaceEndpoint) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + return applyTestMode(builder); + } + + protected ConversationsClient getConversationsClient() { + return workspaceClientBuilder().buildConversationsClient(); + } + + protected ConversationsAsyncClient getConversationsAsyncClient() { + return workspaceClientBuilder().buildConversationsAsyncClient(); + } + + protected InvestigationsClient getInvestigationsClient() { + return workspaceClientBuilder().buildInvestigationsClient(); + } + + protected InvestigationsAsyncClient getInvestigationsAsyncClient() { + return workspaceClientBuilder().buildInvestigationsAsyncClient(); + } + + protected TasksClient getTasksClient() { + return workspaceClientBuilder().buildTasksClient(); + } + + protected TasksAsyncClient getTasksAsyncClient() { + return workspaceClientBuilder().buildTasksAsyncClient(); + } + + protected ToolsClient getToolsClient() { + return workspaceClientBuilder().buildToolsClient(); + } + + protected ToolsAsyncClient getToolsAsyncClient() { + return workspaceClientBuilder().buildToolsAsyncClient(); + } + + // --- Bookshelf clients --- + + private BookshelfClientBuilder bookshelfClientBuilder() { + BookshelfClientBuilder builder = new BookshelfClientBuilder().endpoint(bookshelfEndpoint) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + return applyTestMode(builder); + } + + protected BookshelfClient getBookshelfClient() { + return bookshelfClientBuilder().buildClient(); + } + + protected BookshelfAsyncClient getBookshelfAsyncClient() { + return bookshelfClientBuilder().buildAsyncClient(); + } + + // --- helpers --- + + private WorkspaceClientBuilder applyTestMode(WorkspaceClientBuilder builder) { + if (getTestMode() == TestMode.PLAYBACK) { + builder.httpClient(interceptorManager.getPlaybackClient()).credential(fakeCredential()); + } else if (getTestMode() == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else { + builder.credential(new DefaultAzureCredentialBuilder().build()); + } + return builder; + } + + private BookshelfClientBuilder applyTestMode(BookshelfClientBuilder builder) { + if (getTestMode() == TestMode.PLAYBACK) { + builder.httpClient(interceptorManager.getPlaybackClient()).credential(fakeCredential()); + } else if (getTestMode() == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else { + builder.credential(new DefaultAzureCredentialBuilder().build()); + } + return builder; + } + + private static TokenCredential fakeCredential() { + return request -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)); + } + + /** + * Builds the full resource path for an investigation, matching the service's expected {@code investigationName} + * path format. + * + * @param projectName the project name. + * @param investigationName the investigation name. + * @return the investigation resource path. + */ + protected static String investigationPath(String projectName, String investigationName) { + return "/projects/" + projectName + "/investigations/" + investigationName; + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/InvestigationsAsyncClientTest.java b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/InvestigationsAsyncClientTest.java new file mode 100644 index 000000000000..aaa4e4fccf9c --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/InvestigationsAsyncClientTest.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.models.DiscoveryEngine; +import com.azure.ai.discovery.models.DiscoveryEngineUpdate; +import com.azure.ai.discovery.models.Investigation; +import com.azure.ai.discovery.models.PagedInvestigation; +import com.azure.ai.discovery.models.PagedWorkingMemoryEntry; +import com.azure.ai.discovery.models.Task; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * Tests for {@link InvestigationsAsyncClient}, covering the investigation lifecycle and discovery-engine operations. + */ +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public final class InvestigationsAsyncClientTest extends DiscoveryClientTestBase { + + @Test + @Order(1) + public void testCreateOrReplace() { + InvestigationsAsyncClient client = getInvestigationsAsyncClient(); + Investigation investigation = client + .createOrReplace(projectName, investigationName, + new Investigation().setDisplayName("Test investigation").setDescription("Created by SDK tests")) + .block(); + + assertNotNull(investigation); + assertNotNull(investigation.getName()); + } + + @Test + @Order(3) + public void testGet() { + InvestigationsAsyncClient client = getInvestigationsAsyncClient(); + Investigation investigation = client.get(projectName, investigationName).block(); + + assertNotNull(investigation); + assertNotNull(investigation.getName()); + } + + @Test + @Order(2) + public void testList() { + InvestigationsAsyncClient client = getInvestigationsAsyncClient(); + PagedInvestigation page = client.list(projectName).block(); + + assertNotNull(page); + assertNotNull(page.getValue()); + assertFalse(page.getValue().isEmpty()); + } + + @Test + @Order(9) + public void testUpdate() { + InvestigationsAsyncClient client = getInvestigationsAsyncClient(); + Investigation investigation + = client.update(projectName, investigationName, new Investigation().setDescription("Updated by SDK tests")) + .block(); + + assertNotNull(investigation); + } + + @Test + @Order(5) + public void testGetDiscoveryEngine() { + InvestigationsAsyncClient client = getInvestigationsAsyncClient(); + DiscoveryEngine engine = client.getDiscoveryEngine(projectName, investigationName).block(); + + assertNotNull(engine); + } + + @Test + @Order(4) + public void testUpdateDiscoveryEngine() { + InvestigationsAsyncClient client = getInvestigationsAsyncClient(); + DiscoveryEngine engine + = client + .updateDiscoveryEngine(projectName, investigationName, + new DiscoveryEngineUpdate().setSystemPrompt("You are a helpful discovery assistant.")) + .block(); + + assertNotNull(engine); + } + + @Test + @Order(6) + public void testStartDiscoveryEngine() { + // The discovery engine requires at least one task in the investigation before it can start. + TasksAsyncClient tasksClient = getTasksAsyncClient(); + Task task + = tasksClient + .create(projectName, investigationName, + new Task().setTitle("test-task").setDescription("Task for engine start test")) + .block(); + try { + InvestigationsAsyncClient client = getInvestigationsAsyncClient(); + DiscoveryEngine engine = client.startDiscoveryEngine(projectName, investigationName).block(); + assertNotNull(engine); + } finally { + tasksClient.delete(projectName, investigationName, task.getName()).block(); + } + } + + @Test + @Order(7) + public void testGetDiscoveryEngineMemory() { + InvestigationsAsyncClient client = getInvestigationsAsyncClient(); + PagedWorkingMemoryEntry memory = client.getDiscoveryEngineMemory(projectName, investigationName).block(); + + assertNotNull(memory); + assertNotNull(memory.getValue()); + } + + @Test + @Order(8) + public void testStopDiscoveryEngine() { + InvestigationsAsyncClient client = getInvestigationsAsyncClient(); + DiscoveryEngine engine = client.stopDiscoveryEngine(projectName, investigationName).block(); + + assertNotNull(engine); + } + + @Test + @Order(10) + public void testBeginDelete() { + InvestigationsAsyncClient client = getInvestigationsAsyncClient(); + String throwawayName = testResourceNamer.randomName("sdk-del-invst", 24); + client + .createOrReplace(projectName, throwawayName, new Investigation().setDisplayName("Investigation to delete")) + .block(); + + client.beginDelete(projectName, throwawayName).blockLast(); + + PagedInvestigation page = client.list(projectName).block(); + boolean stillPresent + = page.getValue().stream().anyMatch(investigation -> throwawayName.equals(investigation.getName())); + assertFalse(stillPresent); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/InvestigationsClientTest.java b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/InvestigationsClientTest.java new file mode 100644 index 000000000000..15c0203da25f --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/InvestigationsClientTest.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.models.DiscoveryEngine; +import com.azure.ai.discovery.models.DiscoveryEngineUpdate; +import com.azure.ai.discovery.models.Investigation; +import com.azure.ai.discovery.models.PagedInvestigation; +import com.azure.ai.discovery.models.PagedWorkingMemoryEntry; +import com.azure.ai.discovery.models.Task; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.SyncPoller; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * Tests for {@link InvestigationsClient}, covering the investigation lifecycle and the associated discovery-engine + * operations. + */ +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public final class InvestigationsClientTest extends DiscoveryClientTestBase { + + @Test + @Order(1) + public void testCreateOrReplace() { + InvestigationsClient client = getInvestigationsClient(); + Investigation investigation = client.createOrReplace(projectName, investigationName, + new Investigation().setDisplayName("Test investigation").setDescription("Created by SDK tests")); + + assertNotNull(investigation); + assertNotNull(investigation.getName()); + } + + @Test + @Order(3) + public void testGet() { + InvestigationsClient client = getInvestigationsClient(); + Investigation investigation = client.get(projectName, investigationName); + + assertNotNull(investigation); + assertNotNull(investigation.getName()); + } + + @Test + @Order(2) + public void testList() { + InvestigationsClient client = getInvestigationsClient(); + PagedInvestigation page = client.list(projectName); + + assertNotNull(page.getValue()); + assertFalse(page.getValue().isEmpty()); + } + + @Test + @Order(9) + public void testUpdate() { + InvestigationsClient client = getInvestigationsClient(); + Investigation investigation + = client.update(projectName, investigationName, new Investigation().setDescription("Updated by SDK tests")); + + assertNotNull(investigation); + } + + @Test + @Order(5) + public void testGetDiscoveryEngine() { + InvestigationsClient client = getInvestigationsClient(); + DiscoveryEngine engine = client.getDiscoveryEngine(projectName, investigationName); + + assertNotNull(engine); + } + + @Test + @Order(4) + public void testUpdateDiscoveryEngine() { + InvestigationsClient client = getInvestigationsClient(); + DiscoveryEngine engine = client.updateDiscoveryEngine(projectName, investigationName, + new DiscoveryEngineUpdate().setSystemPrompt("You are a helpful discovery assistant.")); + + assertNotNull(engine); + } + + @Test + @Order(6) + public void testStartDiscoveryEngine() { + // The discovery engine requires at least one task in the investigation before it can start. + TasksClient tasksClient = getTasksClient(); + Task task = tasksClient.create(projectName, investigationName, + new Task().setTitle("test-task").setDescription("Task for engine start test")); + try { + InvestigationsClient client = getInvestigationsClient(); + DiscoveryEngine engine = client.startDiscoveryEngine(projectName, investigationName); + assertNotNull(engine); + } finally { + tasksClient.delete(projectName, investigationName, task.getName()); + } + } + + @Test + @Order(7) + public void testGetDiscoveryEngineMemory() { + InvestigationsClient client = getInvestigationsClient(); + PagedWorkingMemoryEntry memory = client.getDiscoveryEngineMemory(projectName, investigationName); + + assertNotNull(memory); + assertNotNull(memory.getValue()); + } + + @Test + @Order(8) + public void testStopDiscoveryEngine() { + InvestigationsClient client = getInvestigationsClient(); + DiscoveryEngine engine = client.stopDiscoveryEngine(projectName, investigationName); + + assertNotNull(engine); + } + + @Test + @Order(10) + public void testBeginDelete() { + InvestigationsClient client = getInvestigationsClient(); + // Create a throwaway investigation so the shared fixture is not removed. + String throwawayName = testResourceNamer.randomName("sdk-del-invst", 24); + client.createOrReplace(projectName, throwawayName, + new Investigation().setDisplayName("Investigation to delete")); + + SyncPoller poller = client.beginDelete(projectName, throwawayName); + poller.waitForCompletion(); + + PagedInvestigation page = client.list(projectName); + boolean stillPresent + = page.getValue().stream().anyMatch(investigation -> throwawayName.equals(investigation.getName())); + assertFalse(stillPresent); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/TasksAsyncClientTest.java b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/TasksAsyncClientTest.java new file mode 100644 index 000000000000..7a09d407eeb8 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/TasksAsyncClientTest.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.models.ByType; +import com.azure.ai.discovery.models.ExecutionHistoryEntry; +import com.azure.ai.discovery.models.Task; +import com.azure.ai.discovery.models.TaskAssignee; +import com.azure.ai.discovery.models.TaskComment; +import com.azure.ai.discovery.models.TaskPriority; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Tests for {@link TasksAsyncClient}, covering create, get, list, stableUpdate, start, addComment, + * addExecutionHistory, and delete. + */ +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public final class TasksAsyncClientTest extends DiscoveryClientTestBase { + + private Task createTask(TasksAsyncClient client, String title) { + return client + .create(projectName, investigationName, + new Task().setTitle(title) + .setDescription("Created by SDK tests") + .setPriority(TaskPriority.MEDIUM) + .setAssignedTo(new TaskAssignee().setId(agentName).setType(ByType.APPLICATION))) + .block(); + } + + @Test + @Order(2) + public void testCreate() { + TasksAsyncClient client = getTasksAsyncClient(); + Task task = createTask(client, "Test task"); + try { + assertNotNull(task); + assertNotNull(task.getName()); + assertEquals("Test task", task.getTitle()); + } finally { + client.delete(projectName, investigationName, task.getName()).block(); + } + } + + @Test + @Order(3) + public void testGet() { + TasksAsyncClient client = getTasksAsyncClient(); + Task created = createTask(client, "Task for get"); + try { + Task task = client.get(projectName, investigationName, created.getName()).block(); + assertNotNull(task); + assertEquals(created.getName(), task.getName()); + } finally { + client.delete(projectName, investigationName, created.getName()).block(); + } + } + + @Test + @Order(1) + public void testList() { + TasksAsyncClient client = getTasksAsyncClient(); + Task created = createTask(client, "Task for list"); + try { + List tasks = client.list(projectName, investigationName).collectList().block(); + assertNotNull(tasks); + assertTrue(tasks.stream().anyMatch(task -> created.getName().equals(task.getName()))); + } finally { + client.delete(projectName, investigationName, created.getName()).block(); + } + } + + @Test + @Order(4) + public void testStableUpdate() { + TasksAsyncClient client = getTasksAsyncClient(); + Task created = createTask(client, "Task before update"); + try { + Task updated + = client + .stableUpdate(projectName, investigationName, created.getName(), + new Task().setDescription("Updated by SDK tests")) + .block(); + assertNotNull(updated); + assertEquals(created.getName(), updated.getName()); + } finally { + client.delete(projectName, investigationName, created.getName()).block(); + } + } + + @Test + @Order(6) + public void testStart() { + TasksAsyncClient client = getTasksAsyncClient(); + Task created = createTask(client, "Task to start"); + try { + Task started = client.start(projectName, investigationName, created.getName()).block(); + assertNotNull(started); + } finally { + client.delete(projectName, investigationName, created.getName()).block(); + } + } + + @Test + @Order(7) + public void testAddComment() { + TasksAsyncClient client = getTasksAsyncClient(); + Task created = createTask(client, "Task for comment"); + try { + Task task + = client + .addComment(projectName, investigationName, created.getName(), + new TaskComment().setText("A comment from the SDK tests")) + .block(); + assertNotNull(task); + } finally { + client.delete(projectName, investigationName, created.getName()).block(); + } + } + + @Test + @Order(8) + public void testAddExecutionHistory() { + TasksAsyncClient client = getTasksAsyncClient(); + Task created = createTask(client, "Task for execution history"); + try { + Task task = client.addExecutionHistory(projectName, investigationName, created.getName(), + new ExecutionHistoryEntry().setCreatedAt(OffsetDateTime.of(2026, 4, 8, 21, 0, 0, 0, ZoneOffset.UTC)) + .setAction("completed") + .setCreatedBy(agentName) + .setCreatedByType(ByType.APPLICATION) + .setSummary("Task execution completed")) + .block(); + assertNotNull(task); + } finally { + client.delete(projectName, investigationName, created.getName()).block(); + } + } + + @Test + @Order(5) + public void testDelete() { + TasksAsyncClient client = getTasksAsyncClient(); + Task created = createTask(client, "Task to delete"); + client.delete(projectName, investigationName, created.getName()).block(); + + List tasks = client.list(projectName, investigationName).collectList().block(); + assertTrue(tasks.stream().noneMatch(task -> created.getName().equals(task.getName()))); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/TasksClientTest.java b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/TasksClientTest.java new file mode 100644 index 000000000000..caa78d05cf8c --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/TasksClientTest.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.models.ByType; +import com.azure.ai.discovery.models.ExecutionHistoryEntry; +import com.azure.ai.discovery.models.Task; +import com.azure.ai.discovery.models.TaskAssignee; +import com.azure.ai.discovery.models.TaskComment; +import com.azure.ai.discovery.models.TaskPriority; +import com.azure.core.http.rest.PagedIterable; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Tests for {@link TasksClient}, covering create, get, list (with and without filter), stableUpdate, start, + * addComment, addExecutionHistory, and delete. + */ +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public final class TasksClientTest extends DiscoveryClientTestBase { + + private Task createTask(TasksClient client, String title) { + return client.create(projectName, investigationName, + new Task().setTitle(title) + .setDescription("Created by SDK tests") + .setPriority(TaskPriority.MEDIUM) + .setAssignedTo(new TaskAssignee().setId(agentName).setType(ByType.APPLICATION))); + } + + @Test + @Order(2) + public void testCreate() { + TasksClient client = getTasksClient(); + Task task = createTask(client, "Test task"); + try { + assertNotNull(task); + assertNotNull(task.getName()); + assertEquals("Test task", task.getTitle()); + } finally { + client.delete(projectName, investigationName, task.getName()); + } + } + + @Test + @Order(3) + public void testGet() { + TasksClient client = getTasksClient(); + Task created = createTask(client, "Task for get"); + try { + Task task = client.get(projectName, investigationName, created.getName()); + assertNotNull(task); + assertEquals(created.getName(), task.getName()); + } finally { + client.delete(projectName, investigationName, created.getName()); + } + } + + @Test + @Order(1) + public void testList() { + TasksClient client = getTasksClient(); + Task created = createTask(client, "Task for list"); + try { + PagedIterable tasks = client.list(projectName, investigationName); + assertTrue(tasks.stream().anyMatch(task -> created.getName().equals(task.getName()))); + } finally { + client.delete(projectName, investigationName, created.getName()); + } + } + + @Test + @Order(4) + public void testStableUpdate() { + TasksClient client = getTasksClient(); + Task created = createTask(client, "Task before update"); + try { + Task updated = client.stableUpdate(projectName, investigationName, created.getName(), + new Task().setDescription("Updated by SDK tests")); + assertNotNull(updated); + assertEquals(created.getName(), updated.getName()); + } finally { + client.delete(projectName, investigationName, created.getName()); + } + } + + @Test + @Order(6) + public void testStart() { + TasksClient client = getTasksClient(); + Task created = createTask(client, "Task to start"); + try { + Task started = client.start(projectName, investigationName, created.getName()); + assertNotNull(started); + } finally { + client.delete(projectName, investigationName, created.getName()); + } + } + + @Test + @Order(7) + public void testAddComment() { + TasksClient client = getTasksClient(); + Task created = createTask(client, "Task for comment"); + try { + Task task = client.addComment(projectName, investigationName, created.getName(), + new TaskComment().setText("A comment from the SDK tests")); + assertNotNull(task); + } finally { + client.delete(projectName, investigationName, created.getName()); + } + } + + @Test + @Order(8) + public void testAddExecutionHistory() { + TasksClient client = getTasksClient(); + Task created = createTask(client, "Task for execution history"); + try { + Task task = client.addExecutionHistory(projectName, investigationName, created.getName(), + new ExecutionHistoryEntry().setCreatedAt(OffsetDateTime.of(2026, 4, 8, 21, 0, 0, 0, ZoneOffset.UTC)) + .setAction("completed") + .setCreatedBy(agentName) + .setCreatedByType(ByType.APPLICATION) + .setSummary("Task execution completed")); + assertNotNull(task); + } finally { + client.delete(projectName, investigationName, created.getName()); + } + } + + @Test + @Order(5) + public void testDelete() { + TasksClient client = getTasksClient(); + Task created = createTask(client, "Task to delete"); + client.delete(projectName, investigationName, created.getName()); + + PagedIterable tasks = client.list(projectName, investigationName); + assertTrue(tasks.stream().noneMatch(task -> created.getName().equals(task.getName()))); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/ToolsAsyncClientTest.java b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/ToolsAsyncClientTest.java new file mode 100644 index 000000000000..9d4936df2c4f --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/ToolsAsyncClientTest.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.models.ComputeUsage; +import com.azure.ai.discovery.models.OperationStatusRunResultError; +import com.azure.ai.discovery.models.PagedOperation; +import com.azure.ai.discovery.models.RunOptions; +import com.azure.ai.discovery.models.RunResult; +import com.azure.core.util.polling.AsyncPollResponse; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import java.util.Arrays; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * Tests for {@link ToolsAsyncClient}, covering the run lifecycle, run-status retrieval, operation listing, and + * compute-usage retrieval. + */ +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public final class ToolsAsyncClientTest extends DiscoveryClientTestBase { + + private RunOptions runOptions() { + return new RunOptions(projectName, toolId, Arrays.asList(nodePoolId)).setCommand("echo hello"); + } + + @Test + @Order(1) + public void testBeginRun() { + ToolsAsyncClient client = getToolsAsyncClient(); + RunResult result = client.beginRun(runOptions()).last().flatMap(AsyncPollResponse::getFinalResult).block(); + + assertNotNull(result); + } + + @Test + @Order(3) + public void testGetOperations() { + ToolsAsyncClient client = getToolsAsyncClient(); + PagedOperation operations = client.getOperations(projectName).block(); + + assertNotNull(operations); + assertNotNull(operations.getValue()); + } + + @Test + @Order(2) + public void testGetRunStatus() { + ToolsAsyncClient client = getToolsAsyncClient(); + String operationId = client.beginRun(runOptions()).blockLast().getValue().getOperationId(); + + OperationStatusRunResultError status = client.getRunStatus(projectName, operationId).block(); + assertNotNull(status); + } + + @Test + @Order(4) + public void testGetComputeUsage() { + ToolsAsyncClient client = getToolsAsyncClient(); + ComputeUsage usage = client.getComputeUsage(projectName).block(); + + assertNotNull(usage); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/ToolsClientTest.java b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/ToolsClientTest.java new file mode 100644 index 000000000000..411829f4046d --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/ToolsClientTest.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.ai.discovery; + +import com.azure.ai.discovery.models.ComputeUsage; +import com.azure.ai.discovery.models.OperationStatusRunResultError; +import com.azure.ai.discovery.models.PagedOperation; +import com.azure.ai.discovery.models.RunOptions; +import com.azure.ai.discovery.models.RunResult; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.SyncPoller; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import java.util.Arrays; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +/** + * Tests for {@link ToolsClient}, covering the run lifecycle (begin/cancel), run-status retrieval, operation listing, + * and compute-usage retrieval. + */ +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public final class ToolsClientTest extends DiscoveryClientTestBase { + + @Test + @Order(1) + public void testBeginRun() { + ToolsClient client = getToolsClient(); + SyncPoller poller + = client.beginRun(new RunOptions(projectName, toolId, Arrays.asList(nodePoolId)).setCommand("echo hello")); + RunResult result = poller.getFinalResult(); + + assertNotNull(result); + } + + @Test + @Order(3) + public void testGetOperations() { + ToolsClient client = getToolsClient(); + PagedOperation operations = client.getOperations(projectName); + + assertNotNull(operations); + assertNotNull(operations.getValue()); + } + + @Test + @Order(2) + public void testGetRunStatus() { + ToolsClient client = getToolsClient(); + // Start a run so there is an operation to query. + SyncPoller poller + = client.beginRun(new RunOptions(projectName, toolId, Arrays.asList(nodePoolId)).setCommand("echo hello")); + String operationId = poller.poll().getValue().getOperationId(); + + OperationStatusRunResultError status = client.getRunStatus(projectName, operationId); + assertNotNull(status); + } + + @Test + @Order(4) + public void testGetComputeUsage() { + ToolsClient client = getToolsClient(); + ComputeUsage usage = client.getComputeUsage(projectName); + + assertNotNull(usage); + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/generated/WorkspaceClientTestBase.java b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/generated/WorkspaceClientTestBase.java new file mode 100644 index 000000000000..9badc6a6efb9 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/java/com/azure/ai/discovery/generated/WorkspaceClientTestBase.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.discovery.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.ai.discovery.BookshelfClient; +import com.azure.ai.discovery.BookshelfClientBuilder; +import com.azure.ai.discovery.ConversationsClient; +import com.azure.ai.discovery.InvestigationsClient; +import com.azure.ai.discovery.TasksClient; +import com.azure.ai.discovery.ToolsClient; +import com.azure.ai.discovery.WorkspaceClientBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.test.utils.MockTokenCredential; +import com.azure.core.util.Configuration; +import com.azure.identity.DefaultAzureCredentialBuilder; + +class WorkspaceClientTestBase extends TestProxyTestBase { + protected InvestigationsClient investigationsClient; + + protected ConversationsClient conversationsClient; + + protected ToolsClient toolsClient; + + protected TasksClient tasksClient; + + protected BookshelfClient bookshelfClient; + + @Override + protected void beforeTest() { + WorkspaceClientBuilder investigationsClientbuilder + = new WorkspaceClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + investigationsClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + investigationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + investigationsClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + investigationsClient = investigationsClientbuilder.buildInvestigationsClient(); + + WorkspaceClientBuilder conversationsClientbuilder + = new WorkspaceClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + conversationsClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + conversationsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + conversationsClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + conversationsClient = conversationsClientbuilder.buildConversationsClient(); + + WorkspaceClientBuilder toolsClientbuilder + = new WorkspaceClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + toolsClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + toolsClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + toolsClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + toolsClient = toolsClientbuilder.buildToolsClient(); + + WorkspaceClientBuilder tasksClientbuilder + = new WorkspaceClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + tasksClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + tasksClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + tasksClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + tasksClient = tasksClientbuilder.buildTasksClient(); + + BookshelfClientBuilder bookshelfClientbuilder + = new BookshelfClientBuilder().endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.PLAYBACK) { + bookshelfClientbuilder.credential(new MockTokenCredential()); + } else if (getTestMode() == TestMode.RECORD) { + bookshelfClientbuilder.addPolicy(interceptorManager.getRecordPolicy()) + .credential(new DefaultAzureCredentialBuilder().build()); + } else if (getTestMode() == TestMode.LIVE) { + bookshelfClientbuilder.credential(new DefaultAzureCredentialBuilder().build()); + } + bookshelfClient = bookshelfClientbuilder.buildClient(); + + } +} diff --git a/sdk/discovery/azure-ai-discovery/src/test/resources/junit-platform.properties b/sdk/discovery/azure-ai-discovery/src/test/resources/junit-platform.properties new file mode 100644 index 000000000000..5bf23afb90af --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/src/test/resources/junit-platform.properties @@ -0,0 +1,8 @@ +# Global default timeout for all @Test methods. Long-running Discovery operations (especially KnowledgeBase +# indexing/search/delete) can be slow, and a service-side issue can cause an LRO to never reach a terminal state. +# A generous per-test timeout ensures a hung test fails fast instead of blocking the entire suite. +# +# separate_thread mode runs each test on its own thread so a blocked call (e.g. a reactive block()/blockLast() +# waiting on a non-terminating poll) can be interrupted when the timeout elapses. +junit.jupiter.execution.timeout.testable.method.default = 10 m +junit.jupiter.execution.timeout.thread.mode.default = separate_thread diff --git a/sdk/discovery/azure-ai-discovery/test-resources.json b/sdk/discovery/azure-ai-discovery/test-resources.json new file mode 100644 index 000000000000..0ff26bd18fef --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/test-resources.json @@ -0,0 +1,136 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "baseName": { + "type": "string", + "defaultValue": "[resourceGroup().name]", + "metadata": { + "description": "The base resource name." + } + }, + "testApplicationOid": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The client OID to grant access to test resources." + } + }, + "tenantId": { + "type": "string", + "defaultValue": "", + "metadata": { + "description": "The tenant ID to which the application and resources belong." + } + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "The location of the resource. By default, this is the same as the resource group." + } + }, + "workspaceEndpoint": { + "type": "string", + "defaultValue": "https://test-wkspc.workspace.discovery.azure.com", + "metadata": { + "description": "Endpoint of a pre-provisioned Discovery Workspace service. Supplied at test time; not deployed by this template." + } + }, + "bookshelfEndpoint": { + "type": "string", + "defaultValue": "https://test-bkshlf.bookshelf.discovery.azure.com", + "metadata": { + "description": "Endpoint of a pre-provisioned Discovery Bookshelf service. Supplied at test time; not deployed by this template." + } + }, + "projectName": { + "type": "string", + "defaultValue": "test-project", + "metadata": { + "description": "Name of a pre-provisioned Discovery project used by Workspace tests." + } + }, + "investigationName": { + "type": "string", + "defaultValue": "test-invst", + "metadata": { + "description": "Name of a pre-provisioned investigation used by Workspace tests." + } + }, + "knowledgeBaseName": { + "type": "string", + "defaultValue": "test-kb", + "metadata": { + "description": "Name of a pre-provisioned knowledge base used by Bookshelf tests." + } + }, + "toolId": { + "type": "string", + "defaultValue": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Discovery/tools/testtool", + "metadata": { + "description": "Resource ID of a pre-provisioned Discovery tool used by Tools tests." + } + }, + "nodePoolId": { + "type": "string", + "defaultValue": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Discovery/supercomputers/test-sc/nodePools/nodepool1", + "metadata": { + "description": "Resource ID of a pre-provisioned node pool used by Tools tests." + } + }, + "storageAssetId": { + "type": "string", + "defaultValue": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/microsoft.discovery/storagecontainers/test-storage/storageassets/test-sa", + "metadata": { + "description": "Resource ID of a pre-provisioned storage asset used by Bookshelf tests." + } + }, + "userAssignedIdentity": { + "type": "string", + "defaultValue": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-mi", + "metadata": { + "description": "Resource ID of a user-assigned managed identity used by Bookshelf tests." + } + } + }, + "resources": [], + "outputs": { + "AZURE_DISCOVERY_WORKSPACE_ENDPOINT": { + "type": "string", + "value": "[parameters('workspaceEndpoint')]" + }, + "AZURE_DISCOVERY_BOOKSHELF_ENDPOINT": { + "type": "string", + "value": "[parameters('bookshelfEndpoint')]" + }, + "AZURE_DISCOVERY_PROJECT_NAME": { + "type": "string", + "value": "[parameters('projectName')]" + }, + "AZURE_DISCOVERY_INVESTIGATION_NAME": { + "type": "string", + "value": "[parameters('investigationName')]" + }, + "KNOWLEDGE_BASE_NAME": { + "type": "string", + "value": "[parameters('knowledgeBaseName')]" + }, + "TOOL_ID": { + "type": "string", + "value": "[parameters('toolId')]" + }, + "NODE_POOL_ID": { + "type": "string", + "value": "[parameters('nodePoolId')]" + }, + "STORAGE_ASSET_ID": { + "type": "string", + "value": "[parameters('storageAssetId')]" + }, + "USER_ASSIGNED_IDENTITY": { + "type": "string", + "value": "[parameters('userAssignedIdentity')]" + } + } +} diff --git a/sdk/discovery/azure-ai-discovery/tsp-location.yaml b/sdk/discovery/azure-ai-discovery/tsp-location.yaml new file mode 100644 index 000000000000..4f2c253759b2 --- /dev/null +++ b/sdk/discovery/azure-ai-discovery/tsp-location.yaml @@ -0,0 +1,7 @@ +directory: specification/discovery/Discovery.Combined +commit: fbe3c49c541a2932f4a4cb348fb0798988f4aca4 +repo: Azure/azure-rest-api-specs +additionalDirectories: + - specification/discovery/Discovery.Common + - specification/discovery/Discovery.Workspace + - specification/discovery/Discovery.Bookshelf diff --git a/sdk/discovery/ci.yml b/sdk/discovery/ci.yml new file mode 100644 index 000000000000..7870cc76344a --- /dev/null +++ b/sdk/discovery/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/discovery/ci.yml + - sdk/discovery/azure-ai-discovery/ + exclude: + - sdk/discovery/pom.xml + - sdk/discovery/azure-ai-discovery/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/discovery/ci.yml + - sdk/discovery/azure-ai-discovery/ + exclude: + - sdk/discovery/pom.xml + - sdk/discovery/azure-ai-discovery/pom.xml + +parameters: + - name: release_azureaidiscovery + displayName: azure-ai-discovery + type: boolean + default: true + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: discovery + Artifacts: + - name: azure-ai-discovery + groupId: com.azure + safeName: azureaidiscovery + releaseInBatch: ${{ parameters.release_azureaidiscovery }} diff --git a/sdk/discovery/pom.xml b/sdk/discovery/pom.xml new file mode 100644 index 000000000000..fae83079c313 --- /dev/null +++ b/sdk/discovery/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-discovery-service + pom + 1.0.0 + + + azure-ai-discovery + +